Version Notes
- Removed template and project management.
+ Added single sign on support.
+ Added ability to sign up/sign in and connect the account.
* Remade project mapping
+ Improved event/send log.
Download this release
Release Info
Developer | comfirm |
Extension | Comfirm_AlphaMail |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.7 to 1.5.0
- app/code/community/Comfirm/AlphaMail/Block/Adminhtml/Notifications.php +37 -0
- app/code/community/Comfirm/AlphaMail/Block/Adminhtml/System/Config/Wrapper.php +1 -55
- app/code/community/Comfirm/AlphaMail/Block/Connect.php +12 -0
- app/code/community/Comfirm/AlphaMail/Block/EventLog.php +22 -16
- app/code/community/Comfirm/AlphaMail/Block/EventLog/Grid.php +88 -70
- app/code/community/Comfirm/AlphaMail/Block/EventLog/View.php +25 -51
- app/code/community/Comfirm/AlphaMail/Block/ProjectMapping/Grid.php +0 -71
- app/code/community/Comfirm/AlphaMail/Block/ProjectMapping/View.php +0 -52
- app/code/community/Comfirm/AlphaMail/Block/SendLog.php +23 -0
- app/code/community/Comfirm/AlphaMail/Block/SendLog/Grid.php +89 -0
- app/code/community/Comfirm/AlphaMail/Block/SendLog/View.php +26 -0
- app/code/community/Comfirm/AlphaMail/Block/{Project.php → SingleSignOn.php} +1 -1
- app/code/community/Comfirm/AlphaMail/Block/Template.php +0 -7
- app/code/community/Comfirm/AlphaMail/Helper/Connection.php +67 -0
- app/code/community/Comfirm/AlphaMail/Helper/Data.php +71 -3
- app/code/community/Comfirm/AlphaMail/Helper/Diagnostic.php +2 -0
- app/code/community/Comfirm/AlphaMail/Helper/Message.php +2 -2
- app/code/community/Comfirm/AlphaMail/Model/Email/Template.php +82 -73
- app/code/community/Comfirm/AlphaMail/controllers/ConnectController.php +233 -0
- app/code/community/Comfirm/AlphaMail/controllers/EventLogController.php +31 -28
- app/code/community/Comfirm/AlphaMail/controllers/ProjectController.php +0 -114
- app/code/community/Comfirm/AlphaMail/controllers/ProjectMappingController.php +130 -75
- app/code/community/Comfirm/AlphaMail/controllers/ProjectMappingController.php.bak +0 -136
- app/code/community/Comfirm/AlphaMail/controllers/SendLogController.php +34 -0
- app/code/community/Comfirm/AlphaMail/controllers/SingleSignOnController.php +41 -0
- app/code/community/Comfirm/AlphaMail/controllers/TemplateController.php +0 -84
- app/code/community/Comfirm/AlphaMail/etc/config.xml +35 -26
- app/code/community/Comfirm/AlphaMail/etc/system.xml +2 -2
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/accountservice.class.php +208 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/accountservice.interface.php +43 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/captchaservice.class.php +203 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/captchaservice.interface.php +48 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/account.class.php +60 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/captcha.class.php +41 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/integration.class.php +20 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/token.class.php +48 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/userticket.class.php +48 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/integrationservice.class.php +238 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/integrationservice.interface.php +48 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/projectservice.class.php +4 -2
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/tokenservice.class.php +236 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/tokenservice.interface.php +43 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/userticketservice.class.php +180 -0
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.services.client.rest/httprequest/httppacketparser.class.php +1 -1
- app/code/community/Comfirm/AlphaMail/libraries/comfirm.services.client.rest/restful.class.php +1 -0
- app/code/community/Comfirm/AlphaMail/sql/alphamail_setup/mysql4-install-1.1.7.php +0 -49
- app/code/community/Comfirm/AlphaMail/sql/alphamail_setup/mysql4-install-1.5.0.php +55 -0
- app/design/adminhtml/default/default/layout/alphamail.xml +5 -3
- app/design/adminhtml/default/default/template/alphamail/connect/completed.phtml +41 -0
- app/design/adminhtml/default/default/template/alphamail/connect/login.phtml +80 -0
- app/design/adminhtml/default/default/template/alphamail/connect/registration.phtml +125 -0
- app/design/adminhtml/default/default/template/alphamail/logging/event_view.phtml +25 -0
- app/design/adminhtml/default/default/template/alphamail/logging/send_view.phtml +27 -0
- app/design/adminhtml/default/default/template/alphamail/project/create.phtml +0 -88
- app/design/adminhtml/default/default/template/alphamail/project/edit.phtml +0 -90
- app/design/adminhtml/default/default/template/alphamail/project/index.phtml +0 -46
- app/design/adminhtml/default/default/template/alphamail/projectmapping/index.phtml +224 -46
- app/design/adminhtml/default/default/template/alphamail/singlesignon/index.phtml +18 -0
- app/design/adminhtml/default/default/template/alphamail/system/config.phtml +4 -0
- app/design/adminhtml/default/default/template/alphamail/template/create.phtml +0 -302
- app/design/adminhtml/default/default/template/alphamail/template/edit.phtml +0 -300
- app/design/adminhtml/default/default/template/alphamail/template/index.phtml +0 -45
- package.xml +12 -8
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/LICENSE +0 -19
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/README.md +0 -6
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/compress.html +0 -115
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/css/baboon.png +0 -0
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/css/baboon_vector.svg +0 -153
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/css/docs.css +0 -154
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/activeline.html +0 -72
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/changemode.html +0 -51
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/complete.html +0 -75
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/folding.html +0 -57
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/fullscreen.html +0 -158
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/marker.html +0 -53
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/mustache.html +0 -57
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/preview.html +0 -77
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/resize.html +0 -44
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/runmode.html +0 -50
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/search.html +0 -106
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/theme.html +0 -61
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/index.html +0 -295
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/internals.html +0 -383
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/codemirror.css +0 -77
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/codemirror.js +0 -2785
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/foldcode.js +0 -61
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/javascript-hint.js +0 -83
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/overlay.js +0 -51
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/runmode.js +0 -27
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/simple-hint.css +0 -16
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/simple-hint.js +0 -79
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/manual.html +0 -903
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clike/clike.js +0 -247
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clike/index.html +0 -102
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clojure/clojure.js +0 -207
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clojure/index.html +0 -67
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/coffeescript/LICENSE +0 -22
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/coffeescript/coffeescript.js +0 -325
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/coffeescript/index.html +0 -722
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/comlang/comlang.js +0 -108
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/comlang/index.html +0 -49
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/css/css.js +0 -124
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/css/index.html +0 -56
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/diff/diff.css +0 -3
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/diff/diff.js +0 -13
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/diff/index.html +0 -99
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/gfm/gfm.js +0 -108
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/gfm/index.html +0 -48
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/groovy/groovy.js +0 -210
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/groovy/index.html +0 -72
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/haskell/haskell.js +0 -242
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/haskell/index.html +0 -60
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/htmlmixed/htmlmixed.js +0 -83
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/htmlmixed/index.html +0 -52
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/javascript/index.html +0 -78
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/javascript/javascript.js +0 -358
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/jinja2/index.html +0 -38
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/jinja2/jinja2.js +0 -42
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/lua/index.html +0 -72
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/lua/lua.js +0 -140
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/markdown/index.html +0 -340
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/markdown/markdown.css +0 -10
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/markdown/markdown.js +0 -242
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ntriples/index.html +0 -33
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ntriples/ntriples.js +0 -172
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/pascal/LICENSE +0 -7
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/pascal/index.html +0 -49
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/pascal/pascal.js +0 -138
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/perl/LICENSE +0 -19
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/perl/index.html +0 -63
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/perl/perl.js +0 -816
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/php/index.html +0 -49
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/php/php.js +0 -120
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/plsql/index.html +0 -63
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/plsql/plsql.js +0 -217
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/python/LICENSE.txt +0 -21
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/python/index.html +0 -123
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/python/python.js +0 -320
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/r/LICENSE +0 -24
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/r/index.html +0 -74
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/r/r.js +0 -141
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/changes/changes.js +0 -19
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/changes/index.html +0 -54
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/spec/index.html +0 -100
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/spec/spec.css +0 -5
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/spec/spec.js +0 -66
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rst/index.html +0 -526
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rst/rst.css +0 -75
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rst/rst.js +0 -333
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ruby/LICENSE +0 -24
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ruby/index.html +0 -172
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ruby/ruby.js +0 -195
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rust/index.html +0 -49
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rust/rust.js +0 -411
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/scheme/index.html +0 -65
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/scheme/scheme.js +0 -202
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/smalltalk/index.html +0 -56
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/smalltalk/smalltalk.js +0 -132
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/sparql/index.html +0 -41
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/sparql/sparql.js +0 -143
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/stex/index.html +0 -96
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/stex/stex.js +0 -167
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/tiddlywiki/index.html +0 -183
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/tiddlywiki/tiddlywiki.css +0 -21
- skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/tiddlywiki/tiddlywiki.js +0 -259
app/code/community/Comfirm/AlphaMail/Block/Adminhtml/Notifications.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_Adminhtml_Notifications extends Mage_Core_Block_Text
|
4 |
+
{
|
5 |
+
protected function _toHtml()
|
6 |
+
{
|
7 |
+
$html = "";
|
8 |
+
|
9 |
+
$admin_helper = Mage::helper("adminhtml");
|
10 |
+
$helper = Mage::helper('alphamail');
|
11 |
+
|
12 |
+
if(strlen($helper->getAuthenticationToken()) == 0) {
|
13 |
+
$html = "<div class='notification-global'>";
|
14 |
+
$html .= "The AlphaMail module requires a AlphaMail account. ";
|
15 |
+
$html .= "<a href='" . $admin_helper->getUrl("alphamail/Connect/Register") . "'>Create a new account</a> or <a href='" . $admin_helper->getUrl("alphamail/Connect/Login") . "'>sign in</a>. ";
|
16 |
+
$html .= "For questions or help, visit <a href='http://amail.io/'>http://amail.io/</a> or contact our support at <a href='mailto:info@amail.io'>info@amail.io</a>.";
|
17 |
+
$html .= "</div>";
|
18 |
+
}
|
19 |
+
else if(!$helper->isActivated())
|
20 |
+
{
|
21 |
+
$html = "<div class='notification-global'>";
|
22 |
+
$html .= "The AlphaMail module is not activated. Please go to <a href='" . $admin_helper->getUrl('adminhtml/system_config/edit/section/alphamail') . "'>configuration</a> and activate it.";
|
23 |
+
$html .= "</div>";
|
24 |
+
}
|
25 |
+
else if(($message = Mage::helper('alphamail/diagnostic')->getDiagnosticError()) != null)
|
26 |
+
{
|
27 |
+
$html = "<div class='notification-global'>";
|
28 |
+
$html .= "AlphaMail: " . $message . " ";
|
29 |
+
$html .= "<a href='" . $admin_helper->getUrl('adminhtml/system_config/edit/section/alphamail') . "'>Check the configuration</a>";
|
30 |
+
$html .= "</div>";
|
31 |
+
}
|
32 |
+
|
33 |
+
return $html;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
?>
|
app/code/community/Comfirm/AlphaMail/Block/Adminhtml/System/Config/Wrapper.php
CHANGED
@@ -20,61 +20,7 @@
|
|
20 |
$token_checksum = hash("sha256", $helper->getAuthenticationToken());
|
21 |
if($helper->getConfigKey("authentication/last_validated_token_checksum") != $token_checksum){
|
22 |
$helper->setConfigKey('authentication/last_validated_token_checksum', $token_checksum);
|
23 |
-
|
24 |
-
$created_projects = array();
|
25 |
-
$created_templates = array();
|
26 |
-
|
27 |
-
$server_url = $helper->getPrimaryServerUrl();
|
28 |
-
$token = $helper->getAuthenticationToken();
|
29 |
-
|
30 |
-
$project_service = AlphaMailProjectService::create()
|
31 |
-
->setServiceUrl($server_url)
|
32 |
-
->setApiToken($token);
|
33 |
-
|
34 |
-
$template_service = AlphaMailTemplateService::create()
|
35 |
-
->setServiceUrl($server_url)
|
36 |
-
->setApiToken($token);
|
37 |
-
|
38 |
-
foreach($template_service->getAll() as $template){
|
39 |
-
$created_templates[$template->name] = $template->id;
|
40 |
-
}
|
41 |
-
|
42 |
-
foreach($project_service->getAll() as $project){
|
43 |
-
$created_projects[$project->name] = $project->id;
|
44 |
-
}
|
45 |
-
|
46 |
-
foreach ($paths as $path) {
|
47 |
-
if ($path === '.' || $path === '..') continue;
|
48 |
-
|
49 |
-
$resource_path = $setup_path . '/' . $path;
|
50 |
-
if (is_dir($resource_path)) {
|
51 |
-
if(file_exists($resource_path . '/data.json')){
|
52 |
-
$data = json_decode(file_get_contents($resource_path . '/data.json'));
|
53 |
-
|
54 |
-
$template_html_version = @file_get_contents($resource_path . '/template.htm');
|
55 |
-
$template_txt_version = @file_get_contents($resource_path . '/template.txt');
|
56 |
-
|
57 |
-
if(!array_key_exists($data->name, $created_templates)){
|
58 |
-
$created_templates[$data->name] = $template_service->add(
|
59 |
-
new DetailedTemplate(
|
60 |
-
null, $data->name,
|
61 |
-
new TemplateContent(
|
62 |
-
$template_html_version,
|
63 |
-
$template_txt_version
|
64 |
-
)
|
65 |
-
)
|
66 |
-
);
|
67 |
-
}
|
68 |
-
|
69 |
-
if(!array_key_exists($data->name, $created_projects)){
|
70 |
-
$project_service->add(new DetailedProject(
|
71 |
-
null, $data->name, $data->subject, 0,
|
72 |
-
$created_templates[$data->name])
|
73 |
-
);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
}
|
79 |
}else{
|
80 |
$session->addError("Error: " . $diagnostic_error);
|
20 |
$token_checksum = hash("sha256", $helper->getAuthenticationToken());
|
21 |
if($helper->getConfigKey("authentication/last_validated_token_checksum") != $token_checksum){
|
22 |
$helper->setConfigKey('authentication/last_validated_token_checksum', $token_checksum);
|
23 |
+
Mage::helper('alphamail/connection')->connect($helper->getAuthenticationToken());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
}else{
|
26 |
$session->addError("Error: " . $diagnostic_error);
|
app/code/community/Comfirm/AlphaMail/Block/Connect.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_Connect extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
protected function _prepareLayout()
|
6 |
+
{
|
7 |
+
$this->getLayout()->getBlock('head')->addJs('varien/form.js');
|
8 |
+
return parent::_prepareLayout();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
?>
|
app/code/community/Comfirm/AlphaMail/Block/EventLog.php
CHANGED
@@ -1,17 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_Block_EventLog
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
}
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_EventLog extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
4 |
+
public function __construct() {
|
5 |
+
parent::__construct();
|
6 |
+
$send_id = $this->getRequest()->getParam('send_id', false);
|
7 |
+
|
8 |
+
$this->_blockGroup = 'alphamail';
|
9 |
+
$this->_controller = 'eventLog';
|
10 |
+
|
11 |
+
if($send_id == null){
|
12 |
+
$this->_headerText = Mage::helper('cms')->__('Event Log');
|
13 |
+
}else{
|
14 |
+
$this->_headerText = Mage::helper('cms')->__('Event Log (filtering by send id ' . $send_id . ')');
|
15 |
+
}
|
16 |
+
|
17 |
+
// Remove the add button
|
18 |
+
$this->_removeButton('add');
|
19 |
+
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
?>
|
app/code/community/Comfirm/AlphaMail/Block/EventLog/Grid.php
CHANGED
@@ -1,70 +1,88 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_Block_EventLog_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
$this->
|
10 |
-
$this->
|
11 |
-
$this->
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
{
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
))
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
)
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
'
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_EventLog_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('eventLogGrid');
|
9 |
+
$this->setDefaultSort('event_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSendId($this->getRequest()->getParam('send_id', false));
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getSearchButtonHtml()
|
15 |
+
{
|
16 |
+
return parent::getSearchButtonHtml() . $this->getChildHtml('remove_all_button');
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareLayout()
|
20 |
+
{
|
21 |
+
$this->setChild('remove_all_button',
|
22 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
23 |
+
'label' => Mage::helper('alphamail')->__('Remove All'),
|
24 |
+
'onclick' => 'setLocation(\''.$this->getUrl('alphamail/EventLog/RemoveAll', array('_current'=>true)).'\')',
|
25 |
+
'class' => ''
|
26 |
+
))
|
27 |
+
);
|
28 |
+
|
29 |
+
return parent::_prepareLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _prepareCollection()
|
33 |
+
{
|
34 |
+
$collection = Mage::getModel('alphamail/event_log')->getCollection();
|
35 |
+
|
36 |
+
if($this->getSendId()){
|
37 |
+
$collection->addFieldToFilter("send_id", array("eq", $this->getSendId()));
|
38 |
+
}
|
39 |
+
|
40 |
+
$this->setCollection($collection);
|
41 |
+
return parent::_prepareCollection();
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _prepareColumns()
|
45 |
+
{
|
46 |
+
$baseUrl = $this->getUrl();
|
47 |
+
|
48 |
+
$this->addColumn('event_id', array(
|
49 |
+
'header' => Mage::helper('adminhtml')->__('Id'),
|
50 |
+
'width' => '30px',
|
51 |
+
'index' => 'event_id',
|
52 |
+
));
|
53 |
+
$this->addColumn('send_id', array(
|
54 |
+
'header' => Mage::helper('adminhtml')->__('Send Log Id'),
|
55 |
+
'width' => '60px',
|
56 |
+
'index' => 'send_id',
|
57 |
+
'default' => '(not set)'
|
58 |
+
));
|
59 |
+
$this->addColumn('message', array(
|
60 |
+
'header' => Mage::helper('adminhtml')->__('Message'),
|
61 |
+
'width' => '160px',
|
62 |
+
'index' => 'message',
|
63 |
+
));
|
64 |
+
$this->addColumn('type', array(
|
65 |
+
'header' => Mage::helper('adminhtml')->__('Type'),
|
66 |
+
'width' => '160px',
|
67 |
+
'index' => 'type',
|
68 |
+
'type' => 'options',
|
69 |
+
'options' => array(
|
70 |
+
0 => 'Info',
|
71 |
+
1 => 'Error',
|
72 |
+
2 => 'Debug'
|
73 |
+
)
|
74 |
+
));
|
75 |
+
$this->addColumn('created_at', array(
|
76 |
+
'header' => Mage::helper('adminhtml')->__('Created'),
|
77 |
+
'width' => '160px',
|
78 |
+
'index' => 'created_at',
|
79 |
+
));
|
80 |
+
|
81 |
+
return parent::_prepareColumns();
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getRowUrl($row)
|
85 |
+
{
|
86 |
+
return $this->getUrl('*/*/view', array('event_id' => $row->getId()));
|
87 |
+
}
|
88 |
+
}
|
app/code/community/Comfirm/AlphaMail/Block/EventLog/View.php
CHANGED
@@ -1,52 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_Block_EventLog_View extends Mage_Catalog_Block_Product_Abstract {
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
// The idea being that during development we can include
|
28 |
-
// templates from the actual extension code, rather than rely on them
|
29 |
-
// coming from ... not entriely convinced it's a good thing...
|
30 |
-
|
31 |
-
public function fetchView($fileName) {
|
32 |
-
|
33 |
-
// This is so we do not need to keep templates
|
34 |
-
// outside of the extension code.
|
35 |
-
$class_parts = explode("_", __CLASS__);
|
36 |
-
$dev_template_path = Mage::getModuleDir('', $class_parts[0]."_".$class_parts[1]).DS."templates";
|
37 |
-
|
38 |
-
if(Mage::getIsDeveloperMode() &&
|
39 |
-
file_exists($dev_template_path.DS.$fileName)) {
|
40 |
-
|
41 |
-
Mage::log("NOTE: Loading template from development path - not the design directory");
|
42 |
-
$this->setScriptPath($dev_template_path);
|
43 |
-
} else {
|
44 |
-
$this->setScriptPath(Mage::getBaseDir('design'));
|
45 |
-
}
|
46 |
-
|
47 |
-
return parent::fetchView($fileName);
|
48 |
-
}
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_EventLog_View extends Mage_Catalog_Block_Product_Abstract {
|
4 |
+
private $_send_id = null;
|
5 |
+
|
6 |
+
public function __construct() {
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('alphamail/logging/event_view.phtml');
|
9 |
+
$this->setEventId($this->getRequest()->getParam('event_id', false));
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getLogData() {
|
13 |
+
if($this->getEventId()) {
|
14 |
+
return Mage::getModel('alphamail/event_log')
|
15 |
+
->load($this->getEventId());
|
16 |
+
} else {
|
17 |
+
throw new Exception("No Event Id given");
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getBackUrl() {
|
22 |
+
return Mage::helper('adminhtml')->getUrl('*/EventLog');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
?>
|
app/code/community/Comfirm/AlphaMail/Block/ProjectMapping/Grid.php
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_Block_ProjectMapping_Grid extends Mage_Adminhtml_Block_System_Config_Edit
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->setId('eventLogGrid');
|
10 |
-
$this->setDefaultSort('event_id');
|
11 |
-
$this->setDefaultDir('ASC');
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _prepareCollection()
|
15 |
-
{
|
16 |
-
return array();
|
17 |
-
//$collection = Mage::getModel('alphamail/project_map')->getCollection();
|
18 |
-
//$this->setCollection($collection);
|
19 |
-
//return parent::_prepareCollection();
|
20 |
-
}
|
21 |
-
/*
|
22 |
-
protected function _prepareColumns()
|
23 |
-
{
|
24 |
-
$baseUrl = $this->getUrl();
|
25 |
-
|
26 |
-
$this->addColumn('event_id', array(
|
27 |
-
'header' => Mage::helper('adminhtml')->__('Id'),
|
28 |
-
'width' => '100px',
|
29 |
-
'align' => 'left',
|
30 |
-
'index' => 'event_id',
|
31 |
-
));
|
32 |
-
$this->addColumn('send_id', array(
|
33 |
-
'header' => Mage::helper('adminhtml')->__('Send Id'),
|
34 |
-
'width' => '100px',
|
35 |
-
'align' => 'left',
|
36 |
-
'index' => 'send_id',
|
37 |
-
));
|
38 |
-
$this->addColumn('message', array(
|
39 |
-
'header' => Mage::helper('adminhtml')->__('Message'),
|
40 |
-
'index' => 'message',
|
41 |
-
));
|
42 |
-
$this->addColumn('type', array(
|
43 |
-
'header' => Mage::helper('adminhtml')->__('Type'),
|
44 |
-
'width' => '100px',
|
45 |
-
'maxwidth' => '40px',
|
46 |
-
'align' => 'left',
|
47 |
-
'index' => 'type',
|
48 |
-
'type' => 'options',
|
49 |
-
'options' => array(
|
50 |
-
0 => 'Information',
|
51 |
-
1 => 'Error',
|
52 |
-
2 => 'Debug'
|
53 |
-
)
|
54 |
-
));
|
55 |
-
$this->addColumn('created_at', array(
|
56 |
-
'header' => Mage::helper('adminhtml')->__('Created'),
|
57 |
-
'width' => '140px',
|
58 |
-
'align' => 'center',
|
59 |
-
'index' => 'created_at',
|
60 |
-
));
|
61 |
-
|
62 |
-
return parent::_prepareColumns();
|
63 |
-
}
|
64 |
-
*/
|
65 |
-
//public function getRowUrl($row)
|
66 |
-
//{
|
67 |
-
// return $this->getUrl('*/*/view', array('event_id' => $row->getId()));
|
68 |
-
//}
|
69 |
-
}
|
70 |
-
|
71 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/Block/ProjectMapping/View.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_Block_ProjectMapping_View extends Mage_Catalog_Block_Product_Abstract {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
parent::__construct();
|
7 |
-
$this->setTemplate('alphamail/view.phtml');
|
8 |
-
$this->setEmailId($this->getRequest()->getParam('event_id', false));
|
9 |
-
}
|
10 |
-
|
11 |
-
public function getEmailData() {
|
12 |
-
if( $this->getEmailId()) {
|
13 |
-
return Mage::getModel('alphamail/event_log')
|
14 |
-
->load($this->getEmailId());
|
15 |
-
} else {
|
16 |
-
throw new Exception("No Event Id given");
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getBackUrl() {
|
21 |
-
return Mage::helper('adminhtml')->getUrl('*/eventlog');
|
22 |
-
}
|
23 |
-
|
24 |
-
// This is an experiment in progress - if you're
|
25 |
-
// reading this code, maybe you'd be interested...
|
26 |
-
|
27 |
-
// The idea being that during development we can include
|
28 |
-
// templates from the actual extension code, rather than rely on them
|
29 |
-
// coming from ... not entriely convinced it's a good thing...
|
30 |
-
|
31 |
-
public function fetchView($fileName) {
|
32 |
-
|
33 |
-
// This is so we do not need to keep templates
|
34 |
-
// outside of the extension code.
|
35 |
-
$class_parts = explode("_", __CLASS__);
|
36 |
-
$dev_template_path = Mage::getModuleDir('', $class_parts[0]."_".$class_parts[1]).DS."templates";
|
37 |
-
|
38 |
-
if(Mage::getIsDeveloperMode() &&
|
39 |
-
file_exists($dev_template_path.DS.$fileName)) {
|
40 |
-
|
41 |
-
Mage::log("NOTE: Loading template from development path - not the design directory");
|
42 |
-
$this->setScriptPath($dev_template_path);
|
43 |
-
} else {
|
44 |
-
$this->setScriptPath(Mage::getBaseDir('design'));
|
45 |
-
}
|
46 |
-
|
47 |
-
return parent::fetchView($fileName);
|
48 |
-
}
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/Block/SendLog.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Ashley Schroder (aschroder.com)
|
4 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
5 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Comfirm_AlphaMail_Block_SendLog extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Block constructor
|
12 |
+
*/
|
13 |
+
public function __construct() {
|
14 |
+
$this->_blockGroup = 'alphamail';
|
15 |
+
$this->_controller = 'sendLog';
|
16 |
+
$this->_headerText = Mage::helper('cms')->__('Send Log');
|
17 |
+
parent::__construct();
|
18 |
+
|
19 |
+
// Remove the add button
|
20 |
+
$this->_removeButton('add');
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/community/Comfirm/AlphaMail/Block/SendLog/Grid.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_SendLog_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('sendLogGrid');
|
9 |
+
$this->setDefaultSort('send_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getSearchButtonHtml()
|
14 |
+
{
|
15 |
+
return parent::getSearchButtonHtml() . $this->getChildHtml('remove_all_button');
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _prepareLayout()
|
19 |
+
{
|
20 |
+
$this->setChild('remove_all_button',
|
21 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
22 |
+
'label' => Mage::helper('alphamail')->__('Remove All'),
|
23 |
+
'onclick' => 'setLocation(\''.$this->getUrl('alphamail/SendLog/RemoveAll', array('_current'=>true)).'\')',
|
24 |
+
'class' => ''
|
25 |
+
))
|
26 |
+
);
|
27 |
+
|
28 |
+
return parent::_prepareLayout();
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareCollection()
|
32 |
+
{
|
33 |
+
$collection = Mage::getModel('alphamail/send_log')->getCollection();
|
34 |
+
$this->setCollection($collection);
|
35 |
+
return parent::_prepareCollection();
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _prepareColumns()
|
39 |
+
{
|
40 |
+
$baseUrl = $this->getUrl();
|
41 |
+
|
42 |
+
$this->addColumn('send_id', array(
|
43 |
+
'header' => Mage::helper('adminhtml')->__('Id'),
|
44 |
+
'width' => '30px',
|
45 |
+
'index' => 'send_id',
|
46 |
+
));
|
47 |
+
$this->addColumn('status', array(
|
48 |
+
'header' => Mage::helper('adminhtml')->__('Status'),
|
49 |
+
'width' => '20px',
|
50 |
+
'index' => 'status',
|
51 |
+
'type' => 'options',
|
52 |
+
'options' => array(
|
53 |
+
0 => 'Queued Internally',
|
54 |
+
1 => 'Authentication Error',
|
55 |
+
2 => 'Connection Error',
|
56 |
+
3 => 'Sent'
|
57 |
+
)
|
58 |
+
));
|
59 |
+
$this->addColumn('template_name', array(
|
60 |
+
'header' => Mage::helper('adminhtml')->__('Template Name'),
|
61 |
+
'width' => '30px',
|
62 |
+
'index' => 'template_name',
|
63 |
+
));
|
64 |
+
$this->addColumn('am_queue_id', array(
|
65 |
+
'header' => Mage::helper('adminhtml')->__('AlphaMail Queue Id'),
|
66 |
+
'width' => '250px',
|
67 |
+
'index' => 'am_queue_id',
|
68 |
+
'default' => '(not send yet)'
|
69 |
+
));
|
70 |
+
$this->addColumn('sent_at', array(
|
71 |
+
'header' => Mage::helper('adminhtml')->__('Sent'),
|
72 |
+
'width' => '30px',
|
73 |
+
'index' => 'sent_at',
|
74 |
+
'default' => '(not sent yet)'
|
75 |
+
));
|
76 |
+
$this->addColumn('created_at', array(
|
77 |
+
'header' => Mage::helper('adminhtml')->__('Created'),
|
78 |
+
'width' => '30px',
|
79 |
+
'index' => 'created_at',
|
80 |
+
));
|
81 |
+
|
82 |
+
return parent::_prepareColumns();
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getRowUrl($row)
|
86 |
+
{
|
87 |
+
return $this->getUrl('*/EventLog', array('send_id' => $row->getId()));
|
88 |
+
}
|
89 |
+
}
|
app/code/community/Comfirm/AlphaMail/Block/SendLog/View.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_Block_SendLog_View extends Mage_Catalog_Block_Product_Abstract {
|
4 |
+
private $_send_id = null;
|
5 |
+
|
6 |
+
public function __construct() {
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('alphamail/logging/send_view.phtml');
|
9 |
+
$this->setSendId($this->getRequest()->getParam('send_id', false));
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getLogData() {
|
13 |
+
if($this->getSendId()) {
|
14 |
+
return Mage::getModel('alphamail/send_log')
|
15 |
+
->load($this->getSendId());
|
16 |
+
} else {
|
17 |
+
throw new Exception("No Send Id given");
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getBackUrl() {
|
22 |
+
return Mage::helper('adminhtml')->getUrl('*/sendlog');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
?>
|
app/code/community/Comfirm/AlphaMail/Block/{Project.php → SingleSignOn.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
extends Mage_Adminhtml_Block_Template {
|
5 |
}
|
6 |
|
1 |
<?php
|
2 |
|
3 |
+
class Comfirm_AlphaMail_Block_SingleSignOn
|
4 |
extends Mage_Adminhtml_Block_Template {
|
5 |
}
|
6 |
|
app/code/community/Comfirm/AlphaMail/Block/Template.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_Block_Template
|
4 |
-
extends Mage_Adminhtml_Block_Template {
|
5 |
-
}
|
6 |
-
|
7 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/Helper/Connection.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/accountservice.class.php");
|
4 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/integrationservice.class.php");
|
5 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/tokenservice.class.php");
|
6 |
+
|
7 |
+
class Comfirm_AlphaMail_Helper_Connection extends Mage_Core_Helper_Abstract {
|
8 |
+
public function connect($token_value, $installation_id = "Magento"){
|
9 |
+
$token_id = null;
|
10 |
+
$token_exists = false;
|
11 |
+
$integration_id = null;
|
12 |
+
$integration_exists = false;
|
13 |
+
|
14 |
+
$token_service = AlphaMailTokenService::create();
|
15 |
+
$token_service->setServiceUrl("http://api.amail.io/v2");
|
16 |
+
$token_service->setApiToken($token_value);
|
17 |
+
|
18 |
+
// Scan for the Magento token
|
19 |
+
foreach($token_service->getAll() as $token){
|
20 |
+
if($token->name == $installation_id){
|
21 |
+
$token_exists = true;
|
22 |
+
$token_id = $token->id;
|
23 |
+
$token_value = $token_service->getSingle($token->id)->token;
|
24 |
+
break;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
// Create the token if it doesn't exist
|
29 |
+
if(!$token_exists){
|
30 |
+
$magento_token = $token_service->createNew($installation_id, true);
|
31 |
+
$token_id = $token->id;
|
32 |
+
$token_value = $magento_token->token;
|
33 |
+
}
|
34 |
+
|
35 |
+
$integration_service = AlphaMailIntegrationService::create();
|
36 |
+
$integration_service->setServiceUrl("http://api.amail.io/v2");
|
37 |
+
$integration_service->setApiToken($token_value);
|
38 |
+
|
39 |
+
// Scan for the Magento integration
|
40 |
+
foreach($integration_service->getAll() as $integration){
|
41 |
+
if($integration->name == $installation_id){
|
42 |
+
$integration_exists = true;
|
43 |
+
$integration_id = $integration->id;
|
44 |
+
break;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
// Create the integration if it doesn't exist
|
49 |
+
if(!$integration_exists){
|
50 |
+
$integration = $integration_service->createNew($installation_id, array(
|
51 |
+
"url" => Mage::getBaseUrl(),
|
52 |
+
"version" => Mage::getVersion(),
|
53 |
+
"os" => php_uname()
|
54 |
+
));
|
55 |
+
|
56 |
+
$integration_id = $integration->id;
|
57 |
+
}
|
58 |
+
|
59 |
+
$integration_service->connectToken($integration_id, $token_id);
|
60 |
+
Mage::helper('alphamail')->setAuthenticationToken($token_value);
|
61 |
+
|
62 |
+
// Clean tables for left over data
|
63 |
+
Mage::helper('alphamail')->truncateTableData();
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
?>
|
app/code/community/Comfirm/AlphaMail/Helper/Data.php
CHANGED
@@ -2,6 +2,17 @@
|
|
2 |
|
3 |
class Comfirm_AlphaMail_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
public function isActivated(){
|
6 |
return (bool)$this->getConfigKey('general/activated') &&
|
7 |
!Mage::getStoreConfigFlag('advanced/modules_disable_output/Comfirm_AlphaMail');
|
@@ -11,6 +22,10 @@ class Comfirm_AlphaMail_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
11 |
return $this->getConfigKey('authentication/token');
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
14 |
public function isLoggingEnabled() {
|
15 |
return (bool)$this->getConfigKey('debugging/logging_mode');
|
16 |
}
|
@@ -79,6 +94,20 @@ class Comfirm_AlphaMail_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
79 |
return $this;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
public function getConfigKey($path){
|
83 |
return Mage::getStoreConfig('alphamail/' . $path);
|
84 |
}
|
@@ -87,6 +116,10 @@ class Comfirm_AlphaMail_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
87 |
return Mage_Core_Model_Email_Template::getDefaultTemplates();
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
90 |
public function logEvent($send_id, $message, $type) {
|
91 |
if($this->isLoggingEnabled()){
|
92 |
if(strlen($message) >= 4096){
|
@@ -103,22 +136,57 @@ class Comfirm_AlphaMail_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
103 |
}
|
104 |
|
105 |
public function logInformation($message, $send_id = null) {
|
106 |
-
$this->logEvent($send_id, $message,
|
107 |
return $this;
|
108 |
}
|
109 |
|
110 |
public function logError($message, $send_id = null) {
|
111 |
-
$this->logEvent($send_id, $message,
|
112 |
return $this;
|
113 |
}
|
114 |
|
115 |
public function logDebug($message, $send_id = null) {
|
116 |
if($this->isDebuggingEnabled()){
|
117 |
-
$this->logEvent($send_id, $message,
|
118 |
}
|
119 |
return $this;
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
public function logSentMessage($am_queue_id) {
|
123 |
Mage::getModel('alphamail/send_log')
|
124 |
->setAmQueueId($am_queue_id)
|
2 |
|
3 |
class Comfirm_AlphaMail_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
|
5 |
+
// Event
|
6 |
+
const EVENT_INFO = 0;
|
7 |
+
const EVENT_ERROR = 1;
|
8 |
+
const EVENT_DEBUG = 2;
|
9 |
+
|
10 |
+
// Send
|
11 |
+
const SEND_QUEUED = 0;
|
12 |
+
const SEND_AUTHENTICATION_ERROR = 1;
|
13 |
+
const SEND_CONNECTION_ERROR = 2;
|
14 |
+
const SEND_SENT = 3;
|
15 |
+
|
16 |
public function isActivated(){
|
17 |
return (bool)$this->getConfigKey('general/activated') &&
|
18 |
!Mage::getStoreConfigFlag('advanced/modules_disable_output/Comfirm_AlphaMail');
|
22 |
return $this->getConfigKey('authentication/token');
|
23 |
}
|
24 |
|
25 |
+
public function setAuthenticationToken($token){
|
26 |
+
return $this->setConfigKey('authentication/token', $token);
|
27 |
+
}
|
28 |
+
|
29 |
public function isLoggingEnabled() {
|
30 |
return (bool)$this->getConfigKey('debugging/logging_mode');
|
31 |
}
|
94 |
return $this;
|
95 |
}
|
96 |
|
97 |
+
public function truncateTableData(){
|
98 |
+
// Remove project map
|
99 |
+
foreach(Mage::getModel('alphamail/project_map')->getCollection() as $log){
|
100 |
+
$log->delete();
|
101 |
+
}
|
102 |
+
// Remove logs
|
103 |
+
foreach(Mage::getModel('alphamail/event_log')->getCollection() as $log){
|
104 |
+
$log->delete();
|
105 |
+
}
|
106 |
+
foreach(Mage::getModel('alphamail/send_log')->getCollection() as $log){
|
107 |
+
$log->delete();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
public function getConfigKey($path){
|
112 |
return Mage::getStoreConfig('alphamail/' . $path);
|
113 |
}
|
116 |
return Mage_Core_Model_Email_Template::getDefaultTemplates();
|
117 |
}
|
118 |
|
119 |
+
// Logging
|
120 |
+
|
121 |
+
// Event logs
|
122 |
+
|
123 |
public function logEvent($send_id, $message, $type) {
|
124 |
if($this->isLoggingEnabled()){
|
125 |
if(strlen($message) >= 4096){
|
136 |
}
|
137 |
|
138 |
public function logInformation($message, $send_id = null) {
|
139 |
+
$this->logEvent($send_id, $message, self::EVENT_INFO);
|
140 |
return $this;
|
141 |
}
|
142 |
|
143 |
public function logError($message, $send_id = null) {
|
144 |
+
$this->logEvent($send_id, $message, self::EVENT_ERROR);
|
145 |
return $this;
|
146 |
}
|
147 |
|
148 |
public function logDebug($message, $send_id = null) {
|
149 |
if($this->isDebuggingEnabled()){
|
150 |
+
$this->logEvent($send_id, $message, self::EVENT_DEBUG);
|
151 |
}
|
152 |
return $this;
|
153 |
}
|
154 |
|
155 |
+
// Send logs
|
156 |
+
|
157 |
+
public function createSendLog($template_name){
|
158 |
+
return Mage::getModel('alphamail/send_log')
|
159 |
+
->setTemplateName($template_name)
|
160 |
+
->setCreatedAt(time())
|
161 |
+
->save();
|
162 |
+
}
|
163 |
+
|
164 |
+
public function flagSendLogAsSent($send_log, $am_queue_id){
|
165 |
+
return $send_log->setStatus(self::SEND_SENT)
|
166 |
+
->setAmQueueId($am_queue_id)
|
167 |
+
->setRawPayload(null)
|
168 |
+
->setSentAt(time())
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
|
172 |
+
public function flagSendLogAsQueued($send_log, $payload){
|
173 |
+
return $send_log->setStatus(self::SEND_QUEUED)
|
174 |
+
->setRawPayload($payload)
|
175 |
+
->save();
|
176 |
+
}
|
177 |
+
|
178 |
+
public function flagSendLogAsConnectionError($send_log, $payload){
|
179 |
+
return $send_log->setStatus(self::SEND_CONNECTION_ERROR)
|
180 |
+
->setRawPayload($payload)
|
181 |
+
->save();
|
182 |
+
}
|
183 |
+
|
184 |
+
public function flagSendLogAsAuthenticationError($send_log, $payload){
|
185 |
+
return $send_log->setStatus(self::SEND_AUTHENTICATION_ERROR)
|
186 |
+
->setRawPayload($payload)
|
187 |
+
->save();
|
188 |
+
}
|
189 |
+
|
190 |
public function logSentMessage($am_queue_id) {
|
191 |
Mage::getModel('alphamail/send_log')
|
192 |
->setAmQueueId($am_queue_id)
|
app/code/community/Comfirm/AlphaMail/Helper/Diagnostic.php
CHANGED
@@ -78,6 +78,8 @@
|
|
78 |
->setApiToken($token)
|
79 |
->getAll();
|
80 |
|
|
|
|
|
81 |
$result = array(0, 'Authentication was successful, token is valid!');
|
82 |
}
|
83 |
catch(AlphaMailAuthorizationException $exception)
|
78 |
->setApiToken($token)
|
79 |
->getAll();
|
80 |
|
81 |
+
// Need to cache the authentication here
|
82 |
+
|
83 |
$result = array(0, 'Authentication was successful, token is valid!');
|
84 |
}
|
85 |
catch(AlphaMailAuthorizationException $exception)
|
app/code/community/Comfirm/AlphaMail/Helper/Message.php
CHANGED
@@ -43,8 +43,8 @@
|
|
43 |
|
44 |
$result->group = $this->getCustomerGroupData($customer);
|
45 |
|
46 |
-
if($customer->getPrimaryAddress() != null){
|
47 |
-
$result->address = $this->getAddressData($customer->getPrimaryAddress());
|
48 |
}
|
49 |
}
|
50 |
|
43 |
|
44 |
$result->group = $this->getCustomerGroupData($customer);
|
45 |
|
46 |
+
if($customer->getPrimaryAddress(null) != null){
|
47 |
+
$result->address = $this->getAddressData($customer->getPrimaryAddress(null));
|
48 |
}
|
49 |
}
|
50 |
|
app/code/community/Comfirm/AlphaMail/Model/Email/Template.php
CHANGED
@@ -3,11 +3,15 @@
|
|
3 |
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/emailservice.class.php");
|
4 |
|
5 |
class Comfirm_AlphaMail_Model_Email_Template extends Mage_Core_Model_Email_Template {
|
6 |
-
|
7 |
public function send($email, $name=null, array $variables = array()) {
|
|
|
8 |
$helper = Mage::helper('alphamail');
|
|
|
9 |
|
10 |
-
try
|
|
|
|
|
11 |
if(!$helper->isActivated()){
|
12 |
return parent::send($email, $name, $variables);
|
13 |
}
|
@@ -17,58 +21,25 @@
|
|
17 |
$subject = $this->getTemplateSubject();
|
18 |
$token = $helper->getAuthenticationToken();
|
19 |
$server_url = $helper->getPrimaryServerUrl();
|
20 |
-
|
21 |
-
// If payload name is set, replace original name with this.
|
22 |
-
if($name == null || strlen($payload->name) == 0){
|
23 |
-
if($payload->name != null){
|
24 |
-
$name = $payload->name;
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
$project_map_model = Mage::getModel('alphamail/project_map');
|
29 |
$project_map = $project_map_model->getByTemplateName($template_name);
|
30 |
|
31 |
if($project_map != null){
|
32 |
-
$send_id = null;
|
33 |
$project_id = (int)$project_map['am_project_id'];
|
|
|
|
|
|
|
|
|
34 |
if($project_id > 0){
|
35 |
-
$message =
|
36 |
-
|
37 |
-
switch($template_name){
|
38 |
-
case 'customer_create_account_email_template':
|
39 |
-
case 'customer_create_account_email_confirmed_template':
|
40 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Welcome();
|
41 |
-
break;
|
42 |
-
case 'customer_create_account_email_confirmation_template':
|
43 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Email_Confirmation();
|
44 |
-
break;
|
45 |
-
case 'customer_password_forgot_email_template':
|
46 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Password_Renewal();
|
47 |
-
break;
|
48 |
-
case 'sales_email_order_template':
|
49 |
-
case 'sales_email_order_guest_template':
|
50 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Sales_Order();
|
51 |
-
break;
|
52 |
-
case 'sales_email_order_comment_template':
|
53 |
-
case 'sales_email_order_comment_guest_template':
|
54 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Sales_Order_Update();
|
55 |
-
break;
|
56 |
-
case 'sales_email_invoice_template':
|
57 |
-
case 'sales_email_invoice_guest_template':
|
58 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Sales_Order_Invoice();
|
59 |
-
break;
|
60 |
-
case 'sales_email_invoice_comment_template':
|
61 |
-
case 'sales_email_invoice_comment_guest_template':
|
62 |
-
$message = new Comfirm_AlphaMail_Message_Customer_Sales_Order_Invoice_Update();
|
63 |
-
break;
|
64 |
-
}
|
65 |
|
66 |
if($message != null){
|
67 |
$body_object = $message->load($variables);
|
68 |
|
69 |
$name = is_array($name) ? $name[0] : $name;
|
70 |
$email = is_array($email) ? $email[0] : $email;
|
71 |
-
|
72 |
// Build payload
|
73 |
$payload = EmailMessagePayload::create()
|
74 |
->setProjectId($project_id)
|
@@ -81,10 +52,10 @@
|
|
81 |
$payload->setReceiverId($body_object->customer->customer_id);
|
82 |
}
|
83 |
|
84 |
-
$helper->
|
85 |
-
$helper->logDebug('Payload
|
86 |
|
87 |
-
for($retry
|
88 |
try
|
89 |
{
|
90 |
$email_service = AlphaMailEmailService::create()
|
@@ -92,69 +63,72 @@
|
|
92 |
->setApiToken($token);
|
93 |
|
94 |
$response = $email_service->queue($payload);
|
95 |
-
|
96 |
-
$helper->logDebug('Response = ' . json_encode($response));
|
97 |
|
98 |
if($response->error_code == 0){
|
99 |
-
$
|
100 |
-
$helper->
|
101 |
-
$is_handled = true;
|
102 |
-
|
103 |
-
// Successful! Let's end here :)
|
104 |
break;
|
105 |
}
|
106 |
}
|
|
|
107 |
catch (AlphaMailValidationException $exception)
|
108 |
{
|
109 |
-
|
110 |
-
$helper->logDebug('Validation error = ' . $exception->getMessage());
|
111 |
-
$is_handled = true;
|
112 |
break;
|
113 |
}
|
|
|
114 |
catch (AlphaMailAuthorizationException $exception)
|
115 |
{
|
116 |
-
|
117 |
-
$
|
118 |
-
|
|
|
119 |
break;
|
120 |
}
|
|
|
121 |
catch (AlphaMailInternalException $exception)
|
122 |
{
|
123 |
-
|
124 |
-
$helper->logDebug('Internal error = ' . $exception->getMessage());
|
125 |
}
|
|
|
126 |
catch (AlphaMailServiceException $exception)
|
127 |
{
|
128 |
-
|
129 |
-
$
|
|
|
|
|
130 |
}
|
|
|
131 |
catch(Exeption $exception)
|
132 |
{
|
133 |
-
|
134 |
-
$helper->logDebug('Other error = ' . $exception->getMessage());
|
135 |
}
|
136 |
}
|
137 |
}
|
138 |
}
|
139 |
-
}
|
|
|
|
|
|
|
140 |
$helper->logDebug("Mail sent with template '" . $template_name . "' was unhandled (not mapped).");
|
141 |
}
|
142 |
-
}
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
}
|
148 |
|
149 |
try
|
150 |
{
|
151 |
-
if(
|
152 |
switch(Mage::helper('alphamail')->getFallbackMode()){
|
153 |
case 'defer':
|
154 |
-
// Save in message log
|
155 |
break;
|
156 |
case 'discard':
|
157 |
-
// Just throw away
|
158 |
break;
|
159 |
case 'exception':
|
160 |
// Throw an exception...
|
@@ -172,6 +146,41 @@
|
|
172 |
|
173 |
return true;
|
174 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
}
|
176 |
|
177 |
?>
|
3 |
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/emailservice.class.php");
|
4 |
|
5 |
class Comfirm_AlphaMail_Model_Email_Template extends Mage_Core_Model_Email_Template {
|
6 |
+
|
7 |
public function send($email, $name=null, array $variables = array()) {
|
8 |
+
$send_log_id = null;
|
9 |
$helper = Mage::helper('alphamail');
|
10 |
+
$is_unhandled = false;
|
11 |
|
12 |
+
try
|
13 |
+
{
|
14 |
+
// Plugin is not activated. Pass call to parent.
|
15 |
if(!$helper->isActivated()){
|
16 |
return parent::send($email, $name, $variables);
|
17 |
}
|
21 |
$subject = $this->getTemplateSubject();
|
22 |
$token = $helper->getAuthenticationToken();
|
23 |
$server_url = $helper->getPrimaryServerUrl();
|
24 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
$project_map_model = Mage::getModel('alphamail/project_map');
|
26 |
$project_map = $project_map_model->getByTemplateName($template_name);
|
27 |
|
28 |
if($project_map != null){
|
|
|
29 |
$project_id = (int)$project_map['am_project_id'];
|
30 |
+
|
31 |
+
$send_log = $helper->createSendLog($template_name);
|
32 |
+
$send_log_id = $send_log->getId();
|
33 |
+
|
34 |
if($project_id > 0){
|
35 |
+
$message = $this->getMessageObject($template_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
if($message != null){
|
38 |
$body_object = $message->load($variables);
|
39 |
|
40 |
$name = is_array($name) ? $name[0] : $name;
|
41 |
$email = is_array($email) ? $email[0] : $email;
|
42 |
+
|
43 |
// Build payload
|
44 |
$payload = EmailMessagePayload::create()
|
45 |
->setProjectId($project_id)
|
52 |
$payload->setReceiverId($body_object->customer->customer_id);
|
53 |
}
|
54 |
|
55 |
+
$max_retries = max($helper->getFailureRetryCount(), 1);
|
56 |
+
$helper->logDebug('Payload = ' . json_encode($payload), $send_log_id);
|
57 |
|
58 |
+
for($retry=$max_retries;$retry>0;--$retry){
|
59 |
try
|
60 |
{
|
61 |
$email_service = AlphaMailEmailService::create()
|
63 |
->setApiToken($token);
|
64 |
|
65 |
$response = $email_service->queue($payload);
|
66 |
+
$helper->logDebug('Response = ' . json_encode($response), $send_log_id);
|
|
|
67 |
|
68 |
if($response->error_code == 0){
|
69 |
+
$is_unhandled = false;
|
70 |
+
$helper->flagSendLogAsSent($send_log, $response->result);
|
|
|
|
|
|
|
71 |
break;
|
72 |
}
|
73 |
}
|
74 |
+
// Don't retry validation errors
|
75 |
catch (AlphaMailValidationException $exception)
|
76 |
{
|
77 |
+
$helper->logDebug('Validation error = ' . $exception->getMessage(), $send_log_id);
|
|
|
|
|
78 |
break;
|
79 |
}
|
80 |
+
// Don't retry authorization errors
|
81 |
catch (AlphaMailAuthorizationException $exception)
|
82 |
{
|
83 |
+
$helper->logDebug('Authorization error = ' . $exception->getMessage(), $send_log_id);
|
84 |
+
if($retry == 1){
|
85 |
+
$helper->flagSendLogAsAuthenticationError($send_log, json_encode($payload));
|
86 |
+
}
|
87 |
break;
|
88 |
}
|
89 |
+
// Retry internal errors..
|
90 |
catch (AlphaMailInternalException $exception)
|
91 |
{
|
92 |
+
$helper->logDebug('Internal error = ' . $exception->getMessage() . ' (retry ' . ($max_retries-$retry) . ')', $send_log_id);
|
|
|
93 |
}
|
94 |
+
// Retry service exception..
|
95 |
catch (AlphaMailServiceException $exception)
|
96 |
{
|
97 |
+
$helper->logDebug('Service error = ' . $exception->getMessage() . ' (retry ' . ($max_retries-$retry) . ')', $send_log_id);
|
98 |
+
if($retry == 1){
|
99 |
+
$helper->flagSendLogAsConnectionError($send_log, json_encode($payload));
|
100 |
+
}
|
101 |
}
|
102 |
+
// Retry other errors..
|
103 |
catch(Exeption $exception)
|
104 |
{
|
105 |
+
$helper->logDebug('Other error = ' . $exception->getMessage() . ' (retry ' . ($max_retries-$retry) . ')', $send_log_id);
|
|
|
106 |
}
|
107 |
}
|
108 |
}
|
109 |
}
|
110 |
+
}
|
111 |
+
else
|
112 |
+
{
|
113 |
+
$is_unhandled = true;
|
114 |
$helper->logDebug("Mail sent with template '" . $template_name . "' was unhandled (not mapped).");
|
115 |
}
|
116 |
+
}
|
117 |
+
catch(Exception $exception)
|
118 |
+
{
|
119 |
+
$is_unhandled = true;
|
120 |
+
$helper->logError('Exception thrown when trying to queue mail: ' . $exception->__toString(), $send_log_id);
|
121 |
}
|
122 |
|
123 |
try
|
124 |
{
|
125 |
+
if($is_unhandled){
|
126 |
switch(Mage::helper('alphamail')->getFallbackMode()){
|
127 |
case 'defer':
|
128 |
+
// Save in message log...
|
129 |
break;
|
130 |
case 'discard':
|
131 |
+
// Just throw away...
|
132 |
break;
|
133 |
case 'exception':
|
134 |
// Throw an exception...
|
146 |
|
147 |
return true;
|
148 |
}
|
149 |
+
|
150 |
+
private function getMessageObject($template_name){
|
151 |
+
$result = null;
|
152 |
+
|
153 |
+
switch($template_name){
|
154 |
+
case 'customer_create_account_email_template':
|
155 |
+
case 'customer_create_account_email_confirmed_template':
|
156 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Welcome();
|
157 |
+
break;
|
158 |
+
case 'customer_create_account_email_confirmation_template':
|
159 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Email_Confirmation();
|
160 |
+
break;
|
161 |
+
case 'customer_password_forgot_email_template':
|
162 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Password_Renewal();
|
163 |
+
break;
|
164 |
+
case 'sales_email_order_template':
|
165 |
+
case 'sales_email_order_guest_template':
|
166 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Sales_Order();
|
167 |
+
break;
|
168 |
+
case 'sales_email_order_comment_template':
|
169 |
+
case 'sales_email_order_comment_guest_template':
|
170 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Sales_Order_Update();
|
171 |
+
break;
|
172 |
+
case 'sales_email_invoice_template':
|
173 |
+
case 'sales_email_invoice_guest_template':
|
174 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Sales_Order_Invoice();
|
175 |
+
break;
|
176 |
+
case 'sales_email_invoice_comment_template':
|
177 |
+
case 'sales_email_invoice_comment_guest_template':
|
178 |
+
$result = new Comfirm_AlphaMail_Message_Customer_Sales_Order_Invoice_Update();
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
|
182 |
+
return $result;
|
183 |
+
}
|
184 |
}
|
185 |
|
186 |
?>
|
app/code/community/Comfirm/AlphaMail/controllers/ConnectController.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/tokenservice.class.php");
|
4 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/accountservice.class.php");
|
5 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/captchaservice.class.php");
|
6 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/integrationservice.class.php");
|
7 |
+
|
8 |
+
class Comfirm_AlphaMail_ConnectController extends Comfirm_AlphaMail_Controller_Abstract {
|
9 |
+
private $_session;
|
10 |
+
private $_captcha_service;
|
11 |
+
|
12 |
+
public function __init(){
|
13 |
+
$this->_session = Mage::getSingleton('admin/session');
|
14 |
+
$this->_captcha_service = AlphaMailCaptchaService::create();
|
15 |
+
$this->_captcha_service->setServiceUrl("http://api.amail.io/v2");
|
16 |
+
}
|
17 |
+
|
18 |
+
public function completedAction(){
|
19 |
+
$this->__init();
|
20 |
+
$this->_initialAction('connect', 'completed', array());
|
21 |
+
$this->_session->setAlphaMailRegistrationErrors(null);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function loginAction(){
|
25 |
+
$this->__init();
|
26 |
+
|
27 |
+
$this->_initialAction('connect', 'login', array(
|
28 |
+
"username" => "",
|
29 |
+
"password" => "",
|
30 |
+
"errors" => (array)$this->_session->getAlphaMailLoginErrors()
|
31 |
+
));
|
32 |
+
|
33 |
+
$this->_session->setAlphaMailLoginErrors(null);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function tryLoginAction(){
|
37 |
+
$this->__init();
|
38 |
+
$errors = array();
|
39 |
+
$parameters = $this->getRequest()->getParams();
|
40 |
+
|
41 |
+
try
|
42 |
+
{
|
43 |
+
$username = $parameters["username"];
|
44 |
+
$password = $parameters["password"];
|
45 |
+
|
46 |
+
$account_service = AlphaMailAccountService::create();
|
47 |
+
$account_service->setServiceUrl("http://api.amail.io/v2");
|
48 |
+
|
49 |
+
$result = $account_service->login($username, $password);
|
50 |
+
Mage::helper('alphamail/connection')->connect($result->token);
|
51 |
+
|
52 |
+
$this->_redirect('*/*/Completed/');
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
catch(\Exception $exception)
|
56 |
+
{
|
57 |
+
$errors["password"] = $exception->getMessage();
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->_session->setAlphaMailLoginErrors($errors);
|
61 |
+
$this->_redirect('*/*/Login/');
|
62 |
+
}
|
63 |
+
|
64 |
+
public function registerAction(){
|
65 |
+
$this->__init();
|
66 |
+
|
67 |
+
$admin_user = $this->_session->getUser();
|
68 |
+
$this->_session->setAlphaMailRegistrationErrors(null);
|
69 |
+
|
70 |
+
if(strlen($this->_session->getAlphaMailCaptchaId()) == 0){
|
71 |
+
$this->__generateNewCaptcha();
|
72 |
+
}
|
73 |
+
|
74 |
+
$this->_initialAction('connect', 'registration', array(
|
75 |
+
"fullname" => trim($admin_user->getFirstname() . " " . $admin_user->getLastname()),
|
76 |
+
"email" => $admin_user->getEmail(),
|
77 |
+
"password" => "",
|
78 |
+
"password_repeated" => "",
|
79 |
+
"captcha_value" => "",
|
80 |
+
"captcha_image_url" => $this->_session->getAlphaMailCaptchaImageUrl(),
|
81 |
+
"errors" => array()
|
82 |
+
));
|
83 |
+
}
|
84 |
+
|
85 |
+
public function reviewRegistrationAction(){
|
86 |
+
$this->__init();
|
87 |
+
|
88 |
+
if(strlen($this->_session->getAlphaMailCaptchaId()) == 0){
|
89 |
+
$this->__generateNewCaptcha();
|
90 |
+
}
|
91 |
+
|
92 |
+
// Set values
|
93 |
+
$fullname = $this->_session->getAlphaMailRegistrationFullname();
|
94 |
+
$email = $this->_session->getAlphaMailRegistrationEmail();
|
95 |
+
$password = $this->_session->getAlphaMailRegistrationPassword();
|
96 |
+
$password_repeated = $this->_session->getAlphaMailRegistrationPasswordRepeated();
|
97 |
+
$captcha_value = $this->_session->getAlphaMailRegistrationCaptchaValue();
|
98 |
+
$captcha_image_url = $this->_session->getAlphaMailCaptchaImageUrl();
|
99 |
+
$errors = (array)$this->_session->getAlphaMailRegistrationErrors();
|
100 |
+
|
101 |
+
// Default values if not set
|
102 |
+
if(strlen($fullname) == 0 && strlen($email) == 0 && strlen($password) == 0){
|
103 |
+
$admin_user = $this->_session->getUser();
|
104 |
+
$email = $admin_user->getEmail();
|
105 |
+
$fullname = trim($admin_user->getFirstname() . " " . $admin_user->getLastname());
|
106 |
+
}
|
107 |
+
|
108 |
+
$this->_initialAction('connect', 'registration', array(
|
109 |
+
"fullname" => $fullname,
|
110 |
+
"email" => $email,
|
111 |
+
"password" => $password,
|
112 |
+
"password_repeated" => $password_repeated,
|
113 |
+
"captcha_value" => $captcha_value,
|
114 |
+
"captcha_image_url" => $captcha_image_url,
|
115 |
+
"errors" => $errors
|
116 |
+
));
|
117 |
+
|
118 |
+
$this->_session->setAlphaMailRegistrationErrors(null);
|
119 |
+
}
|
120 |
+
|
121 |
+
public function createAccountAction(){
|
122 |
+
// Verify that the request is POST
|
123 |
+
if(strtolower($this->getRequest()->getMethod()) != 'post'){
|
124 |
+
$this->_redirect('*/*/ReviewRegistration/');
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
|
128 |
+
$this->__init();
|
129 |
+
|
130 |
+
$errors = array();
|
131 |
+
$parameters = $this->getRequest()->getParams();
|
132 |
+
$email_validator = new Zend_Validate_EmailAddress();
|
133 |
+
|
134 |
+
$fullname = $parameters["fullname"];
|
135 |
+
$email = $parameters["email"];
|
136 |
+
$password = $parameters["password"];
|
137 |
+
$password_repeated = $parameters["password_repeated"];
|
138 |
+
$captcha_value = $parameters["captcha_value"];
|
139 |
+
|
140 |
+
// Validate full name
|
141 |
+
if(strlen($fullname) == 0){
|
142 |
+
$errors["fullname"] = "Full name cannot be empty";
|
143 |
+
}
|
144 |
+
|
145 |
+
if(strlen($fullname) != 0 && strlen($fullname) <= 2){
|
146 |
+
$errors["fullname"] = "Full name cannot be less than 2 characters";
|
147 |
+
}
|
148 |
+
|
149 |
+
// Validate email
|
150 |
+
if(strlen($email) == 0){
|
151 |
+
$errors["email"] = "Email cannot be empty";
|
152 |
+
}
|
153 |
+
|
154 |
+
if(strlen($email) != 0 && !$email_validator->isValid($email)){
|
155 |
+
$errors["email"] = "Invalid email address";
|
156 |
+
}
|
157 |
+
|
158 |
+
// Validate password
|
159 |
+
if(strlen($password) == 0){
|
160 |
+
$errors["password"] = "Password cannot be empty";
|
161 |
+
}
|
162 |
+
|
163 |
+
if(strlen($password_repeated) == 0){
|
164 |
+
$errors["password_repeated"] = "Repeated password cannot be empty";
|
165 |
+
}
|
166 |
+
|
167 |
+
if(strlen($password) > 0 && $password != $password_repeated){
|
168 |
+
$password_repeated = "";
|
169 |
+
$errors["password_repeated"] = "Password doesn't match";
|
170 |
+
}
|
171 |
+
|
172 |
+
// Validate captcha value
|
173 |
+
if(strlen($captcha_value) == 0){
|
174 |
+
$errors["captcha_value"] = "Please verify that you're human by entering the text in the image below";
|
175 |
+
}
|
176 |
+
|
177 |
+
// Try and guess the captcha
|
178 |
+
if(count($errors) == 0 && !$this->_captcha_service->guess($this->_session->getAlphaMailCaptchaId(), $captcha_value)){
|
179 |
+
$captcha_value = "";
|
180 |
+
$this->__generateNewCaptcha();
|
181 |
+
$errors["captcha_value"] = "Invalid guess. Try guessing the new image below.";
|
182 |
+
}
|
183 |
+
|
184 |
+
// No errors, try and process!
|
185 |
+
if(count($errors) == 0){
|
186 |
+
try
|
187 |
+
{
|
188 |
+
$account_service = AlphaMailAccountService::create();
|
189 |
+
$account_service->setServiceUrl("http://api.amail.io/v2");
|
190 |
+
|
191 |
+
$account_result = $account_service->createNew($email, $fullname, $password, "en", $this->_session->getAlphaMailCaptchaId(), 0);
|
192 |
+
Mage::helper('alphamail/connection')->connect($account_result->token);
|
193 |
+
|
194 |
+
$this->_redirect('*/*/Completed/');
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
catch(AlphaMailServiceException $exception)
|
198 |
+
{
|
199 |
+
$captcha_value = "";
|
200 |
+
$this->__generateNewCaptcha();
|
201 |
+
$error_message = str_replace("Exception occurred: ", "", $exception->getMessage());
|
202 |
+
Mage::getSingleton('adminhtml/session')->addError("Error: " . $this->__($error_message));
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
// Error. Save values and refresh page
|
207 |
+
if(count($errors) > 0){
|
208 |
+
$this->_session->setAlphaMailRegistrationErrors($errors);
|
209 |
+
$this->_session->setAlphaMailRegistrationFullname($fullname);
|
210 |
+
$this->_session->setAlphaMailRegistrationEmail($email);
|
211 |
+
$this->_session->setAlphaMailRegistrationPassword($password);
|
212 |
+
$this->_session->setAlphaMailRegistrationPasswordRepeated($password_repeated);
|
213 |
+
$this->_session->setAlphaMailRegistrationCaptchaValue($captcha_value);
|
214 |
+
}
|
215 |
+
|
216 |
+
$this->_redirect('*/*/ReviewRegistration/');
|
217 |
+
}
|
218 |
+
|
219 |
+
public function renewCaptchaAction(){
|
220 |
+
$this->__init();
|
221 |
+
$this->__generateNewCaptcha();
|
222 |
+
$this->_redirect('*/*/ReviewRegistration/');
|
223 |
+
}
|
224 |
+
|
225 |
+
private function __generateNewCaptcha(){
|
226 |
+
$captcha = $this->_captcha_service->createNew();
|
227 |
+
$this->_session->setAlphaMailCaptchaId($captcha->id);
|
228 |
+
$this->_session->setAlphaMailCaptchaImageUrl($captcha->image_url);
|
229 |
+
return $captcha;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
?>
|
app/code/community/Comfirm/AlphaMail/controllers/EventLogController.php
CHANGED
@@ -1,29 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Comfirm_AlphaMail_EventLogController
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_EventLogController
|
4 |
+
extends Mage_Adminhtml_Controller_Action {
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()->_setActiveMenu('system/tools');
|
8 |
+
return $this;
|
9 |
+
}
|
10 |
+
|
11 |
+
public function indexAction() {
|
12 |
+
$this->_initAction()
|
13 |
+
->_addContent($this->getLayout()->createBlock('alphamail/eventLog'))
|
14 |
+
->renderLayout();
|
15 |
+
}
|
16 |
+
|
17 |
+
public function viewAction() {
|
18 |
+
$this->_initAction()
|
19 |
+
->_addContent($this->getLayout()->createBlock('alphamail/eventLog_view'))
|
20 |
+
->renderLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function removeAllAction(){
|
24 |
+
foreach(Mage::getModel('alphamail/event_log')->getCollection() as $item){
|
25 |
+
$item->delete();
|
26 |
+
}
|
27 |
+
|
28 |
+
$this->_redirect('*/EventLog/');
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
?>
|
app/code/community/Comfirm/AlphaMail/controllers/ProjectController.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/projectservice.class.php");
|
4 |
-
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/signatureservice.class.php");
|
5 |
-
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/templateservice.class.php");
|
6 |
-
|
7 |
-
class Comfirm_AlphaMail_ProjectController extends Comfirm_AlphaMail_Controller_Abstract {
|
8 |
-
|
9 |
-
public function indexAction() {
|
10 |
-
try
|
11 |
-
{
|
12 |
-
$project_service = AlphaMailProjectService::create()
|
13 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
14 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
15 |
-
|
16 |
-
$this->_initialAction('project', 'index', array(
|
17 |
-
'projects' => $project_service->getAll()
|
18 |
-
)
|
19 |
-
);
|
20 |
-
}catch(Exception $exception){
|
21 |
-
$this->_initialAction('project', 'index', null, array('error' => $exception->getMessage()));
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
public function editAction() {
|
26 |
-
try
|
27 |
-
{
|
28 |
-
$project_id = (int)$this->getRequest()->getParam('id');
|
29 |
-
|
30 |
-
$project_service = AlphaMailProjectService::create()
|
31 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
32 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
33 |
-
|
34 |
-
$template_service = AlphaMailTemplateService::create()
|
35 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
36 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
37 |
-
|
38 |
-
$signature_service = AlphaMailSignatureService::create()
|
39 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
40 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
41 |
-
|
42 |
-
$this->_initialAction('project', 'edit', array(
|
43 |
-
'project' => $project_service->getSingle($project_id),
|
44 |
-
'signatures' => $signature_service->getAll(),
|
45 |
-
'templates' => $template_service->getAll()
|
46 |
-
)
|
47 |
-
);
|
48 |
-
}catch(Exception $exception){
|
49 |
-
$this->_initialAction('project', 'edit', null, array('error' => $exception->getMessage()));
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
public function createAction() {
|
54 |
-
try
|
55 |
-
{
|
56 |
-
$template_service = AlphaMailTemplateService::create()
|
57 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
58 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
59 |
-
|
60 |
-
$signature_service = AlphaMailSignatureService::create()
|
61 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
62 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
63 |
-
|
64 |
-
$this->_initialAction('project', 'create', array(
|
65 |
-
'signatures' => $signature_service->getAll(),
|
66 |
-
'templates' => $template_service->getAll()
|
67 |
-
)
|
68 |
-
);
|
69 |
-
}catch(Exception $exception){
|
70 |
-
$this->_initialAction('project', 'create', null, array('error' => $exception->getMessage()));
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
public function saveAction(){
|
75 |
-
try
|
76 |
-
{
|
77 |
-
$request = $this->getRequest();
|
78 |
-
$project_id = (int)$request->getParam('id');
|
79 |
-
|
80 |
-
$project = new DetailedProject(
|
81 |
-
$project_id,
|
82 |
-
$request->getParam('name'),
|
83 |
-
$request->getParam('subject'),
|
84 |
-
$request->getParam('signature_id'),
|
85 |
-
$request->getParam('template_id')
|
86 |
-
);
|
87 |
-
|
88 |
-
$project_service = AlphaMailProjectService::create()
|
89 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
90 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
91 |
-
|
92 |
-
if($project_id > 0){
|
93 |
-
$project_service->update($project);
|
94 |
-
$this->_addSuccessMessage("Project successfully updated");
|
95 |
-
}else{
|
96 |
-
$project_id = $project_service->add($project);
|
97 |
-
$this->_addSuccessMessage("Project successfully created");
|
98 |
-
}
|
99 |
-
|
100 |
-
$this->_redirectUrl($this->getUrl("*/*/edit", array('id' => $project_id)));
|
101 |
-
}
|
102 |
-
catch(AlphaMailValidationException $exception)
|
103 |
-
{
|
104 |
-
$this->_addErrorMessage("Validation error: " . $exception->getMessage());
|
105 |
-
$this->_redirectReferer();
|
106 |
-
}
|
107 |
-
catch(Exception $exception)
|
108 |
-
{
|
109 |
-
$this->_redirectUrl($this->getUrl("*/*/index"));
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/controllers/ProjectMappingController.php
CHANGED
@@ -3,37 +3,98 @@
|
|
3 |
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/projectservice.class.php");
|
4 |
|
5 |
class Comfirm_AlphaMail_ProjectMappingController extends Comfirm_AlphaMail_Controller_Abstract {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
public function indexAction() {
|
8 |
try
|
9 |
{
|
10 |
-
$templates = array();
|
11 |
$this->loadLayout()->_setActiveMenu('system/tools');
|
12 |
|
13 |
$project_service = AlphaMailProjectService::create()
|
14 |
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
15 |
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
16 |
-
|
17 |
-
$projects =
|
18 |
-
$
|
19 |
$project_mappings = Mage::getModel('alphamail/Project_Map')->getCollection();
|
20 |
|
21 |
-
foreach($
|
22 |
-
$
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
foreach($project_mappings as $project_map){
|
26 |
$project_map = $project_map->getData();
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$
|
|
|
|
|
|
|
31 |
}
|
32 |
}
|
33 |
}
|
34 |
|
35 |
$this->_initialAction('projectMapping', 'index', array(
|
36 |
-
'
|
37 |
'projects' => $projects
|
38 |
)
|
39 |
);
|
@@ -49,59 +110,63 @@
|
|
49 |
}
|
50 |
|
51 |
public function saveAction() {
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
|
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
'id' => -1,
|
78 |
-
'am_project_id' => $am_project_id
|
79 |
-
);
|
80 |
-
}
|
81 |
}
|
|
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
if($mapping_data['id'] > 0){
|
87 |
-
// Entity exists.. Update!
|
88 |
-
$model->load($mapping_data['id']);
|
89 |
-
}else{
|
90 |
-
// Entity does not exist.. Create!
|
91 |
-
$model->setTemplateName($template_id);
|
92 |
-
}
|
93 |
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
-
}
|
98 |
-
catch(AlphaMailValidationException $exception)
|
99 |
-
{
|
100 |
-
$this->_addErrorMessage("Validation error: " . $exception->getMessage());
|
101 |
-
}
|
102 |
-
catch(Exception $exception)
|
103 |
-
{
|
104 |
-
$this->_addErrorMessage("An error occurred: " . $exception->getMessage());
|
105 |
}
|
106 |
|
107 |
$this->_redirectReferer();
|
@@ -110,27 +175,17 @@
|
|
110 |
private function _getRequestTemplateMappings(){
|
111 |
$result = array();
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
117 |
}
|
118 |
}
|
119 |
|
120 |
return $result;
|
121 |
-
}
|
122 |
-
|
123 |
-
private function _endsWith($haystack, $needle)
|
124 |
-
{
|
125 |
-
$length = strlen($needle);
|
126 |
-
|
127 |
-
if ($length == 0) {
|
128 |
-
return true;
|
129 |
-
}
|
130 |
-
|
131 |
-
$start = $length * -1; //negative
|
132 |
-
return (substr($haystack, $start) === $needle);
|
133 |
-
}
|
134 |
}
|
135 |
|
136 |
?>
|
3 |
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/projectservice.class.php");
|
4 |
|
5 |
class Comfirm_AlphaMail_ProjectMappingController extends Comfirm_AlphaMail_Controller_Abstract {
|
6 |
+
|
7 |
+
const STATE_UNMODIFIED = 0;
|
8 |
+
const STATE_MODIFIED = 1;
|
9 |
+
const STATE_NOT_CREATED = 2;
|
10 |
+
const STATE_DELETED = 3;
|
11 |
+
|
12 |
+
private static $_messages = array(
|
13 |
+
"customer-created" => array(
|
14 |
+
"title" => "Customer Created",
|
15 |
+
"templates" => array(
|
16 |
+
"customer_create_account_email_template",
|
17 |
+
"customer_create_account_email_confirmed_template"
|
18 |
+
)
|
19 |
+
),
|
20 |
+
"customer-verify-email" => array(
|
21 |
+
"title" => "Customer Verify Email",
|
22 |
+
"templates" => array(
|
23 |
+
"customer_create_account_email_confirmation_template"
|
24 |
+
)
|
25 |
+
),
|
26 |
+
"customer-reset-password" => array(
|
27 |
+
"title" => "Customer Reset Password",
|
28 |
+
"templates" => array(
|
29 |
+
"customer_password_forgot_email_template"
|
30 |
+
)
|
31 |
+
),
|
32 |
+
"order-created" => array(
|
33 |
+
"title" => "Order Created",
|
34 |
+
"templates" => array(
|
35 |
+
"sales_email_order_template",
|
36 |
+
"sales_email_order_guest_template"
|
37 |
+
)
|
38 |
+
),
|
39 |
+
"order-updated" => array(
|
40 |
+
"title" => "Order Updated",
|
41 |
+
"templates" => array(
|
42 |
+
"sales_email_order_comment_template",
|
43 |
+
"sales_email_order_comment_guest_template"
|
44 |
+
)
|
45 |
+
),
|
46 |
+
"invoice-created" => array(
|
47 |
+
"title" => "Invoice Created",
|
48 |
+
"templates" => array(
|
49 |
+
"sales_email_invoice_template",
|
50 |
+
"sales_email_invoice_guest_template"
|
51 |
+
)
|
52 |
+
),
|
53 |
+
"invoice-updated" => array(
|
54 |
+
"title" => "Invoice Created",
|
55 |
+
"templates" => array(
|
56 |
+
"sales_email_invoice_comment_template",
|
57 |
+
"sales_email_invoice_comment_guest_template"
|
58 |
+
)
|
59 |
+
)
|
60 |
+
);
|
61 |
|
62 |
public function indexAction() {
|
63 |
try
|
64 |
{
|
|
|
65 |
$this->loadLayout()->_setActiveMenu('system/tools');
|
66 |
|
67 |
$project_service = AlphaMailProjectService::create()
|
68 |
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
69 |
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
70 |
+
|
71 |
+
$projects = array();
|
72 |
+
$messages = self::$_messages;
|
73 |
$project_mappings = Mage::getModel('alphamail/Project_Map')->getCollection();
|
74 |
|
75 |
+
foreach($project_service->getAll() as $project){
|
76 |
+
$projects[(int)$project->id] = $project;
|
77 |
+
}
|
78 |
+
|
79 |
+
foreach($messages as $message_id => $message){
|
80 |
+
$messages[$message_id]["am_project_id"] = null;
|
81 |
}
|
82 |
|
83 |
foreach($project_mappings as $project_map){
|
84 |
$project_map = $project_map->getData();
|
85 |
+
foreach($messages as $message_id => $message){
|
86 |
+
if(in_array($project_map['template_name'], $message["templates"])){
|
87 |
+
$am_project_id = (int)$project_map['am_project_id'];
|
88 |
+
if(array_key_exists($am_project_id, $projects)){
|
89 |
+
$messages[$message_id]["am_project_id"] = $am_project_id;
|
90 |
+
break;
|
91 |
+
}
|
92 |
}
|
93 |
}
|
94 |
}
|
95 |
|
96 |
$this->_initialAction('projectMapping', 'index', array(
|
97 |
+
'messages' => $messages,
|
98 |
'projects' => $projects
|
99 |
)
|
100 |
);
|
110 |
}
|
111 |
|
112 |
public function saveAction() {
|
113 |
+
$changes = array();
|
114 |
+
$existing_map = array();
|
115 |
+
$template_mappings = $this->_getRequestTemplateMappings();
|
116 |
+
|
117 |
+
foreach(Mage::getModel('alphamail/Project_Map')->getCollection() as $item){
|
118 |
+
$data = $item->getData();
|
119 |
+
$existing_map[$data["template_name"]] = array(
|
120 |
+
"project_map_id" => (int)$data["project_map_id"],
|
121 |
+
"am_project_id" => (int)$data["am_project_id"],
|
122 |
+
"state" => self::STATE_UNMODIFIED
|
123 |
+
);
|
124 |
+
}
|
125 |
+
|
126 |
+
foreach($template_mappings as $template_name => $project_id){
|
127 |
+
$project_id = (int)$project_id;
|
128 |
+
if(array_key_exists($template_name, $existing_map)){
|
129 |
+
$changes[$template_name] = array(
|
130 |
+
"project_map_id" => $existing_map[$template_name]["project_map_id"],
|
131 |
+
"am_project_id" => $project_id,
|
132 |
+
"state" => $existing_map[$template_name]["am_project_id"] != $project_id
|
133 |
+
? self::STATE_MODIFIED : self::STATE_UNMODIFIED
|
134 |
+
);
|
135 |
+
}else{
|
136 |
+
$changes[$template_name] = array(
|
137 |
+
"am_project_id" => $project_id,
|
138 |
+
"state" => self::STATE_NOT_CREATED
|
139 |
+
);
|
140 |
}
|
141 |
+
}
|
142 |
|
143 |
+
foreach($existing_map as $template_name => $data){
|
144 |
+
if(!array_key_exists($template_name, $template_mappings)){
|
145 |
+
$data["state"] = self::STATE_DELETED;
|
146 |
+
$changes[$template_name] = $data;
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
+
}
|
149 |
|
150 |
+
foreach($changes as $template_name => $change){
|
151 |
+
$state = $change["state"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
+
if($state == self::STATE_UNMODIFIED){
|
154 |
+
continue; // NOP
|
155 |
+
}
|
156 |
+
|
157 |
+
$model = Mage::getModel('alphamail/Project_Map');
|
158 |
+
|
159 |
+
if($state != self::STATE_NOT_CREATED){
|
160 |
+
$model->setId($change["project_map_id"]);
|
161 |
+
}
|
162 |
+
|
163 |
+
if($state == self::STATE_DELETED){
|
164 |
+
$model->delete();
|
165 |
+
}else{
|
166 |
+
$model->setAmProjectId($change["am_project_id"]);
|
167 |
+
$model->setTemplateName($template_name);
|
168 |
+
$model->save();
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
|
172 |
$this->_redirectReferer();
|
175 |
private function _getRequestTemplateMappings(){
|
176 |
$result = array();
|
177 |
|
178 |
+
$parameters = $this->getRequest()->getParams();
|
179 |
+
$mappings = json_decode($parameters["mappings"]);
|
180 |
+
|
181 |
+
foreach($mappings as $message_name => $project_id){
|
182 |
+
foreach(self::$_messages[$message_name]["templates"] as $template_name){
|
183 |
+
$result[$template_name] = (int)$project_id;
|
184 |
}
|
185 |
}
|
186 |
|
187 |
return $result;
|
188 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
190 |
|
191 |
?>
|
app/code/community/Comfirm/AlphaMail/controllers/ProjectMappingController.php.bak
DELETED
@@ -1,136 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/projectservice.class.php");
|
4 |
-
|
5 |
-
class Comfirm_AlphaMail_ProjectMappingController extends Comfirm_AlphaMail_Controller_Abstract {
|
6 |
-
|
7 |
-
public function indexAction() {
|
8 |
-
try
|
9 |
-
{
|
10 |
-
$templates = array();
|
11 |
-
$this->loadLayout()->_setActiveMenu('system/tools');
|
12 |
-
|
13 |
-
$project_service = AlphaMailProjectService::create()
|
14 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
15 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
16 |
-
|
17 |
-
$projects = $project_service->getAll();
|
18 |
-
$email_templates = $this->_getHelper()->getDefaultCoreTemplates();
|
19 |
-
$project_mappings = Mage::getModel('alphamail/Project_Map')->getCollection();
|
20 |
-
|
21 |
-
foreach($email_templates as $template_id => $template){
|
22 |
-
$templates[$template_id] = array('title' => $template['label'], 'selected_id' => -1);
|
23 |
-
}
|
24 |
-
|
25 |
-
foreach($project_mappings as $project_map){
|
26 |
-
$project_map = $project_map->getData();
|
27 |
-
if(array_key_exists($project_map['template_name'], $templates)){
|
28 |
-
$am_project_id = (int)$project_map['am_project_id'];
|
29 |
-
if($am_project_id > 0){
|
30 |
-
$templates[$project_map['template_name']]['selected_id'] = $am_project_id;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
$this->_initialAction('projectMapping', 'index', array(
|
36 |
-
'templates' => $templates,
|
37 |
-
'projects' => $projects
|
38 |
-
)
|
39 |
-
);
|
40 |
-
}
|
41 |
-
catch(AlphaMailValidationException $exception)
|
42 |
-
{
|
43 |
-
$this->_addErrorMessage("Validation error: " . $exception->getMessage());
|
44 |
-
}
|
45 |
-
catch(Exception $exception)
|
46 |
-
{
|
47 |
-
$this->_initialAction('projectMapping', 'index', null, array('error' => $exception->getMessage()));
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
public function saveAction() {
|
52 |
-
try
|
53 |
-
{
|
54 |
-
$changed_mappings = array();
|
55 |
-
|
56 |
-
$project_mappings = Mage::getModel('alphamail/Project_Map')->getCollection();
|
57 |
-
$template_mappings = $this->_getRequestTemplateMappings();
|
58 |
-
|
59 |
-
// Get all mappings that exist and have changed
|
60 |
-
foreach($project_mappings as $project_mapping){
|
61 |
-
$template_id = $project_mapping['template_name'];
|
62 |
-
if(array_key_exists($template_id, $template_mappings)){
|
63 |
-
$am_project_id = $template_mappings[$template_id];
|
64 |
-
if($am_project_id != (int)$template_mappings['am_project_id']){
|
65 |
-
$changed_mappings[$template_id] = array(
|
66 |
-
'id' => (int)$project_mapping['project_map_id'],
|
67 |
-
'am_project_id' => $am_project_id
|
68 |
-
);
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
// Get all new mappings that does not exist but has been changed
|
74 |
-
foreach($template_mappings as $template_id => $am_project_id){
|
75 |
-
if($am_project_id > 0 && !array_key_exists($template_id, $changed_mappings)){
|
76 |
-
$changed_mappings[$template_id] = array(
|
77 |
-
'id' => -1,
|
78 |
-
'am_project_id' => $am_project_id
|
79 |
-
);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
foreach($changed_mappings as $template_id => $mapping_data){
|
84 |
-
$model = Mage::getModel('alphamail/Project_Map');
|
85 |
-
|
86 |
-
if($mapping_data['id'] > 0){
|
87 |
-
// Entity exists.. Update!
|
88 |
-
$model->load($mapping_data['id']);
|
89 |
-
}else{
|
90 |
-
// Entity does not exist.. Create!
|
91 |
-
$model->setTemplateName($template_id);
|
92 |
-
}
|
93 |
-
|
94 |
-
$model->setAmProjectId($mapping_data['am_project_id'])
|
95 |
-
->save();
|
96 |
-
}
|
97 |
-
}
|
98 |
-
catch(AlphaMailValidationException $exception)
|
99 |
-
{
|
100 |
-
$this->_addErrorMessage("Validation error: " . $exception->getMessage());
|
101 |
-
}
|
102 |
-
catch(Exception $exception)
|
103 |
-
{
|
104 |
-
$this->_addErrorMessage("An error occurred: " . $exception->getMessage());
|
105 |
-
}
|
106 |
-
|
107 |
-
$this->_redirectReferer();
|
108 |
-
}
|
109 |
-
|
110 |
-
private function _getRequestTemplateMappings(){
|
111 |
-
$result = array();
|
112 |
-
|
113 |
-
foreach($this->getRequest()->getParams() as $key=>$value) {
|
114 |
-
if($this->_endsWith($key, '_project_id')){
|
115 |
-
$template_id = substr($key, 0, strlen($key)-11);
|
116 |
-
$result[$template_id] = (int)$value;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
return $result;
|
121 |
-
}
|
122 |
-
|
123 |
-
private function _endsWith($haystack, $needle)
|
124 |
-
{
|
125 |
-
$length = strlen($needle);
|
126 |
-
|
127 |
-
if ($length == 0) {
|
128 |
-
return true;
|
129 |
-
}
|
130 |
-
|
131 |
-
$start = $length * -1; //negative
|
132 |
-
return (substr($haystack, $start) === $needle);
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/controllers/SendLogController.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Comfirm_AlphaMail_SendLogController
|
4 |
+
extends Mage_Adminhtml_Controller_Action {
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
// load layout, set active menu and breadcrumbs
|
8 |
+
$this->loadLayout()
|
9 |
+
->_setActiveMenu('system/tools');
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function indexAction() {
|
14 |
+
$this->_initAction()
|
15 |
+
->_addContent($this->getLayout()->createBlock('alphamail/sendLog'))
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function viewAction() {
|
20 |
+
$this->_initAction()
|
21 |
+
->_addContent($this->getLayout()->createBlock('alphamail/sendLog_view'))
|
22 |
+
->renderLayout();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function removeAllAction(){
|
26 |
+
foreach(Mage::getModel('alphamail/send_log')->getCollection() as $item){
|
27 |
+
$item->delete();
|
28 |
+
}
|
29 |
+
|
30 |
+
$this->_redirect('*/SendLog/');
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
app/code/community/Comfirm/AlphaMail/controllers/SingleSignOnController.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/userticketservice.class.php");
|
4 |
+
|
5 |
+
class Comfirm_AlphaMail_SingleSignOnController extends Comfirm_AlphaMail_Controller_Abstract {
|
6 |
+
public function indexAction() {
|
7 |
+
$this->showSingleSignOn();
|
8 |
+
}
|
9 |
+
|
10 |
+
public function tokensAction(){
|
11 |
+
$this->showSingleSignOn("/tokens/");
|
12 |
+
}
|
13 |
+
|
14 |
+
public function signaturesAction(){
|
15 |
+
$this->showSingleSignOn("/signatures/");
|
16 |
+
}
|
17 |
+
|
18 |
+
public function settingsAction(){
|
19 |
+
$this->showSingleSignOn("/settings/");
|
20 |
+
}
|
21 |
+
|
22 |
+
private function showSingleSignOn($path = null){
|
23 |
+
$ticket_service = AlphaMailUserTicketService::create()
|
24 |
+
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
25 |
+
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
26 |
+
|
27 |
+
try
|
28 |
+
{
|
29 |
+
$ticket = $ticket_service->createNew(new CreateUserTicket(3600, $path));
|
30 |
+
$this->_initialAction('singleSignOn', 'index', array(
|
31 |
+
'url' => isset($ticket) ? $ticket->sso_url : null
|
32 |
+
)
|
33 |
+
);
|
34 |
+
}
|
35 |
+
catch(Exception $exception){
|
36 |
+
$this->_initialAction('singleSignOn', 'index', null, array('error' => $exception->getMessage()));
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
?>
|
app/code/community/Comfirm/AlphaMail/controllers/TemplateController.php
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
include_once(Mage::getBaseDir() . "/app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/templateservice.class.php");
|
4 |
-
|
5 |
-
class Comfirm_AlphaMail_TemplateController extends Comfirm_AlphaMail_Controller_Abstract {
|
6 |
-
|
7 |
-
public function indexAction() {
|
8 |
-
try {
|
9 |
-
$template_service = AlphaMailTemplateService::create()
|
10 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
11 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
12 |
-
|
13 |
-
$this->_initialAction('template', 'index', array(
|
14 |
-
'templates' => $template_service->getAll()
|
15 |
-
)
|
16 |
-
);
|
17 |
-
}catch(Exception $exception){
|
18 |
-
$this->_initialAction('template', 'index', null, array('error' => $exception->getMessage()));
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
public function editAction() {
|
23 |
-
try {
|
24 |
-
$template_id = (int)$this->getRequest()->getParam('id');
|
25 |
-
|
26 |
-
$template_service = AlphaMailTemplateService::create()
|
27 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
28 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
29 |
-
|
30 |
-
$this->_initialAction('template', 'edit', array(
|
31 |
-
'template' => $template_service->getSingle($template_id)
|
32 |
-
)
|
33 |
-
);
|
34 |
-
}catch(Exception $exception){
|
35 |
-
$this->_initialAction('template', 'index', null, array('error' => $exception->getMessage()));
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
public function createAction() {
|
40 |
-
$this->_initialAction('template', 'create');
|
41 |
-
}
|
42 |
-
|
43 |
-
public function saveAction(){
|
44 |
-
try
|
45 |
-
{
|
46 |
-
$request = $this->getRequest();
|
47 |
-
$template_id = (int)$request->getParam('id');
|
48 |
-
|
49 |
-
$template = new DetailedTemplate(
|
50 |
-
$template_id,
|
51 |
-
$request->getParam('name'),
|
52 |
-
new TemplateContent(
|
53 |
-
$request->getParam('html_version'),
|
54 |
-
$request->getParam('text_version')
|
55 |
-
)
|
56 |
-
);
|
57 |
-
|
58 |
-
$template_service = AlphaMailTemplateService::create()
|
59 |
-
->setServiceUrl($this->_getHelper()->getPrimaryServerUrl())
|
60 |
-
->setApiToken($this->_getHelper()->getAuthenticationToken());
|
61 |
-
|
62 |
-
if($template_id > 0){
|
63 |
-
$template_service->update($template);
|
64 |
-
$this->_addSuccessMessage("Template successfully updated");
|
65 |
-
}else{
|
66 |
-
$template_id = $template_service->add($template);
|
67 |
-
$this->_addSuccessMessage("Template successfully created");
|
68 |
-
}
|
69 |
-
|
70 |
-
$this->_redirectUrl($this->getUrl("*/*/edit", array('id' => $template_id)));
|
71 |
-
}
|
72 |
-
catch(AlphaMailValidationException $exception)
|
73 |
-
{
|
74 |
-
$this->_addErrorMessage("Validation error: " . $exception->getMessage());
|
75 |
-
$this->_redirectReferer();
|
76 |
-
}
|
77 |
-
catch(Exception $exception)
|
78 |
-
{
|
79 |
-
$this->_redirectUrl($this->getUrl("*/*/index"));
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Comfirm_AlphaMail>
|
5 |
-
<version>1.
|
6 |
</Comfirm_AlphaMail>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -36,14 +36,11 @@
|
|
36 |
<event_log><table>alphamail_event_log</table></event_log>
|
37 |
<send_log><table>alphamail_send_log</table></send_log>
|
38 |
<project_map><table>alphamail_project_map</table></project_map>
|
39 |
-
<project><table>alphamail_project_map</table></project>
|
40 |
</entities>
|
41 |
</alphamail_mysql4>
|
42 |
<core>
|
43 |
<rewrite>
|
44 |
-
<!--<email>Comfirm_AlphaMail_Model_Email</email>-->
|
45 |
<email_template>Comfirm_AlphaMail_Model_Email_Template</email_template>
|
46 |
-
<!--<email_template_filter>Comfirm_AlphaMail_Model_Email_Template_Filter</email_template_filter>-->
|
47 |
</rewrite>
|
48 |
</core>
|
49 |
</models>
|
@@ -83,33 +80,45 @@
|
|
83 |
<alphamail>
|
84 |
<title>AlphaMail</title>
|
85 |
<children>
|
86 |
-
<
|
87 |
-
<title>
|
88 |
-
<action>alphamail/
|
89 |
-
</
|
90 |
-
<template translate="title" module="alphamail">
|
91 |
-
<title>Templates</title>
|
92 |
-
<action>alphamail/Template</action>
|
93 |
-
</template>
|
94 |
<configuration translate="title" module="alphamail">
|
95 |
<title>Configuration</title>
|
96 |
<action>adminhtml/system_config/edit/section/alphamail</action>
|
97 |
-
<children>
|
98 |
-
<projectmapping translate="title" module="alphamail">
|
99 |
-
<title>Project mapping</title>
|
100 |
-
<action>alphamail/ProjectMapping</action>
|
101 |
-
</projectmapping>
|
102 |
-
</children>
|
103 |
</configuration>
|
104 |
-
<logging>
|
105 |
-
<title>
|
106 |
<children>
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
112 |
</logging>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
</children>
|
114 |
</alphamail>
|
115 |
</children>
|
@@ -149,7 +158,7 @@
|
|
149 |
<logging_mode>0</logging_mode>
|
150 |
</debugging>
|
151 |
<system>
|
152 |
-
<primary_address>api.amail.io</primary_address>
|
153 |
<fallback_mode>native</fallback_mode>
|
154 |
<number_of_retries>3</number_of_retries>
|
155 |
</system>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Comfirm_AlphaMail>
|
5 |
+
<version>1.5.0</version>
|
6 |
</Comfirm_AlphaMail>
|
7 |
</modules>
|
8 |
<frontend>
|
36 |
<event_log><table>alphamail_event_log</table></event_log>
|
37 |
<send_log><table>alphamail_send_log</table></send_log>
|
38 |
<project_map><table>alphamail_project_map</table></project_map>
|
|
|
39 |
</entities>
|
40 |
</alphamail_mysql4>
|
41 |
<core>
|
42 |
<rewrite>
|
|
|
43 |
<email_template>Comfirm_AlphaMail_Model_Email_Template</email_template>
|
|
|
44 |
</rewrite>
|
45 |
</core>
|
46 |
</models>
|
80 |
<alphamail>
|
81 |
<title>AlphaMail</title>
|
82 |
<children>
|
83 |
+
<projectmapping translate="title" module="alphamail">
|
84 |
+
<title>Project Mapping</title>
|
85 |
+
<action>alphamail/ProjectMapping</action>
|
86 |
+
</projectmapping>
|
|
|
|
|
|
|
|
|
87 |
<configuration translate="title" module="alphamail">
|
88 |
<title>Configuration</title>
|
89 |
<action>adminhtml/system_config/edit/section/alphamail</action>
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</configuration>
|
91 |
+
<logging translate="title" module="alphamail">
|
92 |
+
<title>System Logs</title>
|
93 |
<children>
|
94 |
+
<sendlog translate="title" module="alphamail">
|
95 |
+
<title>Send Log</title>
|
96 |
+
<action>alphamail/SendLog</action>
|
97 |
+
</sendlog>
|
98 |
+
<errorlog translate="title" module="alphamail">
|
99 |
+
<title>Event Log</title>
|
100 |
+
<action>alphamail/EventLog</action>
|
101 |
+
</errorlog>
|
102 |
+
</children>
|
103 |
</logging>
|
104 |
+
<dashboard translate="title" module="alphamail">
|
105 |
+
<title>» Login to Dashboard »</title>
|
106 |
+
<action>alphamail/SingleSignOn</action>
|
107 |
+
<children>
|
108 |
+
<signatures translate="title" module="alphamail">
|
109 |
+
<title>Signatures</title>
|
110 |
+
<action>alphamail/SingleSignOn/signatures</action>
|
111 |
+
</signatures>
|
112 |
+
<tokens translate="title" module="alphamail">
|
113 |
+
<title>Tokens</title>
|
114 |
+
<action>alphamail/SingleSignOn/tokens/</action>
|
115 |
+
</tokens>
|
116 |
+
<settings translate="title" module="alphamail">
|
117 |
+
<title>Settings</title>
|
118 |
+
<action>alphamail/SingleSignOn/settings/</action>
|
119 |
+
</settings>
|
120 |
+
</children>
|
121 |
+
</dashboard>
|
122 |
</children>
|
123 |
</alphamail>
|
124 |
</children>
|
158 |
<logging_mode>0</logging_mode>
|
159 |
</debugging>
|
160 |
<system>
|
161 |
+
<primary_address>api.amail.io,api.fb1.amail.io,api.fb2.amail.io,api.fb3.amail.io,api.fb4.amail.io,api.fb5.amail.io</primary_address>
|
162 |
<fallback_mode>native</fallback_mode>
|
163 |
<number_of_retries>3</number_of_retries>
|
164 |
</system>
|
app/code/community/Comfirm/AlphaMail/etc/system.xml
CHANGED
@@ -63,7 +63,7 @@
|
|
63 |
<show_in_default>1</show_in_default>
|
64 |
<show_in_website>0</show_in_website>
|
65 |
<show_in_store>0</show_in_store>
|
66 |
-
<comment>Token used to authenticate against AlphaMail services
|
67 |
</token>
|
68 |
</fields>
|
69 |
</authentication>
|
@@ -124,7 +124,7 @@
|
|
124 |
<show_in_default>1</show_in_default>
|
125 |
<show_in_website>0</show_in_website>
|
126 |
<show_in_store>0</show_in_store>
|
127 |
-
<comment>Number or retries before entering fallback mode
|
128 |
</number_of_retries>
|
129 |
<fallback_mode translate="label comment">
|
130 |
<label>Fallback mode</label>
|
63 |
<show_in_default>1</show_in_default>
|
64 |
<show_in_website>0</show_in_website>
|
65 |
<show_in_store>0</show_in_store>
|
66 |
+
<comment>Token used to authenticate against AlphaMail services. <![CDATA[<span id="alphamail_config_connect_info"></span>]]></comment>
|
67 |
</token>
|
68 |
</fields>
|
69 |
</authentication>
|
124 |
<show_in_default>1</show_in_default>
|
125 |
<show_in_website>0</show_in_website>
|
126 |
<show_in_store>0</show_in_store>
|
127 |
+
<comment>Number or retries before entering fallback mode.</comment>
|
128 |
</number_of_retries>
|
129 |
<fallback_mode translate="label comment">
|
130 |
<label>Fallback mode</label>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/accountservice.class.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
$relative_path = dirname(__FILE__);
|
28 |
+
|
29 |
+
// Include service contract
|
30 |
+
require_once($relative_path . "/accountservice.interface.php");
|
31 |
+
|
32 |
+
// Include entities
|
33 |
+
require_once($relative_path . "/entities/serviceresponse.class.php");
|
34 |
+
require_once($relative_path . "/entities/account.class.php");
|
35 |
+
|
36 |
+
// Include exceptions
|
37 |
+
require_once($relative_path . "/exceptions/alphamailserviceexception.class.php");
|
38 |
+
require_once($relative_path . "/exceptions/alphamailauthorizationexception.class.php");
|
39 |
+
require_once($relative_path . "/exceptions/alphamailinternalexception.class.php");
|
40 |
+
require_once($relative_path . "/exceptions/alphamailvalidationexception.class.php");
|
41 |
+
|
42 |
+
// Include restful client
|
43 |
+
require_once($relative_path . "/../comfirm.services.client.rest/restful.class.php");
|
44 |
+
|
45 |
+
class AlphaMailAccountService implements IAccountService
|
46 |
+
{
|
47 |
+
private $_client = null;
|
48 |
+
private $_service_url = null;
|
49 |
+
|
50 |
+
protected function __construct()
|
51 |
+
{
|
52 |
+
$this->_client = new Restful();
|
53 |
+
}
|
54 |
+
|
55 |
+
public static function create()
|
56 |
+
{
|
57 |
+
return new AlphaMailAccountService();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function setServiceUrl($service_url)
|
61 |
+
{
|
62 |
+
$this->_service_url = $service_url;
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function createNew($email, $person_name, $password, $language, $captcha_id, $plan_id)
|
67 |
+
{
|
68 |
+
$response = null;
|
69 |
+
|
70 |
+
$request = new CreateAccountBody();
|
71 |
+
$request->email = $email;
|
72 |
+
$request->person_name = $person_name;
|
73 |
+
$request->password = $password;
|
74 |
+
$request->language = $language;
|
75 |
+
$request->captcha_id = $captcha_id;
|
76 |
+
$request->plan_id = $plan_id;
|
77 |
+
|
78 |
+
try
|
79 |
+
{
|
80 |
+
$raw_response = $this->_client->post($this->_service_url . "/account/", json_encode($request));
|
81 |
+
$response = $this->cast($raw_response->result, "CreateAccountResult");
|
82 |
+
$this->handleErrors($raw_response);
|
83 |
+
}
|
84 |
+
catch(AlphaMailServiceException $exception)
|
85 |
+
{
|
86 |
+
throw $exception;
|
87 |
+
}
|
88 |
+
catch(Exception $exception)
|
89 |
+
{
|
90 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
91 |
+
}
|
92 |
+
|
93 |
+
return $response->result;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function login($username, $password)
|
97 |
+
{
|
98 |
+
$response = null;
|
99 |
+
|
100 |
+
$request = new AccountLoginBody();
|
101 |
+
$request->username = $username;
|
102 |
+
$request->password = $password;
|
103 |
+
|
104 |
+
try
|
105 |
+
{
|
106 |
+
$raw_response = $this->_client->post($this->_service_url . "/account/login/", json_encode($request));
|
107 |
+
$response = $this->cast($raw_response->result, "AcconutLoginResult");
|
108 |
+
$this->handleErrors($raw_response);
|
109 |
+
}
|
110 |
+
catch(AlphaMailServiceException $exception)
|
111 |
+
{
|
112 |
+
throw $exception;
|
113 |
+
}
|
114 |
+
catch(Exception $exception)
|
115 |
+
{
|
116 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
117 |
+
}
|
118 |
+
|
119 |
+
return $response->result;
|
120 |
+
}
|
121 |
+
|
122 |
+
private function handleErrors($response)
|
123 |
+
{
|
124 |
+
switch ($response->head->status->code)
|
125 |
+
{
|
126 |
+
// Successful requests
|
127 |
+
case 202: // Accepted:
|
128 |
+
case 201: // Created:
|
129 |
+
case 200: // OK:
|
130 |
+
if ($response->result->error_code != 0){
|
131 |
+
throw new AlphaMailInternalException(
|
132 |
+
sprintf("Service returned success while response error code was set (%d)", $response->result->error_code),
|
133 |
+
$response->head->status,
|
134 |
+
$response->result,
|
135 |
+
null
|
136 |
+
);
|
137 |
+
}
|
138 |
+
break;
|
139 |
+
|
140 |
+
// Unauthorized
|
141 |
+
case 403: // Forbidden:
|
142 |
+
case 401: // Unauthorized:
|
143 |
+
throw new AlphaMailAuthorizationException(
|
144 |
+
$response->result->message,
|
145 |
+
$response->head->status,
|
146 |
+
$response->result,
|
147 |
+
null
|
148 |
+
);
|
149 |
+
|
150 |
+
// Validation error
|
151 |
+
case 405: // MethodNotAllowed:
|
152 |
+
case 404: // MethodNotAllowed:
|
153 |
+
case 400: // BadRequest:
|
154 |
+
case 422: // Unprocessable Entity:
|
155 |
+
throw new AlphaMailValidationException(
|
156 |
+
$response->result->message,
|
157 |
+
$response->head->status,
|
158 |
+
$response->result,
|
159 |
+
null
|
160 |
+
);
|
161 |
+
|
162 |
+
// Internal error
|
163 |
+
case 500: // InternalServerError
|
164 |
+
throw new AlphaMailInternalException(
|
165 |
+
$response->result->message,
|
166 |
+
$response->head->status,
|
167 |
+
$response->result,
|
168 |
+
null
|
169 |
+
);
|
170 |
+
|
171 |
+
// Unknown
|
172 |
+
default:
|
173 |
+
throw new AlphaMailServiceException(
|
174 |
+
$response->result->message,
|
175 |
+
$response->head->status,
|
176 |
+
$response->result,
|
177 |
+
null
|
178 |
+
);
|
179 |
+
}
|
180 |
+
|
181 |
+
return $response;
|
182 |
+
}
|
183 |
+
|
184 |
+
// Object-casting-hack :)
|
185 |
+
private function cast($source, $destination)
|
186 |
+
{
|
187 |
+
$result = null;
|
188 |
+
|
189 |
+
if(@class_exists($destination))
|
190 |
+
{
|
191 |
+
$serialized = @serialize($source);
|
192 |
+
|
193 |
+
$result = @unserialize('O:' . strlen($destination) . ':"' . $destination . '":' .
|
194 |
+
substr($serialized, $serialized[2] + 7));
|
195 |
+
|
196 |
+
if($result === false)
|
197 |
+
throw new Exception("Unable to cast object to type '" . $destination . "'");
|
198 |
+
}
|
199 |
+
else
|
200 |
+
{
|
201 |
+
return false;
|
202 |
+
}
|
203 |
+
|
204 |
+
return $result;
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/accountservice.interface.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Represents an account service used for creating and handling accounts
|
29 |
+
*/
|
30 |
+
interface IAccountService
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Create a new account
|
34 |
+
*/
|
35 |
+
function createNew($email, $person_name, $password, $language, $captcha_id, $plan_id);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Login using username and password credentials
|
39 |
+
*/
|
40 |
+
function login($username, $password);
|
41 |
+
}
|
42 |
+
|
43 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/captchaservice.class.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
$relative_path = dirname(__FILE__);
|
28 |
+
|
29 |
+
// Include service contract
|
30 |
+
require_once($relative_path . "/captchaservice.interface.php");
|
31 |
+
|
32 |
+
// Include entities
|
33 |
+
require_once($relative_path . "/entities/serviceresponse.class.php");
|
34 |
+
require_once($relative_path . "/entities/captcha.class.php");
|
35 |
+
|
36 |
+
// Include exceptions
|
37 |
+
require_once($relative_path . "/exceptions/alphamailserviceexception.class.php");
|
38 |
+
require_once($relative_path . "/exceptions/alphamailauthorizationexception.class.php");
|
39 |
+
require_once($relative_path . "/exceptions/alphamailinternalexception.class.php");
|
40 |
+
require_once($relative_path . "/exceptions/alphamailvalidationexception.class.php");
|
41 |
+
|
42 |
+
// Include restful client
|
43 |
+
require_once($relative_path . "/../comfirm.services.client.rest/restful.class.php");
|
44 |
+
|
45 |
+
class AlphaMailCaptchaService implements ICaptchaService
|
46 |
+
{
|
47 |
+
private $_client = null;
|
48 |
+
private $_service_url = null;
|
49 |
+
|
50 |
+
protected function __construct()
|
51 |
+
{
|
52 |
+
$this->_client = new Restful();
|
53 |
+
}
|
54 |
+
|
55 |
+
public static function create()
|
56 |
+
{
|
57 |
+
return new AlphaMailCaptchaService();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function setServiceUrl($service_url)
|
61 |
+
{
|
62 |
+
$this->_service_url = $service_url;
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function createNew()
|
67 |
+
{
|
68 |
+
$response = null;
|
69 |
+
|
70 |
+
try
|
71 |
+
{
|
72 |
+
$raw_response = $this->_client->post($this->_service_url . "/captchas", null);
|
73 |
+
$response = $this->cast($raw_response->result, "Captcha");
|
74 |
+
$this->handleErrors($raw_response);
|
75 |
+
}
|
76 |
+
catch(AlphaMailServiceException $exception)
|
77 |
+
{
|
78 |
+
throw $exception;
|
79 |
+
}
|
80 |
+
catch(Exception $exception)
|
81 |
+
{
|
82 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
83 |
+
}
|
84 |
+
|
85 |
+
return $response->result;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function guess($captcha_id, $value){
|
89 |
+
$response = null;
|
90 |
+
|
91 |
+
try
|
92 |
+
{
|
93 |
+
$request_body = new CaptchaGuessRequest($value);
|
94 |
+
$raw_response = $this->_client->put($this->_service_url . "/captchas/".$captcha_id."/", json_encode($request_body));
|
95 |
+
$this->handleErrors($raw_response);
|
96 |
+
}
|
97 |
+
catch(AlphaMailValidationException $exception)
|
98 |
+
{
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
catch(AlphaMailServiceException $exception)
|
102 |
+
{
|
103 |
+
throw $exception;
|
104 |
+
}
|
105 |
+
catch(Exception $exception)
|
106 |
+
{
|
107 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
108 |
+
}
|
109 |
+
|
110 |
+
return true;
|
111 |
+
}
|
112 |
+
|
113 |
+
public function consume($captcha_id){
|
114 |
+
throw new Exception("");
|
115 |
+
}
|
116 |
+
|
117 |
+
private function handleErrors($response)
|
118 |
+
{
|
119 |
+
switch ($response->head->status->code)
|
120 |
+
{
|
121 |
+
// Successful requests
|
122 |
+
case 202: // Accepted:
|
123 |
+
case 201: // Created:
|
124 |
+
case 200: // OK:
|
125 |
+
if ($response->result->error_code != 0){
|
126 |
+
throw new AlphaMailInternalException(
|
127 |
+
sprintf("Service returned success while response error code was set (%d)", $response->result->error_code),
|
128 |
+
$response->head->status,
|
129 |
+
$response->result,
|
130 |
+
null
|
131 |
+
);
|
132 |
+
}
|
133 |
+
break;
|
134 |
+
|
135 |
+
// Unauthorized
|
136 |
+
case 403: // Forbidden:
|
137 |
+
case 401: // Unauthorized:
|
138 |
+
throw new AlphaMailAuthorizationException(
|
139 |
+
$response->result->message,
|
140 |
+
$response->head->status,
|
141 |
+
$response->result,
|
142 |
+
null
|
143 |
+
);
|
144 |
+
|
145 |
+
// Validation error
|
146 |
+
case 405: // MethodNotAllowed:
|
147 |
+
case 404: // MethodNotAllowed:
|
148 |
+
case 400: // BadRequest:
|
149 |
+
case 422: // Unprocessable Entity:
|
150 |
+
throw new AlphaMailValidationException(
|
151 |
+
$response->result->message,
|
152 |
+
$response->head->status,
|
153 |
+
$response->result,
|
154 |
+
null
|
155 |
+
);
|
156 |
+
|
157 |
+
// Internal error
|
158 |
+
case 500: // InternalServerError
|
159 |
+
throw new AlphaMailInternalException(
|
160 |
+
$response->result->message,
|
161 |
+
$response->head->status,
|
162 |
+
$response->result,
|
163 |
+
null
|
164 |
+
);
|
165 |
+
|
166 |
+
// Unknown
|
167 |
+
default:
|
168 |
+
throw new AlphaMailServiceException(
|
169 |
+
$response->result->message,
|
170 |
+
$response->head->status,
|
171 |
+
$response->result,
|
172 |
+
null
|
173 |
+
);
|
174 |
+
}
|
175 |
+
|
176 |
+
return $response;
|
177 |
+
}
|
178 |
+
|
179 |
+
// Object-casting-hack :)
|
180 |
+
private function cast($source, $destination)
|
181 |
+
{
|
182 |
+
$result = null;
|
183 |
+
|
184 |
+
if(@class_exists($destination))
|
185 |
+
{
|
186 |
+
$serialized = @serialize($source);
|
187 |
+
|
188 |
+
$result = @unserialize('O:' . strlen($destination) . ':"' . $destination . '":' .
|
189 |
+
substr($serialized, $serialized[2] + 7));
|
190 |
+
|
191 |
+
if($result === false)
|
192 |
+
throw new Exception("Unable to cast object to type '" . $destination . "'");
|
193 |
+
}
|
194 |
+
else
|
195 |
+
{
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
|
199 |
+
return $result;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/captchaservice.interface.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Represents a captcha service used for creating, guessing and verifying captchas
|
29 |
+
*/
|
30 |
+
interface ICaptchaService
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Create a new captcha
|
34 |
+
*/
|
35 |
+
function createNew();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Guesses the value of a captcha
|
39 |
+
*/
|
40 |
+
function guess($captcha_id, $value);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Consume a captcha
|
44 |
+
*/
|
45 |
+
function consume($captcha_id);
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/account.class.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
class CreateAccountBody
|
28 |
+
{
|
29 |
+
public $email;
|
30 |
+
public $person_name;
|
31 |
+
public $password;
|
32 |
+
public $language;
|
33 |
+
public $captcha_id;
|
34 |
+
public $plan_id;
|
35 |
+
}
|
36 |
+
|
37 |
+
class AccountLoginBody
|
38 |
+
{
|
39 |
+
public $username;
|
40 |
+
public $password;
|
41 |
+
}
|
42 |
+
|
43 |
+
class AcconutLoginResult
|
44 |
+
{
|
45 |
+
public $token;
|
46 |
+
}
|
47 |
+
|
48 |
+
class CreateAccountResult {
|
49 |
+
public $id;
|
50 |
+
public $token;
|
51 |
+
public $sso_url;
|
52 |
+
|
53 |
+
public function __construct($id = null, $token = null, $sso_url = null){
|
54 |
+
$this->id = $id;
|
55 |
+
$this->token = $token;
|
56 |
+
$this->sso_url = $sso_url;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/captcha.class.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Captcha
|
28 |
+
{
|
29 |
+
public $id, $image_url;
|
30 |
+
}
|
31 |
+
|
32 |
+
class CaptchaGuessRequest
|
33 |
+
{
|
34 |
+
public $value;
|
35 |
+
|
36 |
+
public function __construct($value = null){
|
37 |
+
$this->value = $value;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/integration.class.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Integration {
|
4 |
+
public $id;
|
5 |
+
public $name;
|
6 |
+
public $metadata;
|
7 |
+
public $updated;
|
8 |
+
public $created;
|
9 |
+
}
|
10 |
+
|
11 |
+
class ConnectIntegrationTokenRequest {
|
12 |
+
public $token_id;
|
13 |
+
}
|
14 |
+
|
15 |
+
class CreateIntegrationRequest {
|
16 |
+
public $name;
|
17 |
+
public $metadata;
|
18 |
+
}
|
19 |
+
|
20 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/token.class.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Token
|
28 |
+
{
|
29 |
+
public $id;
|
30 |
+
public $name;
|
31 |
+
public $token;
|
32 |
+
public $active;
|
33 |
+
public $updated;
|
34 |
+
public $created;
|
35 |
+
}
|
36 |
+
|
37 |
+
class CreateTokenRequest
|
38 |
+
{
|
39 |
+
public $name;
|
40 |
+
public $active;
|
41 |
+
|
42 |
+
public function __construct($name = null, $active = null){
|
43 |
+
$this->name = $name;
|
44 |
+
$this->active = $active;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/entities/userticket.class.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
class CreateUserTicket
|
28 |
+
{
|
29 |
+
public $expire;
|
30 |
+
public $path;
|
31 |
+
|
32 |
+
public function __construct($expire = null, $path = null){
|
33 |
+
if($expire != null){
|
34 |
+
$this->expire = (int)$expire;
|
35 |
+
}
|
36 |
+
if($path != null){
|
37 |
+
$this->path = $path;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
class TicketDetails
|
43 |
+
{
|
44 |
+
public $id;
|
45 |
+
public $sso_url;
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/integrationservice.class.php
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
$relative_path = dirname(__FILE__);
|
28 |
+
|
29 |
+
// Include service contract
|
30 |
+
require_once($relative_path . "/integrationservice.interface.php");
|
31 |
+
|
32 |
+
// Include entities
|
33 |
+
require_once($relative_path . "/entities/serviceresponse.class.php");
|
34 |
+
require_once($relative_path . "/entities/integration.class.php");
|
35 |
+
|
36 |
+
// Include exceptions
|
37 |
+
require_once($relative_path . "/exceptions/alphamailserviceexception.class.php");
|
38 |
+
require_once($relative_path . "/exceptions/alphamailauthorizationexception.class.php");
|
39 |
+
require_once($relative_path . "/exceptions/alphamailinternalexception.class.php");
|
40 |
+
require_once($relative_path . "/exceptions/alphamailvalidationexception.class.php");
|
41 |
+
|
42 |
+
// Include restful client
|
43 |
+
require_once($relative_path . "/../comfirm.services.client.rest/restful.class.php");
|
44 |
+
|
45 |
+
class AlphaMailIntegrationService implements IIntegrationService
|
46 |
+
{
|
47 |
+
private $_client = null;
|
48 |
+
private $_service_url = null;
|
49 |
+
|
50 |
+
protected function __construct()
|
51 |
+
{
|
52 |
+
$this->_client = new Restful();
|
53 |
+
}
|
54 |
+
|
55 |
+
public static function create()
|
56 |
+
{
|
57 |
+
return new AlphaMailIntegrationService();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function setServiceUrl($service_url)
|
61 |
+
{
|
62 |
+
$this->_service_url = $service_url;
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function setApiToken($api_token)
|
67 |
+
{
|
68 |
+
$this->_api_token = $api_token;
|
69 |
+
$this->_client->setBasicAuthentication(null, $api_token);
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function createNew($name, $metadata)
|
74 |
+
{
|
75 |
+
$response = null;
|
76 |
+
|
77 |
+
$request = new CreateIntegrationRequest();
|
78 |
+
$request->name = $name;
|
79 |
+
$request->metadata = $metadata;
|
80 |
+
|
81 |
+
try
|
82 |
+
{
|
83 |
+
$raw_response = $this->_client->post($this->_service_url . "/integrations", json_encode($request));
|
84 |
+
$response = $this->cast($raw_response->result, "Integration");
|
85 |
+
$this->handleErrors($raw_response);
|
86 |
+
}
|
87 |
+
catch(AlphaMailServiceException $exception)
|
88 |
+
{
|
89 |
+
throw $exception;
|
90 |
+
}
|
91 |
+
catch(Exception $exception)
|
92 |
+
{
|
93 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
94 |
+
}
|
95 |
+
|
96 |
+
return $response->result;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getAll()
|
100 |
+
{
|
101 |
+
$response = null;
|
102 |
+
|
103 |
+
try
|
104 |
+
{
|
105 |
+
$raw_response = $this->_client->get($this->_service_url . "/integrations");
|
106 |
+
$response = $this->cast($raw_response->result, "ServiceResponse");
|
107 |
+
|
108 |
+
if(is_array($response->result)){
|
109 |
+
foreach($response->result as $key => $value){
|
110 |
+
$response->result[$key] = $this->cast($value, "Integration");
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->handleErrors($raw_response);
|
115 |
+
}
|
116 |
+
catch(AlphaMailServiceException $exception)
|
117 |
+
{
|
118 |
+
throw $exception;
|
119 |
+
}
|
120 |
+
catch(Exception $exception)
|
121 |
+
{
|
122 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
123 |
+
}
|
124 |
+
|
125 |
+
return $response->result;
|
126 |
+
}
|
127 |
+
|
128 |
+
public function connectToken($integration_id, $token_id){
|
129 |
+
$response = null;
|
130 |
+
|
131 |
+
$request = new ConnectIntegrationTokenRequest();
|
132 |
+
$request->token_id = $token_id;
|
133 |
+
|
134 |
+
try
|
135 |
+
{
|
136 |
+
$raw_response = $this->_client->put($this->_service_url . "/integrations/" . $integration_id . "/tokens", json_encode($request));
|
137 |
+
$response = $this->cast($raw_response->result, "stdClass");
|
138 |
+
$this->handleErrors($raw_response);
|
139 |
+
}
|
140 |
+
catch(AlphaMailServiceException $exception)
|
141 |
+
{
|
142 |
+
throw $exception;
|
143 |
+
}
|
144 |
+
catch(Exception $exception)
|
145 |
+
{
|
146 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
147 |
+
}
|
148 |
+
|
149 |
+
return $response->result;
|
150 |
+
}
|
151 |
+
|
152 |
+
private function handleErrors($response)
|
153 |
+
{
|
154 |
+
switch ($response->head->status->code)
|
155 |
+
{
|
156 |
+
// Successful requests
|
157 |
+
case 202: // Accepted:
|
158 |
+
case 201: // Created:
|
159 |
+
case 200: // OK:
|
160 |
+
if ($response->result->error_code != 0){
|
161 |
+
throw new AlphaMailInternalException(
|
162 |
+
sprintf("Service returned success while response error code was set (%d)", $response->result->error_code),
|
163 |
+
$response->head->status,
|
164 |
+
$response->result,
|
165 |
+
null
|
166 |
+
);
|
167 |
+
}
|
168 |
+
break;
|
169 |
+
|
170 |
+
// Unauthorized
|
171 |
+
case 403: // Forbidden:
|
172 |
+
case 401: // Unauthorized:
|
173 |
+
throw new AlphaMailAuthorizationException(
|
174 |
+
$response->result->message,
|
175 |
+
$response->head->status,
|
176 |
+
$response->result,
|
177 |
+
null
|
178 |
+
);
|
179 |
+
|
180 |
+
// Validation error
|
181 |
+
case 405: // MethodNotAllowed:
|
182 |
+
case 404: // MethodNotAllowed:
|
183 |
+
case 400: // BadRequest:
|
184 |
+
case 422: // Unprocessable Entity:
|
185 |
+
throw new AlphaMailValidationException(
|
186 |
+
$response->result->message,
|
187 |
+
$response->head->status,
|
188 |
+
$response->result,
|
189 |
+
null
|
190 |
+
);
|
191 |
+
|
192 |
+
// Internal error
|
193 |
+
case 500: // InternalServerError
|
194 |
+
throw new AlphaMailInternalException(
|
195 |
+
$response->result->message,
|
196 |
+
$response->head->status,
|
197 |
+
$response->result,
|
198 |
+
null
|
199 |
+
);
|
200 |
+
|
201 |
+
// Unknown
|
202 |
+
default:
|
203 |
+
throw new AlphaMailServiceException(
|
204 |
+
$response->result->message,
|
205 |
+
$response->head->status,
|
206 |
+
$response->result,
|
207 |
+
null
|
208 |
+
);
|
209 |
+
}
|
210 |
+
|
211 |
+
return $response;
|
212 |
+
}
|
213 |
+
|
214 |
+
// Object-casting-hack :)
|
215 |
+
private function cast($source, $destination)
|
216 |
+
{
|
217 |
+
$result = null;
|
218 |
+
|
219 |
+
if(@class_exists($destination))
|
220 |
+
{
|
221 |
+
$serialized = @serialize($source);
|
222 |
+
|
223 |
+
$result = @unserialize('O:' . strlen($destination) . ':"' . $destination . '":' .
|
224 |
+
substr($serialized, $serialized[2] + 7));
|
225 |
+
|
226 |
+
if($result === false)
|
227 |
+
throw new Exception("Unable to cast object to type '" . $destination . "'");
|
228 |
+
}
|
229 |
+
else
|
230 |
+
{
|
231 |
+
return false;
|
232 |
+
}
|
233 |
+
|
234 |
+
return $result;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/integrationservice.interface.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Represents a integration service used for creating and handling integrations
|
29 |
+
*/
|
30 |
+
interface IIntegrationService
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Create a new integration
|
34 |
+
*/
|
35 |
+
function createNew($name, $metadata);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get all tokens
|
39 |
+
*/
|
40 |
+
function getAll();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Connect token to an integration
|
44 |
+
*/
|
45 |
+
function connectToken($integration_id, $token_id);
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/projectservice.class.php
CHANGED
@@ -79,8 +79,10 @@
|
|
79 |
$raw_response = $this->_client->get($this->_service_url . "/projects");
|
80 |
$response = $this->cast($raw_response->result, "ServiceResponse");
|
81 |
|
82 |
-
|
83 |
-
$response->result
|
|
|
|
|
84 |
}
|
85 |
|
86 |
$this->handleErrors($raw_response);
|
79 |
$raw_response = $this->_client->get($this->_service_url . "/projects");
|
80 |
$response = $this->cast($raw_response->result, "ServiceResponse");
|
81 |
|
82 |
+
if(is_array($response->result)){
|
83 |
+
foreach($response->result as $key => $value){
|
84 |
+
$response->result[$key] = $this->cast($value, "Project");
|
85 |
+
}
|
86 |
}
|
87 |
|
88 |
$this->handleErrors($raw_response);
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/tokenservice.class.php
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
$relative_path = dirname(__FILE__);
|
28 |
+
|
29 |
+
// Include service contract
|
30 |
+
require_once($relative_path . "/tokenservice.interface.php");
|
31 |
+
|
32 |
+
// Include entities
|
33 |
+
require_once($relative_path . "/entities/serviceresponse.class.php");
|
34 |
+
require_once($relative_path . "/entities/token.class.php");
|
35 |
+
|
36 |
+
// Include exceptions
|
37 |
+
require_once($relative_path . "/exceptions/alphamailserviceexception.class.php");
|
38 |
+
require_once($relative_path . "/exceptions/alphamailauthorizationexception.class.php");
|
39 |
+
require_once($relative_path . "/exceptions/alphamailinternalexception.class.php");
|
40 |
+
require_once($relative_path . "/exceptions/alphamailvalidationexception.class.php");
|
41 |
+
|
42 |
+
// Include restful client
|
43 |
+
require_once($relative_path . "/../comfirm.services.client.rest/restful.class.php");
|
44 |
+
|
45 |
+
class AlphaMailTokenService implements ITokenService
|
46 |
+
{
|
47 |
+
private $_client = null;
|
48 |
+
private $_service_url = null;
|
49 |
+
|
50 |
+
protected function __construct()
|
51 |
+
{
|
52 |
+
$this->_client = new Restful();
|
53 |
+
}
|
54 |
+
|
55 |
+
public static function create()
|
56 |
+
{
|
57 |
+
return new AlphaMailTokenService();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function setServiceUrl($service_url)
|
61 |
+
{
|
62 |
+
$this->_service_url = $service_url;
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function setApiToken($api_token)
|
67 |
+
{
|
68 |
+
$this->_api_token = $api_token;
|
69 |
+
$this->_client->setBasicAuthentication(null, $api_token);
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function createNew($name, $active)
|
74 |
+
{
|
75 |
+
$response = null;
|
76 |
+
|
77 |
+
$request = new CreateTokenRequest();
|
78 |
+
$request->name = $name;
|
79 |
+
$request->active = $active;
|
80 |
+
|
81 |
+
try
|
82 |
+
{
|
83 |
+
$raw_response = $this->_client->post($this->_service_url . "/tokens", json_encode($request));
|
84 |
+
$response = $this->cast($raw_response->result, "Token");
|
85 |
+
$this->handleErrors($raw_response);
|
86 |
+
}
|
87 |
+
catch(AlphaMailServiceException $exception)
|
88 |
+
{
|
89 |
+
throw $exception;
|
90 |
+
}
|
91 |
+
catch(Exception $exception)
|
92 |
+
{
|
93 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
94 |
+
}
|
95 |
+
|
96 |
+
return $response->result;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getSingle($token_id)
|
100 |
+
{
|
101 |
+
$response = null;
|
102 |
+
|
103 |
+
try
|
104 |
+
{
|
105 |
+
$raw_response = $this->_client->get($this->_service_url . "/tokens/" . $token_id);
|
106 |
+
$response = $this->cast($raw_response->result, "Token");
|
107 |
+
$this->handleErrors($raw_response);
|
108 |
+
}
|
109 |
+
catch(AlphaMailServiceException $exception)
|
110 |
+
{
|
111 |
+
throw $exception;
|
112 |
+
}
|
113 |
+
catch(Exception $exception)
|
114 |
+
{
|
115 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
116 |
+
}
|
117 |
+
|
118 |
+
return $response->result;
|
119 |
+
}
|
120 |
+
|
121 |
+
public function getAll()
|
122 |
+
{
|
123 |
+
$response = null;
|
124 |
+
|
125 |
+
try
|
126 |
+
{
|
127 |
+
$raw_response = $this->_client->get($this->_service_url . "/tokens");
|
128 |
+
$response = $this->cast($raw_response->result, "ServiceResponse");
|
129 |
+
|
130 |
+
if(is_array($response->result)){
|
131 |
+
foreach($response->result as $key => $value){
|
132 |
+
$response->result[$key] = $this->cast($value, "Token");
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
$this->handleErrors($raw_response);
|
137 |
+
}
|
138 |
+
catch(AlphaMailServiceException $exception)
|
139 |
+
{
|
140 |
+
throw $exception;
|
141 |
+
}
|
142 |
+
catch(Exception $exception)
|
143 |
+
{
|
144 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
145 |
+
}
|
146 |
+
|
147 |
+
return $response->result;
|
148 |
+
}
|
149 |
+
|
150 |
+
private function handleErrors($response)
|
151 |
+
{
|
152 |
+
switch ($response->head->status->code)
|
153 |
+
{
|
154 |
+
// Successful requests
|
155 |
+
case 202: // Accepted:
|
156 |
+
case 201: // Created:
|
157 |
+
case 200: // OK:
|
158 |
+
if ($response->result->error_code != 0){
|
159 |
+
throw new AlphaMailInternalException(
|
160 |
+
sprintf("Service returned success while response error code was set (%d)", $response->result->error_code),
|
161 |
+
$response->head->status,
|
162 |
+
$response->result,
|
163 |
+
null
|
164 |
+
);
|
165 |
+
}
|
166 |
+
break;
|
167 |
+
|
168 |
+
// Unauthorized
|
169 |
+
case 403: // Forbidden:
|
170 |
+
case 401: // Unauthorized:
|
171 |
+
throw new AlphaMailAuthorizationException(
|
172 |
+
$response->result->message,
|
173 |
+
$response->head->status,
|
174 |
+
$response->result,
|
175 |
+
null
|
176 |
+
);
|
177 |
+
|
178 |
+
// Validation error
|
179 |
+
case 405: // MethodNotAllowed:
|
180 |
+
case 404: // MethodNotAllowed:
|
181 |
+
case 400: // BadRequest:
|
182 |
+
case 422: // Unprocessable Entity:
|
183 |
+
throw new AlphaMailValidationException(
|
184 |
+
$response->result->message,
|
185 |
+
$response->head->status,
|
186 |
+
$response->result,
|
187 |
+
null
|
188 |
+
);
|
189 |
+
|
190 |
+
// Internal error
|
191 |
+
case 500: // InternalServerError
|
192 |
+
throw new AlphaMailInternalException(
|
193 |
+
$response->result->message,
|
194 |
+
$response->head->status,
|
195 |
+
$response->result,
|
196 |
+
null
|
197 |
+
);
|
198 |
+
|
199 |
+
// Unknown
|
200 |
+
default:
|
201 |
+
throw new AlphaMailServiceException(
|
202 |
+
$response->result->message,
|
203 |
+
$response->head->status,
|
204 |
+
$response->result,
|
205 |
+
null
|
206 |
+
);
|
207 |
+
}
|
208 |
+
|
209 |
+
return $response;
|
210 |
+
}
|
211 |
+
|
212 |
+
// Object-casting-hack :)
|
213 |
+
private function cast($source, $destination)
|
214 |
+
{
|
215 |
+
$result = null;
|
216 |
+
|
217 |
+
if(@class_exists($destination))
|
218 |
+
{
|
219 |
+
$serialized = @serialize($source);
|
220 |
+
|
221 |
+
$result = @unserialize('O:' . strlen($destination) . ':"' . $destination . '":' .
|
222 |
+
substr($serialized, $serialized[2] + 7));
|
223 |
+
|
224 |
+
if($result === false)
|
225 |
+
throw new Exception("Unable to cast object to type '" . $destination . "'");
|
226 |
+
}
|
227 |
+
else
|
228 |
+
{
|
229 |
+
return false;
|
230 |
+
}
|
231 |
+
|
232 |
+
return $result;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/tokenservice.interface.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Represents a token service used for creating and handling tokens
|
29 |
+
*/
|
30 |
+
interface ITokenService
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Create a new token
|
34 |
+
*/
|
35 |
+
function createNew($name, $active);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get all tokens
|
39 |
+
*/
|
40 |
+
function getAll();
|
41 |
+
}
|
42 |
+
|
43 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.alphamail.client/userticketservice.class.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
The MIT License
|
5 |
+
|
6 |
+
Copyright (c) 2011 Comfirm <http://www.comfirm.se/>
|
7 |
+
|
8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
of this software and associated documentation files (the "Software"), to deal
|
10 |
+
in the Software without restriction, including without limitation the rights
|
11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
copies of the Software, and to permit persons to whom the Software is
|
13 |
+
furnished to do so, subject to the following conditions:
|
14 |
+
|
15 |
+
The above copyright notice and this permission notice shall be included in
|
16 |
+
all copies or substantial portions of the Software.
|
17 |
+
|
18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
$relative_path = dirname(__FILE__);
|
28 |
+
|
29 |
+
// Include entities
|
30 |
+
require_once($relative_path . "/entities/serviceresponse.class.php");
|
31 |
+
require_once($relative_path . "/entities/userticket.class.php");
|
32 |
+
|
33 |
+
// Include exceptions
|
34 |
+
require_once($relative_path . "/exceptions/alphamailserviceexception.class.php");
|
35 |
+
require_once($relative_path . "/exceptions/alphamailauthorizationexception.class.php");
|
36 |
+
require_once($relative_path . "/exceptions/alphamailinternalexception.class.php");
|
37 |
+
require_once($relative_path . "/exceptions/alphamailvalidationexception.class.php");
|
38 |
+
|
39 |
+
// Include restful client
|
40 |
+
require_once($relative_path . "/../comfirm.services.client.rest/restful.class.php");
|
41 |
+
|
42 |
+
class AlphaMailUserTicketService
|
43 |
+
{
|
44 |
+
private $_client = null;
|
45 |
+
private $_service_url = null, $_api_token;
|
46 |
+
|
47 |
+
protected function __construct()
|
48 |
+
{
|
49 |
+
$this->_client = new Restful();
|
50 |
+
}
|
51 |
+
|
52 |
+
public static function create()
|
53 |
+
{
|
54 |
+
return new AlphaMailUserTicketService();
|
55 |
+
}
|
56 |
+
|
57 |
+
public function setServiceUrl($service_url)
|
58 |
+
{
|
59 |
+
$this->_service_url = $service_url;
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function setApiToken($api_token)
|
64 |
+
{
|
65 |
+
$this->_api_token = $api_token;
|
66 |
+
$this->_client->setBasicAuthentication(null, $api_token);
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function createNew($ticket = null)
|
71 |
+
{
|
72 |
+
$response = null;
|
73 |
+
|
74 |
+
if($ticket == null){
|
75 |
+
$ticket = new CreateUserTicket();
|
76 |
+
}
|
77 |
+
|
78 |
+
try
|
79 |
+
{
|
80 |
+
$raw_response = $this->_client->post($this->_service_url . "/user/tickets/", json_encode($ticket));
|
81 |
+
$this->handleErrors($raw_response);
|
82 |
+
$response = $this->cast($raw_response->result, "ServiceResponse");
|
83 |
+
}
|
84 |
+
catch(AlphaMailServiceException $exception)
|
85 |
+
{
|
86 |
+
throw $exception;
|
87 |
+
}
|
88 |
+
catch(Exception $exception)
|
89 |
+
{
|
90 |
+
throw new AlphaMailServiceException($exception->getMessage(), null, null, $exception);
|
91 |
+
}
|
92 |
+
|
93 |
+
return $response->result;
|
94 |
+
}
|
95 |
+
|
96 |
+
private function handleErrors($response)
|
97 |
+
{
|
98 |
+
switch ($response->head->status->code)
|
99 |
+
{
|
100 |
+
// Successful requests
|
101 |
+
case 202: // Accepted:
|
102 |
+
case 201: // Created:
|
103 |
+
case 200: // OK:
|
104 |
+
if ($response->result->error_code != 0){
|
105 |
+
throw new AlphaMailInternalException(
|
106 |
+
sprintf("Service returned success while response error code was set (%d)", $response->result->error_code),
|
107 |
+
$response->head->status,
|
108 |
+
$response->result,
|
109 |
+
null
|
110 |
+
);
|
111 |
+
}
|
112 |
+
break;
|
113 |
+
|
114 |
+
// Unauthorized
|
115 |
+
case 403: // Forbidden:
|
116 |
+
case 401: // Unauthorized:
|
117 |
+
throw new AlphaMailAuthorizationException(
|
118 |
+
$response->result->message,
|
119 |
+
$response->head->status,
|
120 |
+
$response->result,
|
121 |
+
null
|
122 |
+
);
|
123 |
+
|
124 |
+
// Validation error
|
125 |
+
case 405: // MethodNotAllowed:
|
126 |
+
case 400: // BadRequest:
|
127 |
+
throw new AlphaMailValidationException(
|
128 |
+
$response->result->message,
|
129 |
+
$response->head->status,
|
130 |
+
$response->result,
|
131 |
+
null
|
132 |
+
);
|
133 |
+
|
134 |
+
// Internal error
|
135 |
+
case 500: // InternalServerError
|
136 |
+
throw new AlphaMailInternalException(
|
137 |
+
$response->result->message,
|
138 |
+
$response->head->status,
|
139 |
+
$response->result,
|
140 |
+
null
|
141 |
+
);
|
142 |
+
|
143 |
+
// Unknown
|
144 |
+
default:
|
145 |
+
throw new AlphaMailServiceException(
|
146 |
+
$response->result->message,
|
147 |
+
$response->head->status,
|
148 |
+
$response->result,
|
149 |
+
null
|
150 |
+
);
|
151 |
+
}
|
152 |
+
|
153 |
+
return $response;
|
154 |
+
}
|
155 |
+
|
156 |
+
// Object-casting-hack :)
|
157 |
+
private function cast($source, $destination)
|
158 |
+
{
|
159 |
+
$result = null;
|
160 |
+
|
161 |
+
if(@class_exists($destination))
|
162 |
+
{
|
163 |
+
$serialized = @serialize($source);
|
164 |
+
|
165 |
+
$result = @unserialize('O:' . strlen($destination) . ':"' . $destination . '":' .
|
166 |
+
substr($serialized, $serialized[2] + 7));
|
167 |
+
|
168 |
+
if($result === false)
|
169 |
+
throw new Exception("Unable to cast object to type '" . $destination . "'");
|
170 |
+
}
|
171 |
+
else
|
172 |
+
{
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
|
176 |
+
return $result;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
?>
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.services.client.rest/httprequest/httppacketparser.class.php
CHANGED
@@ -43,7 +43,7 @@
|
|
43 |
public function parse($raw_packet)
|
44 |
{
|
45 |
// Init vars
|
46 |
-
$
|
47 |
|
48 |
// Seperate header from body, and append parsed data to object
|
49 |
$content = $this->separateHeaderFromBody($raw_packet);
|
43 |
public function parse($raw_packet)
|
44 |
{
|
45 |
// Init vars
|
46 |
+
$package = (object)null;
|
47 |
|
48 |
// Seperate header from body, and append parsed data to object
|
49 |
$content = $this->separateHeaderFromBody($raw_packet);
|
app/code/community/Comfirm/AlphaMail/libraries/comfirm.services.client.rest/restful.class.php
CHANGED
@@ -65,6 +65,7 @@
|
|
65 |
private function getHeaderCollection()
|
66 |
{
|
67 |
$headers = new HttpHeaderCollection();
|
|
|
68 |
$headers->add(new HttpHeaderItem("Accept-Encoding", "gzip, deflate, chunked"));
|
69 |
return $headers;
|
70 |
}
|
65 |
private function getHeaderCollection()
|
66 |
{
|
67 |
$headers = new HttpHeaderCollection();
|
68 |
+
$headers->add(new HttpHeaderItem("Content-Type", "application/json"));
|
69 |
$headers->add(new HttpHeaderItem("Accept-Encoding", "gzip, deflate, chunked"));
|
70 |
return $headers;
|
71 |
}
|
app/code/community/Comfirm/AlphaMail/sql/alphamail_setup/mysql4-install-1.1.7.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$this->startSetup();
|
4 |
-
|
5 |
-
Mage::log("Creating tables for AlphaMail..");
|
6 |
-
|
7 |
-
Mage::log("Creating Send Log table");
|
8 |
-
|
9 |
-
$this->run(
|
10 |
-
"CREATE TABLE `{$this->getTable('alphamail_send_log')}` (
|
11 |
-
`send_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
-
`am_queue_id` varchar(128) DEFAULT NULL,
|
13 |
-
`raw_payload` text,
|
14 |
-
`status` tinyint(2) NOT NULL DEFAULT '0',
|
15 |
-
`sent_at` timestamp NULL DEFAULT NULL,
|
16 |
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
17 |
-
PRIMARY KEY (`send_id`)
|
18 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
19 |
-
);
|
20 |
-
|
21 |
-
Mage::log("Creating Event Log table");
|
22 |
-
|
23 |
-
$this->run(
|
24 |
-
"CREATE TABLE `{$this->getTable('alphamail_event_log')}` (
|
25 |
-
`event_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
26 |
-
`send_id` int(10) DEFAULT NULL,
|
27 |
-
`message` varchar(4096) NOT NULL,
|
28 |
-
`type` tinyint(2) NOT NULL,
|
29 |
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
30 |
-
PRIMARY KEY (`event_id`),
|
31 |
-
KEY `created_at` (`created_at`)
|
32 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
33 |
-
);
|
34 |
-
|
35 |
-
Mage::log("Creating Project Map table");
|
36 |
-
|
37 |
-
$this->run(
|
38 |
-
"CREATE TABLE `{$this->getTable('alphamail_project_map')}` (
|
39 |
-
`project_map_id` int(10) NOT NULL AUTO_INCREMENT,
|
40 |
-
`am_project_id` int(10) NOT NULL DEFAULT '0',
|
41 |
-
`template_name` varchar(128) NOT NULL,
|
42 |
-
PRIMARY KEY (`project_map_id`),
|
43 |
-
UNIQUE KEY `template_name` (`template_name`)
|
44 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
45 |
-
);
|
46 |
-
|
47 |
-
$this->endSetup();
|
48 |
-
|
49 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Comfirm/AlphaMail/sql/alphamail_setup/mysql4-install-1.5.0.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$this->startSetup();
|
4 |
+
|
5 |
+
Mage::log("Creating tables for AlphaMail...");
|
6 |
+
|
7 |
+
Mage::log("Dropping any existing tables...");
|
8 |
+
$this->run("DROP TABLE IF EXISTS `{$this->getTable('alphamail_send_log')}`");
|
9 |
+
$this->run("DROP TABLE IF EXISTS `{$this->getTable('alphamail_event_log')}`");
|
10 |
+
$this->run("DROP TABLE IF EXISTS `{$this->getTable('alphamail_project_map')}`");
|
11 |
+
|
12 |
+
Mage::log("Creating Send Log table");
|
13 |
+
|
14 |
+
$this->run(
|
15 |
+
"CREATE TABLE `{$this->getTable('alphamail_send_log')}` (
|
16 |
+
`send_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
17 |
+
`am_queue_id` varchar(128) DEFAULT NULL,
|
18 |
+
`template_name` varchar(128) DEFAULT NULL,
|
19 |
+
`raw_payload` text,
|
20 |
+
`status` tinyint(2) NOT NULL DEFAULT '0',
|
21 |
+
`sent_at` timestamp NULL DEFAULT NULL,
|
22 |
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
23 |
+
PRIMARY KEY (`send_id`)
|
24 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
25 |
+
);
|
26 |
+
|
27 |
+
Mage::log("Creating Event Log table");
|
28 |
+
|
29 |
+
$this->run(
|
30 |
+
"CREATE TABLE `{$this->getTable('alphamail_event_log')}` (
|
31 |
+
`event_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
32 |
+
`send_id` int(10) DEFAULT NULL,
|
33 |
+
`message` varchar(4096) NOT NULL,
|
34 |
+
`type` tinyint(2) NOT NULL,
|
35 |
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
36 |
+
PRIMARY KEY (`event_id`),
|
37 |
+
KEY `created_at` (`created_at`)
|
38 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
39 |
+
);
|
40 |
+
|
41 |
+
Mage::log("Creating Project Map table");
|
42 |
+
|
43 |
+
$this->run(
|
44 |
+
"CREATE TABLE `{$this->getTable('alphamail_project_map')}` (
|
45 |
+
`project_map_id` int(10) NOT NULL AUTO_INCREMENT,
|
46 |
+
`am_project_id` int(10) NOT NULL DEFAULT '0',
|
47 |
+
`template_name` varchar(128) NOT NULL,
|
48 |
+
PRIMARY KEY (`project_map_id`),
|
49 |
+
UNIQUE KEY `template_name` (`template_name`)
|
50 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
51 |
+
);
|
52 |
+
|
53 |
+
$this->endSetup();
|
54 |
+
|
55 |
+
?>
|
app/design/adminhtml/default/default/layout/alphamail.xml
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
|
|
|
|
|
|
|
|
|
|
3 |
<adminhtml_system_config_edit>
|
4 |
<reference name="content">
|
5 |
<block type="alphamail/adminhtml_system_config_wrapper" name="alphamail.test.results" template="alphamail/system/config.phtml" before="-"></block>
|
6 |
</reference>
|
7 |
-
<!--reference name="before_body_end">
|
8 |
-
<block type="alphamail/adminhtml_template" name="alphamail.config.js" template="alphamail/config/js.phtml" after="-" />
|
9 |
-
</reference-->
|
10 |
</adminhtml_system_config_edit>
|
11 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="notifications">
|
5 |
+
<block type="alphamail/adminhtml_notifications" name="alphamail_notifications" as="alphamail_notifications" />
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
<adminhtml_system_config_edit>
|
9 |
<reference name="content">
|
10 |
<block type="alphamail/adminhtml_system_config_wrapper" name="alphamail.test.results" template="alphamail/system/config.phtml" before="-"></block>
|
11 |
</reference>
|
|
|
|
|
|
|
12 |
</adminhtml_system_config_edit>
|
13 |
</layout>
|
app/design/adminhtml/default/default/template/alphamail/connect/completed.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $admin_helper = Mage::helper("adminhtml"); ?>
|
2 |
+
|
3 |
+
<form id="alphamail-login-form" action="<?php echo($this->getUrl('*/*/TryLogin/')) ?>" method="post">
|
4 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
5 |
+
<div id="page:main-container">
|
6 |
+
<div class="entry-edit">
|
7 |
+
<div class="entry-edit-head">
|
8 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Congratulations!</h4>
|
9 |
+
<div class="form-buttons">
|
10 |
+
</div>
|
11 |
+
</div>
|
12 |
+
<div class="fieldset fieldset-wide" id="base_fieldset">
|
13 |
+
<div class="hor-scroll">
|
14 |
+
<table cellspacing="0" class="form-list">
|
15 |
+
<tbody>
|
16 |
+
<tr>
|
17 |
+
<td class="label">
|
18 |
+
<p>Magento has successfully connected to AlphaMail.</p>
|
19 |
+
<p>Start by heading to configuration and activate the module.</p>
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
<tr>
|
23 |
+
<td class="label">
|
24 |
+
<button type="button" class="scalable" onclick="window.location='<?php echo($admin_helper->getUrl("adminhtml/system_config/edit/section/alphamail")) ?>';">
|
25 |
+
<span>Show Configuration</span>
|
26 |
+
</button>
|
27 |
+
|
28 |
+
<i>or</i>
|
29 |
+
|
30 |
+
<button type="button" class="scalable" onclick="window.location='<?php echo($admin_helper->getUrl("alphamail/SingleSignOn")) ?>';">
|
31 |
+
<span>Show AlphaMail Dashboard</span>
|
32 |
+
</button>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
</tbody>
|
36 |
+
</table>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</form>
|
app/design/adminhtml/default/default/template/alphamail/connect/login.phtml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
var loginForm = null;
|
3 |
+
|
4 |
+
function submitLoginForm(button){
|
5 |
+
if(loginForm && loginForm.validator.validate()){
|
6 |
+
button.addClassName("disabled");
|
7 |
+
button.innerHTML = "<span>Please wait...</span>";
|
8 |
+
loginForm.submit();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
(function() {
|
13 |
+
var initializeLoginForm = function() {
|
14 |
+
loginForm = new VarienForm('alphamail-login-form', true);
|
15 |
+
};
|
16 |
+
if(document.loaded){
|
17 |
+
initializeLoginForm();
|
18 |
+
}else{
|
19 |
+
document.observe('dom:loaded', initializeLoginForm);
|
20 |
+
}
|
21 |
+
})();
|
22 |
+
</script>
|
23 |
+
|
24 |
+
<form id="alphamail-login-form" action="<?php echo($this->getUrl('*/*/TryLogin/')) ?>" method="post">
|
25 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
26 |
+
<div id="page:main-container">
|
27 |
+
<div class="content-header">
|
28 |
+
<table cellspacing="0">
|
29 |
+
<tr>
|
30 |
+
<td><h3>Connect your AlphaMail Account</h3></td>
|
31 |
+
<td class="form-buttons">
|
32 |
+
<button type="button" class="scalable back" onclick="history.back();">
|
33 |
+
<span>Back</span>
|
34 |
+
</button>
|
35 |
+
<button type="button" class="scalable save" onclick="submitLoginForm(this);">
|
36 |
+
<span>Connect Account</span>
|
37 |
+
</button>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
</table>
|
41 |
+
</div>
|
42 |
+
<div class="entry-edit">
|
43 |
+
<div class="entry-edit-head">
|
44 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Login Details</h4>
|
45 |
+
<div class="form-buttons">
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<div class="fieldset fieldset-wide" id="base_fieldset">
|
49 |
+
<div class="hor-scroll">
|
50 |
+
<table cellspacing="0" class="form-list">
|
51 |
+
<tbody>
|
52 |
+
<tr>
|
53 |
+
<td class="label">
|
54 |
+
<label for="username">Username/Email <span class="required">*</span></label>
|
55 |
+
</td>
|
56 |
+
<td class="value">
|
57 |
+
<input id="username" name="username" value="<?php echo($username) ?>" title="Username" type="text" class="input-text required-entry" placeholder="e.g. your@email.com">
|
58 |
+
<?php if(array_key_exists("username", $errors)){ ?>
|
59 |
+
<div class="validation-advice" id="advice-required-entry-username" style=""><?php echo($errors["username"]) ?></div>
|
60 |
+
<?php } ?>
|
61 |
+
</td>
|
62 |
+
</tr>
|
63 |
+
<tr>
|
64 |
+
<td class="label">
|
65 |
+
<label for="password">Password <span class="required">*</span></label>
|
66 |
+
</td>
|
67 |
+
<td class="value">
|
68 |
+
<input id="password" name="password" value="<?php echo($password) ?>" title="Password" type="password" class="input-text required-entry">
|
69 |
+
<?php if(array_key_exists("password", $errors)){ ?>
|
70 |
+
<div class="validation-advice" id="advice-required-entry-password" style=""><?php echo($errors["password"]) ?></div>
|
71 |
+
<?php } ?>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
</tbody>
|
75 |
+
</table>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
</form>
|
app/design/adminhtml/default/default/template/alphamail/connect/registration.phtml
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
var registrationForm = null;
|
3 |
+
|
4 |
+
function submitRegistrationForm(button){
|
5 |
+
if(registrationForm && registrationForm.validator.validate()){
|
6 |
+
button.addClassName("disabled");
|
7 |
+
button.innerHTML = "<span>Please wait...</span>";
|
8 |
+
registrationForm.submit();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
(function() {
|
13 |
+
var initializeRegistrationForm = function() {
|
14 |
+
registrationForm = new VarienForm('alphamail-registration-form', true);
|
15 |
+
};
|
16 |
+
if(document.loaded){
|
17 |
+
initializeRegistrationForm();
|
18 |
+
}else{
|
19 |
+
document.observe('dom:loaded', initializeRegistrationForm);
|
20 |
+
}
|
21 |
+
})();
|
22 |
+
</script>
|
23 |
+
|
24 |
+
<form id="alphamail-registration-form" action="<?php echo($this->getUrl('*/*/CreateAccount/')) ?>" method="post">
|
25 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
26 |
+
<div id="page:main-container">
|
27 |
+
<div class="content-header">
|
28 |
+
<table cellspacing="0">
|
29 |
+
<tr>
|
30 |
+
<td><h3>Create New AlphaMail Account</h3></td>
|
31 |
+
<td class="form-buttons">
|
32 |
+
<button type="button" class="scalable back" onclick="history.back();">
|
33 |
+
<span>Back</span>
|
34 |
+
</button>
|
35 |
+
<button type="button" class="scalable save" onclick="submitRegistrationForm(this);">
|
36 |
+
<span>Create Account</span>
|
37 |
+
</button>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
</table>
|
41 |
+
</div>
|
42 |
+
<div class="entry-edit">
|
43 |
+
<div class="entry-edit-head">
|
44 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Account Details</h4>
|
45 |
+
<div class="form-buttons">
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<div class="fieldset fieldset-wide" id="base_fieldset">
|
49 |
+
<div class="hor-scroll">
|
50 |
+
<table cellspacing="0" class="form-list">
|
51 |
+
<tbody>
|
52 |
+
<tr>
|
53 |
+
<td class="label">
|
54 |
+
<label for="fullname">Full name <span class="required">*</span></label>
|
55 |
+
</td>
|
56 |
+
<td class="value">
|
57 |
+
<input id="fullname" name="fullname" value="<?php echo($fullname) ?>" title="Full name" type="text" class="input-text required-entry" placeholder="e.g. John Doe">
|
58 |
+
<?php if(array_key_exists("fullname", $errors)){ ?>
|
59 |
+
<div class="validation-advice" id="advice-required-entry-fullname" style=""><?php echo($errors["fullname"]) ?></div>
|
60 |
+
<?php } ?>
|
61 |
+
</td>
|
62 |
+
</tr>
|
63 |
+
<tr>
|
64 |
+
<td class="label">
|
65 |
+
<label for="email">Email <span class="required">*</span></label>
|
66 |
+
</td>
|
67 |
+
<td class="value">
|
68 |
+
<input id="email" name="email" value="<?php echo($email) ?>" title="Email" type="text" class="input-text validate-email required-entry" placeholder="e.g. john@doe.com">
|
69 |
+
<?php if(array_key_exists("email", $errors)){ ?>
|
70 |
+
<div class="validation-advice" id="advice-required-entry-email" style=""><?php echo($errors["email"]) ?></div>
|
71 |
+
<?php } ?>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td class="label">
|
76 |
+
<label for="password">Password <span class="required">*</span></label>
|
77 |
+
</td>
|
78 |
+
<td class="value">
|
79 |
+
<input id="password" name="password" value="<?php echo($password) ?>" title="Password" type="password" class="input-text validate-password required-entry">
|
80 |
+
<?php if(array_key_exists("password", $errors)){ ?>
|
81 |
+
<div class="validation-advice" id="advice-required-entry-password" style=""><?php echo($errors["password"]) ?></div>
|
82 |
+
<?php } ?>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td class="label">
|
87 |
+
<label for="password_repeated">Repeat Password <span class="required">*</span></label>
|
88 |
+
</td>
|
89 |
+
<td class="value">
|
90 |
+
<input id="password_repeated" name="password_repeated" value="<?php echo($password_repeated) ?>" title="Password" type="password" class="input-text validate-cpassword required-entry">
|
91 |
+
<?php if(array_key_exists("password_repeated", $errors)){ ?>
|
92 |
+
<div class="validation-advice" id="advice-required-entry-password_repeated" style=""><?php echo($errors["password_repeated"]) ?></div>
|
93 |
+
<?php } ?>
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
<tr>
|
97 |
+
<td class="label">
|
98 |
+
<label for="captcha_value">Verify that you're a human <span class="required">*</span></label>
|
99 |
+
</td>
|
100 |
+
<td class="value">
|
101 |
+
<input id="captcha_value" name="captcha_value" value="<?php echo($captcha_value) ?>" title="Enter code below" type="text" class="input-text required-entry" placeholder="Enter the text displayed in the image below">
|
102 |
+
<?php if(array_key_exists("captcha_value", $errors)){ ?>
|
103 |
+
<div class="validation-advice" id="advice-required-entry-captcha_value" style=""><?php echo($errors["captcha_value"]) ?></div>
|
104 |
+
<?php } ?>
|
105 |
+
</td>
|
106 |
+
</tr>
|
107 |
+
<tr>
|
108 |
+
<td class="value"></td>
|
109 |
+
<td class="value">
|
110 |
+
<img src="<?php echo($captcha_image_url) ?>" style="border: 1px solid #aaaaaa;border-bottom-color: #c8c8c8; border-right-color: #c8c8c8;" />
|
111 |
+
</td>
|
112 |
+
</tr>
|
113 |
+
<tr>
|
114 |
+
<td class="value"></td>
|
115 |
+
<td class="value">
|
116 |
+
Too hard? <a href="<?php echo($this->getUrl('*/*/RenewCaptcha/')) ?>">Try another one</a>
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
</tbody>
|
120 |
+
</table>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
</form>
|
app/design/adminhtml/default/default/template/alphamail/logging/event_view.phtml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @author Ashley Schroder (aschroder.com)
|
6 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php if($log = $this->getLogData()): ?>
|
11 |
+
<div class="page-head">
|
12 |
+
<h3><?php echo $this->__('Event Details') ?></h3>
|
13 |
+
</div>
|
14 |
+
<div class="log-detail">
|
15 |
+
<p><strong><?php echo $this->__('Send Log Id:') ?></strong> <?php echo $log->getSendId(); ?></p>
|
16 |
+
<p><strong><?php echo $this->__('Type:') ?></strong> <?php echo $log->getType(); ?></p>
|
17 |
+
<p><strong><?php echo $this->__('Created:') ?></strong> <?php echo $log->getCreatedAt(); ?></p>
|
18 |
+
<p><strong><?php echo $this->__('Message:') ?></strong></p>
|
19 |
+
<div>
|
20 |
+
<?php echo $log->getMessage(); ?>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
<br/>
|
24 |
+
<div class="button-set"><a href="<?php echo $this->getBackUrl() ?>" class="left">« <?php echo $this->__('Back to Event Log') ?></a></div><br />
|
25 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/alphamail/logging/send_view.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @author Ashley Schroder (aschroder.com)
|
6 |
+
* @copyright Copyright (c) 2010 Ashley Schroder
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php if($log = $this->getLogData()): ?>
|
11 |
+
<div class="page-head">
|
12 |
+
<h3><?php echo $this->__('Send Details') ?></h3>
|
13 |
+
</div>
|
14 |
+
<div class="log-detail">
|
15 |
+
<p><strong><?php echo $this->__('Queue Id:') ?></strong> <?php echo $log->getAmQueueId(); ?></p>
|
16 |
+
<p><strong><?php echo $this->__('Status:') ?></strong> <?php echo $log->getStatus(); ?></p>
|
17 |
+
<p><strong><?php echo $this->__('Sent:') ?></strong> <?php echo $log->getSentAt(); ?></p>
|
18 |
+
<p><strong><?php echo $this->__('Created:') ?></strong> <?php echo $log->getCreatedAt(); ?></p>
|
19 |
+
<p><strong><?php echo $this->__('Raw Payload:') ?></strong></p>
|
20 |
+
<div>
|
21 |
+
<?php echo $log->getRawPayload(); ?>
|
22 |
+
</div>
|
23 |
+
|
24 |
+
</div>
|
25 |
+
<br/>
|
26 |
+
<div class="button-set"><a href="<?php echo $this->getBackUrl() ?>" class="left">« <?php echo $this->__('Back to Send Log') ?></a></div><br />
|
27 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/alphamail/project/create.phtml
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<style type="text/css">
|
2 |
-
table.projects-grid tbody tr:hover {
|
3 |
-
cursor: pointer;
|
4 |
-
background: #fcf5dd;
|
5 |
-
}
|
6 |
-
</style>
|
7 |
-
|
8 |
-
<form action="<?php echo($this->getUrl('*/*/save/')) ?>" method="post">
|
9 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
10 |
-
<div id="page:main-container">
|
11 |
-
<div class="content-header">
|
12 |
-
<table cellspacing="0">
|
13 |
-
<tr>
|
14 |
-
<td><h3>Create New AlphaMail Project</h3></td>
|
15 |
-
<td class="form-buttons">
|
16 |
-
<button type="button" class="scalable back" onclick="window.location='<?php echo($this->getUrl('*/*/index')) ?>'">
|
17 |
-
<span>Back</span>
|
18 |
-
</button>
|
19 |
-
<button type="button" class="scalable save" onclick="submit();">
|
20 |
-
<span>Create Project</span>
|
21 |
-
</button>
|
22 |
-
</td>
|
23 |
-
</tr>
|
24 |
-
</table>
|
25 |
-
</div>
|
26 |
-
<div class="entry-edit">
|
27 |
-
<div class="entry-edit-head">
|
28 |
-
<h4 class="icon-head head-edit-form fieldset-legend">Project Information</h4>
|
29 |
-
<div class="form-buttons">
|
30 |
-
</div>
|
31 |
-
</div>
|
32 |
-
<div class="fieldset fieldset-wide" id="base_fieldset">
|
33 |
-
<div class="hor-scroll">
|
34 |
-
<table cellspacing="0" class="form-list">
|
35 |
-
<tbody>
|
36 |
-
<tr id="field_name">
|
37 |
-
<td class="label">
|
38 |
-
<label for="name">Name <span class="required">*</span></label>
|
39 |
-
</td>
|
40 |
-
<td class="value">
|
41 |
-
<input id="name" name="name" value="" title="Project Name" type="text" class="input-text required-entry">
|
42 |
-
</td>
|
43 |
-
</tr>
|
44 |
-
<tr id="field_subject">
|
45 |
-
<td class="label">
|
46 |
-
<label for="subject">Subject <span class="required">*</span></label>
|
47 |
-
</td>
|
48 |
-
<td class="value">
|
49 |
-
<input id="subject" name="subject" value="" title="Subject" type="text" class="input-text required-entry">
|
50 |
-
</td>
|
51 |
-
</tr>
|
52 |
-
<tr id="field_template_id">
|
53 |
-
<td class="label">
|
54 |
-
<label for="subject">Template</label>
|
55 |
-
</td>
|
56 |
-
<td class="value">
|
57 |
-
<select name="template_id">
|
58 |
-
<option value="0">-- Not selected ---------------------------</option>
|
59 |
-
<?php foreach($templates as $template){ ?>
|
60 |
-
<option value="<?php echo($template->id) ?>">
|
61 |
-
<?php echo($this->escapeHtml($template->name)) ?>
|
62 |
-
</option>
|
63 |
-
<?php } ?>
|
64 |
-
</select>
|
65 |
-
</td>
|
66 |
-
</tr>
|
67 |
-
<tr id="field_signature_id">
|
68 |
-
<td class="label">
|
69 |
-
<label for="subject">Signature</label>
|
70 |
-
</td>
|
71 |
-
<td class="value">
|
72 |
-
<select name="signature_id">
|
73 |
-
<option value="0">-- Not selected ---------------------------</option>
|
74 |
-
<?php foreach($signatures as $signature){ ?>
|
75 |
-
<option value="<?php echo($signature->id) ?>">
|
76 |
-
<?php echo($this->escapeHtml($signature->name)) ?>
|
77 |
-
</option>
|
78 |
-
<?php } ?>
|
79 |
-
</select>
|
80 |
-
</td>
|
81 |
-
</tr>
|
82 |
-
</tbody>
|
83 |
-
</table>
|
84 |
-
</div>
|
85 |
-
</div>
|
86 |
-
</div>
|
87 |
-
</div>
|
88 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/alphamail/project/edit.phtml
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php if($project != null){ ?>
|
2 |
-
<style type="text/css">
|
3 |
-
table.projects-grid tbody tr:hover {
|
4 |
-
cursor: pointer;
|
5 |
-
background: #fcf5dd;
|
6 |
-
}
|
7 |
-
</style>
|
8 |
-
|
9 |
-
<form action="<?php echo($this->getUrl('*/*/save/', array('id' => $project->id))) ?>" method="post">
|
10 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
11 |
-
<div id="page:main-container">
|
12 |
-
<div class="content-header">
|
13 |
-
<table cellspacing="0">
|
14 |
-
<tr>
|
15 |
-
<td><h3>Edit AlphaMail Project (#<?php echo($project->id) ?>)</h3></td>
|
16 |
-
<td class="form-buttons">
|
17 |
-
<button type="button" class="scalable back" onclick="window.location='<?php echo($this->getUrl('*/*/index')) ?>'">
|
18 |
-
<span>Back</span>
|
19 |
-
</button>
|
20 |
-
<button type="button" class="scalable save" onclick="submit();">
|
21 |
-
<span>Save Project</span>
|
22 |
-
</button>
|
23 |
-
</td>
|
24 |
-
</tr>
|
25 |
-
</table>
|
26 |
-
</div>
|
27 |
-
<div class="entry-edit">
|
28 |
-
<div class="entry-edit-head">
|
29 |
-
<h4 class="icon-head head-edit-form fieldset-legend">Project Information</h4>
|
30 |
-
<div class="form-buttons">
|
31 |
-
</div>
|
32 |
-
</div>
|
33 |
-
<div class="fieldset fieldset-wide" id="base_fieldset">
|
34 |
-
<div class="hor-scroll">
|
35 |
-
<table cellspacing="0" class="form-list">
|
36 |
-
<tbody>
|
37 |
-
<tr id="field_name">
|
38 |
-
<td class="label">
|
39 |
-
<label for="name">Name <span class="required">*</span></label>
|
40 |
-
</td>
|
41 |
-
<td class="value">
|
42 |
-
<input id="name" name="name" value="<?php echo($this->htmlEscape($project->name)) ?>" title="Project Name" type="text" class="input-text required-entry">
|
43 |
-
</td>
|
44 |
-
</tr>
|
45 |
-
<tr id="field_subject">
|
46 |
-
<td class="label">
|
47 |
-
<label for="subject">Subject <span class="required">*</span></label>
|
48 |
-
</td>
|
49 |
-
<td class="value">
|
50 |
-
<input id="subject" name="subject" value="<?php echo($this->htmlEscape($project->subject)) ?>" title="Subject" type="text" class="input-text required-entry">
|
51 |
-
</td>
|
52 |
-
</tr>
|
53 |
-
<tr id="field_template_id">
|
54 |
-
<td class="label">
|
55 |
-
<label for="subject">Template</label>
|
56 |
-
</td>
|
57 |
-
<td class="value">
|
58 |
-
<select name="template_id">
|
59 |
-
<option value="0">-- Not selected ---------------------------</option>
|
60 |
-
<?php foreach($templates as $template){ ?>
|
61 |
-
<option value="<?php echo($template->id) ?>" <?php if($template->id == $project->template_id){ echo("selected"); } ?>>
|
62 |
-
<?php echo($this->escapeHtml($template->name)) ?>
|
63 |
-
</option>
|
64 |
-
<?php } ?>
|
65 |
-
</select>
|
66 |
-
</td>
|
67 |
-
</tr>
|
68 |
-
<tr id="field_signature_id">
|
69 |
-
<td class="label">
|
70 |
-
<label for="subject">Signature</label>
|
71 |
-
</td>
|
72 |
-
<td class="value">
|
73 |
-
<select name="signature_id">
|
74 |
-
<option value="0">-- Not selected ---------------------------</option>
|
75 |
-
<?php foreach($signatures as $signature){ ?>
|
76 |
-
<option value="<?php echo($signature->id) ?>" <?php if($signature->id == $project->signature_id){ echo("selected"); } ?>>
|
77 |
-
<?php echo($this->escapeHtml($signature->name)) ?>
|
78 |
-
</option>
|
79 |
-
<?php } ?>
|
80 |
-
</select>
|
81 |
-
</td>
|
82 |
-
</tr>
|
83 |
-
</tbody>
|
84 |
-
</table>
|
85 |
-
</div>
|
86 |
-
</div>
|
87 |
-
</div>
|
88 |
-
</div>
|
89 |
-
</form>
|
90 |
-
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/alphamail/project/index.phtml
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php $row_offset = 0; ?>
|
2 |
-
<?php if($projects != null){ ?>
|
3 |
-
<style type="text/css">
|
4 |
-
table.projects-grid tbody tr:hover {
|
5 |
-
cursor: pointer;
|
6 |
-
background: #fcf5dd;
|
7 |
-
}
|
8 |
-
</style>
|
9 |
-
|
10 |
-
<form action="<?php echo($this->getUrl('*/*/save/')) ?>" method="post">
|
11 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
12 |
-
<div class="content-header">
|
13 |
-
<table cellspacing="0">
|
14 |
-
<tr>
|
15 |
-
<td><h3>Projects</h3></td>
|
16 |
-
<td class="form-buttons">
|
17 |
-
<button class="scalable add" onclick="window.location='<?php echo($this->getUrl('*/*/create')) ?>'; return false;">
|
18 |
-
<span>Add New Project</span>
|
19 |
-
</button>
|
20 |
-
</td>
|
21 |
-
</tr>
|
22 |
-
</table>
|
23 |
-
</div>
|
24 |
-
<div class="grid">
|
25 |
-
<div class="hor-scroll">
|
26 |
-
<table cellspacing="0" class="data projects-grid">
|
27 |
-
<thead>
|
28 |
-
<tr class="headings">
|
29 |
-
<th style='width:100px;'>Id</th>
|
30 |
-
<th style='width:auto;'>Name</th>
|
31 |
-
</tr>
|
32 |
-
</thead>
|
33 |
-
<tbody>
|
34 |
-
<?php foreach($projects as $project){ ++$row_offset; ?>
|
35 |
-
<?php $project_url = $this->getUrl('*/*/edit', array('id' => $project->id)); ?>
|
36 |
-
<tr class="<?php echo($row_offset % 2 == 0 ? 'odd' : 'even') ?>" onclick="window.location='<?php echo($project_url) ?>';">
|
37 |
-
<td class="a-left"><?php echo($this->htmlEscape($project->id)) ?></td>
|
38 |
-
<td class="a-left"><?php echo($this->htmlEscape($project->name)) ?></td>
|
39 |
-
</tr>
|
40 |
-
<?php } ?>
|
41 |
-
</tbody>
|
42 |
-
</table>
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
</form>
|
46 |
-
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/alphamail/projectmapping/index.phtml
CHANGED
@@ -1,47 +1,225 @@
|
|
1 |
-
<?php $
|
2 |
-
<?php
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
<?php } ?>
|
1 |
+
<?php if(isset($projects) && isset($messages)){ ?>
|
2 |
+
<script src="<?php echo($this->getSkinUrl("alphamail/jquery-1.9.1.js")) ?>"></script>
|
3 |
+
<script src="<?php echo($this->getSkinUrl("alphamail/jquery-ui.js")) ?>"></script>
|
4 |
+
|
5 |
+
<style>
|
6 |
+
div#mapping .box-inner {
|
7 |
+
background-color: #fff;
|
8 |
+
text-align: center;
|
9 |
+
vertical-align: middle;
|
10 |
+
display: table-cell;
|
11 |
+
height:100px;
|
12 |
+
width:100px;
|
13 |
+
border: 1px dashed #c0c0c0;
|
14 |
+
border-radius: 4px;
|
15 |
+
}
|
16 |
+
|
17 |
+
div#mapping .box-inner.map-item {
|
18 |
+
cursor: move;
|
19 |
+
border: 1px solid #101010;
|
20 |
+
}
|
21 |
+
|
22 |
+
div#mapping .box {
|
23 |
+
border: 0px;
|
24 |
+
width: 100px;
|
25 |
+
height: 100px;
|
26 |
+
background-color: #fff;
|
27 |
+
float: left;
|
28 |
+
margin-left: auto;
|
29 |
+
margin-right: auto;
|
30 |
+
padding: 10px;
|
31 |
+
}
|
32 |
+
|
33 |
+
div#mapping .box-inner.active {
|
34 |
+
border: 1px solid #c0c0c0;
|
35 |
+
}
|
36 |
+
|
37 |
+
div#mapping .box.active div {
|
38 |
+
color: #101010;
|
39 |
+
background-color: #f0f0f0;
|
40 |
+
}
|
41 |
+
|
42 |
+
div#mapping * {
|
43 |
+
-webkit-touch-callout: none;
|
44 |
+
-webkit-user-select: none;
|
45 |
+
-khtml-user-select: none;
|
46 |
+
-moz-user-select: none;
|
47 |
+
-ms-user-select: none;
|
48 |
+
user-select: none;
|
49 |
+
}
|
50 |
+
|
51 |
+
div#mapping p {
|
52 |
+
width: 100px;
|
53 |
+
overflow: hidden;
|
54 |
+
text-overflow: ellipsis;
|
55 |
+
}
|
56 |
+
|
57 |
+
div#mapping .drop-target .active {
|
58 |
+
color: #101010;
|
59 |
+
border: 1px solid #101010;
|
60 |
+
cursor: pointer;
|
61 |
+
}
|
62 |
+
|
63 |
+
div#mapping .drop-target .enable {
|
64 |
+
color: #101010;
|
65 |
+
cursor: pointer;
|
66 |
+
}
|
67 |
+
|
68 |
+
div#mapping .drop-target:hover .active {
|
69 |
+
background-color: #f0f0f0;
|
70 |
+
}
|
71 |
+
</style>
|
72 |
+
|
73 |
+
<script>
|
74 |
+
var $jq = jQuery.noConflict();
|
75 |
+
|
76 |
+
function saveProjectMappings(button){
|
77 |
+
var mappings = {};
|
78 |
+
|
79 |
+
button.addClassName("disabled");
|
80 |
+
button.innerHTML = "<span>Please wait...</span>";
|
81 |
+
|
82 |
+
$jq(".drop-target .map-item").each(function(){
|
83 |
+
var messageId = $jq(this).parent().data('message-id');
|
84 |
+
var projectId = $jq(this).data('project-id');
|
85 |
+
mappings[messageId] = projectId;
|
86 |
+
});
|
87 |
+
|
88 |
+
$jq("input[name='mappings']").val(JSON.stringify(mappings));
|
89 |
+
$jq(button).closest("form").submit();
|
90 |
+
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
$jq(function(){
|
95 |
+
var droppableClicks = 0;
|
96 |
+
|
97 |
+
$jq(".map-item")
|
98 |
+
.draggable({
|
99 |
+
opacity: .4,
|
100 |
+
helper: 'clone',
|
101 |
+
start: function(event, ui){
|
102 |
+
droppableClicks = 0;
|
103 |
+
$jq(".drop-target > .box-inner").addClass("enable");
|
104 |
+
$jq(ui.helper).addClass("cloned");
|
105 |
+
$jq(ui.helper).children().remove();
|
106 |
+
},
|
107 |
+
stop: function(event, ui){
|
108 |
+
$jq(".drop-target *").removeClass("enable");
|
109 |
+
},
|
110 |
+
create: function(){
|
111 |
+
$jq(this).data('position', $jq(this).position());
|
112 |
+
},
|
113 |
+
revert: function(valid) {
|
114 |
+
return !valid;
|
115 |
+
}
|
116 |
+
});
|
117 |
+
|
118 |
+
$jq(".drop-target > .draggable").click(function(){
|
119 |
+
if($jq(this).hasClass("draggable")){
|
120 |
+
$jq(this)
|
121 |
+
.html("<div class=\"box-inner\" style=\"color: #c0c0c0;\"><p>" + $jq(this).parent().data('template-name') + "</p></div>")
|
122 |
+
.removeClass("draggable")
|
123 |
+
.removeClass("map-item")
|
124 |
+
.removeClass("box-inner")
|
125 |
+
.removeClass("ui-draggable")
|
126 |
+
.removeClass("active");
|
127 |
+
|
128 |
+
$jq(".box-inner", this).removeClass("active");
|
129 |
+
}
|
130 |
+
});
|
131 |
+
|
132 |
+
$jq(".drop-target")
|
133 |
+
.droppable({
|
134 |
+
greedy: true,
|
135 |
+
tolerance: 'intersect',
|
136 |
+
drop: function(event, ui){
|
137 |
+
var outerScope = this;
|
138 |
+
|
139 |
+
if(++droppableClicks > 1){
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
|
143 |
+
var cloned = ui.draggable.clone();
|
144 |
+
cloned.addClass("active");
|
145 |
+
|
146 |
+
$jq(cloned).prepend('<div style="position:relative;top:-29px;background-color: #101010;color:#fff;">Connected</div>');
|
147 |
+
|
148 |
+
cloned.click(function(){
|
149 |
+
if($jq(this).hasClass("draggable")){
|
150 |
+
$jq(this)
|
151 |
+
.html("<div class=\"box-inner\" style=\"color: #c0c0c0;\"><p>" + $jq(this).parent().data('template-name') + "</p></div>")
|
152 |
+
.removeClass("draggable")
|
153 |
+
.removeClass("map-item")
|
154 |
+
.removeClass("box-inner")
|
155 |
+
.removeClass("ui-draggable")
|
156 |
+
.removeClass("active");
|
157 |
+
|
158 |
+
$jq(".box-inner", this).removeClass("active");
|
159 |
+
}
|
160 |
+
});
|
161 |
+
|
162 |
+
$jq(event.target).html(cloned);
|
163 |
+
return true;
|
164 |
+
},
|
165 |
+
over: function(event, ui) {
|
166 |
+
$jq(".box-inner", this).addClass('active');
|
167 |
+
},
|
168 |
+
out: function(event, ui) {
|
169 |
+
$jq(".box-inner", this).removeClass('active');
|
170 |
+
$jq(this).droppable('option', 'accept', '.draggable');
|
171 |
+
}
|
172 |
+
});
|
173 |
+
});
|
174 |
+
</script>
|
175 |
+
|
176 |
+
<form action="<?php echo($this->getUrl('*/*/save/')) ?>" method="post">
|
177 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
178 |
+
<input name="mappings" type="hidden" value="{}">
|
179 |
+
|
180 |
+
<div class="content-header">
|
181 |
+
<table cellspacing="0">
|
182 |
+
<tr>
|
183 |
+
<td><h3>Edit AlphaMail Mappings</h3></td>
|
184 |
+
<td class="form-buttons">
|
185 |
+
<button type="button" class="scalable save" onclick="saveProjectMappings(this);">
|
186 |
+
<span>Save Project Mappings</span>
|
187 |
+
</button>
|
188 |
+
</td>
|
189 |
+
</tr>
|
190 |
+
</table>
|
191 |
+
</div>
|
192 |
+
|
193 |
+
<div id="mapping">
|
194 |
+
<h3>AlphaMail Projects</h3>
|
195 |
+
|
196 |
+
<?php foreach($projects as $project){ ?>
|
197 |
+
<div class="box">
|
198 |
+
<div class="draggable map-item box-inner" data-project-id="<?php echo($project->id) ?>">
|
199 |
+
<p><?php echo($this->htmlEscape($project->name)) ?></p>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
<?php } ?>
|
203 |
+
|
204 |
+
<br style="clear: both;" />
|
205 |
+
<h3>Magento Emails</h3>
|
206 |
+
|
207 |
+
<?php foreach($messages as $message_id => $message){ ?>
|
208 |
+
<div class="drop-target box" data-message-id="<?php echo($message_id) ?>" data-template-name="<?php echo($this->htmlEscape($message['title'])) ?>">
|
209 |
+
<?php if($message["am_project_id"] != null){ ?>
|
210 |
+
<div class="draggable map-item box-inner ui-draggable active" data-project-id="<?php echo($message["am_project_id"]) ?>">
|
211 |
+
<div style="position:relative;top:-29px;background-color: #101010;color:#fff;">Connected</div>
|
212 |
+
<p><?php echo($this->htmlEscape($projects[$message['am_project_id']]->name)) ?></p>
|
213 |
+
</div>
|
214 |
+
<?php }else{ ?>
|
215 |
+
<div class="box-inner" style="color: #c0c0c0;">
|
216 |
+
<p><?php echo($this->htmlEscape($message['title'])) ?></p>
|
217 |
+
</div>
|
218 |
+
<?php } ?>
|
219 |
+
</div>
|
220 |
+
<?php } ?>
|
221 |
+
</div>
|
222 |
+
</form>
|
223 |
+
<?php }else{ ?>
|
224 |
+
<p>Unable to login. Please go to your AlphaMail configuration and enter a valid token.</p>
|
225 |
<?php } ?>
|
app/design/adminhtml/default/default/template/alphamail/singlesignon/index.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if(isset($url)){ ?>
|
2 |
+
<style type="text/css">
|
3 |
+
div#anchor-content {
|
4 |
+
padding: 0px;
|
5 |
+
}
|
6 |
+
|
7 |
+
iframe#alphamail-sign-on-frame {
|
8 |
+
width: 100%;
|
9 |
+
border:0px;
|
10 |
+
padding:0px;
|
11 |
+
margin:0px;
|
12 |
+
min-height: 600px;
|
13 |
+
}
|
14 |
+
</style>
|
15 |
+
<iframe id="alphamail-sign-on-frame" src="<?php echo($url) ?>"></iframe>
|
16 |
+
<?php }else{ ?>
|
17 |
+
<p>Unable to login. Please go to your AlphaMail configuration and enter a valid token.</p>
|
18 |
+
<?php } ?>
|
app/design/adminhtml/default/default/template/alphamail/system/config.phtml
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php if($this->isAlphaMailSection()){ ?>
|
2 |
<?php
|
|
|
3 |
list($error_code, $message) = Mage::helper('alphamail/diagnostic')->tryAuthenticateWithToken(
|
4 |
Mage::helper('alphamail')->getPrimaryServerUrl(),
|
5 |
Mage::helper('alphamail')->getAuthenticationToken());
|
@@ -35,6 +36,9 @@
|
|
35 |
document.observe('dom:loaded', function(){
|
36 |
// Enable/disable input/controls to reflect plugin enabled state
|
37 |
var element = $$("select#alphamail_general_activated")[0];
|
|
|
|
|
|
|
38 |
|
39 |
var changeEnabledStateCallback = function(){
|
40 |
setFormEnabledState(this);
|
1 |
<?php if($this->isAlphaMailSection()){ ?>
|
2 |
<?php
|
3 |
+
$admin_helper = Mage::helper("adminhtml");
|
4 |
list($error_code, $message) = Mage::helper('alphamail/diagnostic')->tryAuthenticateWithToken(
|
5 |
Mage::helper('alphamail')->getPrimaryServerUrl(),
|
6 |
Mage::helper('alphamail')->getAuthenticationToken());
|
36 |
document.observe('dom:loaded', function(){
|
37 |
// Enable/disable input/controls to reflect plugin enabled state
|
38 |
var element = $$("select#alphamail_general_activated")[0];
|
39 |
+
var connectInfoElement = $$("span#alphamail_config_connect_info")[0];
|
40 |
+
|
41 |
+
connectInfoElement.update("Connect your account by manually entering a token above or by <a href='<?php echo($admin_helper->getUrl("alphamail/Connect/Register")) ?>'>registering a new account</a> or <a href='<?php echo($admin_helper->getUrl("alphamail/Connect/Login")) ?>'>signing in</a>.");
|
42 |
|
43 |
var changeEnabledStateCallback = function(){
|
44 |
setFormEnabledState(this);
|
app/design/adminhtml/default/default/template/alphamail/template/create.phtml
DELETED
@@ -1,302 +0,0 @@
|
|
1 |
-
<style type="text/css">
|
2 |
-
table.projects-grid tbody tr:hover {
|
3 |
-
cursor: pointer;
|
4 |
-
background: #fcf5dd;
|
5 |
-
}
|
6 |
-
</style>
|
7 |
-
<script type="text/javascript">
|
8 |
-
/*function deleteTemplate(){
|
9 |
-
if(confirm(''))
|
10 |
-
}*/
|
11 |
-
</script>
|
12 |
-
|
13 |
-
<script src="<?php echo $skin_path ?>/jquery.js" type="text/javascript" language="javascript"></script>
|
14 |
-
<script src="<?php echo $skin_path ?>/jquery-ui-1.8.15.custom.min.js" type="text/javascript" language="javascript"></script>
|
15 |
-
<script src="<?php echo $skin_path ?>/jquery.layout.js"></script>
|
16 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/jquery.sparkline.min.js"></script>
|
17 |
-
|
18 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/css/styles.css" type="text/css" />
|
19 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/css/fonts.css" type="text/css" />
|
20 |
-
|
21 |
-
<script src="<?php echo $skin_path ?>/messagebox.js"></script>
|
22 |
-
|
23 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/lib/codemirror.js"></script>
|
24 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/CodeMirror-2.18/lib/codemirror.css" type="text/css" />
|
25 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/xml/xml.js"></script>
|
26 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/javascript/javascript.js"></script>
|
27 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/css/css.js"></script>
|
28 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/clike/clike.js"></script>
|
29 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/comlang/comlang.js"></script>
|
30 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/CodeMirror-2.18/theme/default.css" type="text/css" />
|
31 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/CodeMirror-2.18/theme/eclipse.css" type="text/css" />
|
32 |
-
|
33 |
-
<script>
|
34 |
-
var source_cm;
|
35 |
-
var selected_tid = 288;
|
36 |
-
|
37 |
-
var scroll = {
|
38 |
-
sourceTop: 0,
|
39 |
-
sourceLeft: 0,
|
40 |
-
designTop: 0,
|
41 |
-
designLeft: 0
|
42 |
-
};
|
43 |
-
|
44 |
-
var mode = "design";
|
45 |
-
var design_frame;
|
46 |
-
|
47 |
-
function render_code_textarea(id) {
|
48 |
-
/* styles a textatrea with the CodeMirror Editor */
|
49 |
-
return CodeMirror.fromTextArea(document.getElementById(id), {
|
50 |
-
mode: "clike",
|
51 |
-
lineNumbers: true,
|
52 |
-
matchBrackets: true,
|
53 |
-
indentUnit: 8,
|
54 |
-
indentWithTabs: true,
|
55 |
-
enterMode: "keep",
|
56 |
-
tabMode: "shift",
|
57 |
-
onKeyEvent: function (editor, e) {
|
58 |
-
|
59 |
-
}
|
60 |
-
});
|
61 |
-
};
|
62 |
-
|
63 |
-
$(document).ready(function() {
|
64 |
-
design_frame = document.getElementById("html_design_frame").contentWindow;
|
65 |
-
|
66 |
-
/* style the html source with the CodeMirror Editor */
|
67 |
-
source_cm = CodeMirror.fromTextArea(document.getElementById("html_version"), {
|
68 |
-
mode: {name: "comlang", htmlMode: true},
|
69 |
-
lineNumbers: true,
|
70 |
-
matchBrackets: true,
|
71 |
-
indentUnit: 8,
|
72 |
-
indentWithTabs: true,
|
73 |
-
enterMode: "keep",
|
74 |
-
tabMode: "shift",
|
75 |
-
onKeyEvent: function (editor, e) {
|
76 |
-
//window.parent.set_unsaved(true);
|
77 |
-
}
|
78 |
-
});
|
79 |
-
|
80 |
-
/* set the editor size */
|
81 |
-
resize_editor();
|
82 |
-
|
83 |
-
selected_tid = 287;
|
84 |
-
|
85 |
-
$("#text_version").val(<?php echo(json_encode($template->content->text)) ?>);
|
86 |
-
$("#html_version").val(<?php echo(json_encode($template->content->html)) ?>);
|
87 |
-
source_cm.setValue(<?php echo(json_encode($template->content->html)) ?>);
|
88 |
-
|
89 |
-
/* render design editor */
|
90 |
-
renderEditor();
|
91 |
-
});
|
92 |
-
|
93 |
-
/* resize the editor to fit the window */
|
94 |
-
function resize_editor() {
|
95 |
-
var height = $(window).height() - 81;
|
96 |
-
|
97 |
-
$("#html_design_frame").height(height);
|
98 |
-
$(".CodeMirror-scroll").height(height);
|
99 |
-
$("#html_preview_frame").height(height);
|
100 |
-
$("#text_version").height(height);
|
101 |
-
source_cm.refresh();
|
102 |
-
}
|
103 |
-
|
104 |
-
/* auto adjust the editor size */
|
105 |
-
$(window).resize(function() { resize_editor(); });
|
106 |
-
|
107 |
-
/* save a template */
|
108 |
-
function save_template() {
|
109 |
-
if (mode == "design") {
|
110 |
-
syncEditor();
|
111 |
-
}
|
112 |
-
|
113 |
-
$("form#template_form").submit();
|
114 |
-
|
115 |
-
return false;
|
116 |
-
}
|
117 |
-
|
118 |
-
/* switch between html and text version */
|
119 |
-
function text_html(mode) {
|
120 |
-
if (mode === "text") {
|
121 |
-
$("#btn_txt").addClass("hdr_btn_active");
|
122 |
-
$("#btn_txt").removeClass("hdr_btn");
|
123 |
-
|
124 |
-
$("#btn_html").removeClass("hdr_btn_active");
|
125 |
-
$("#btn_html").addClass("hdr_btn");
|
126 |
-
|
127 |
-
$("#div_txt").show();
|
128 |
-
$("#div_html").hide();
|
129 |
-
} else {
|
130 |
-
$("#btn_html").addClass("hdr_btn_active");
|
131 |
-
$("#btn_html").removeClass("hdr_btn");
|
132 |
-
|
133 |
-
$("#btn_txt").removeClass("hdr_btn_active");
|
134 |
-
$("#btn_txt").addClass("hdr_btn");
|
135 |
-
|
136 |
-
$("#div_txt").hide();
|
137 |
-
$("#div_html").show();
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
/* switch between design/preview/source mode */
|
142 |
-
function source_preview(elem, m) {
|
143 |
-
$(".small_tab_active").removeClass("small_tab_active");
|
144 |
-
$(elem).addClass("small_tab_active");
|
145 |
-
|
146 |
-
switch (m) {
|
147 |
-
case "source":
|
148 |
-
/* html source mode */
|
149 |
-
$("#html_design").hide();
|
150 |
-
$("#html_preview").hide();
|
151 |
-
$("#html_source").show();
|
152 |
-
|
153 |
-
if (this.mode == "design") {
|
154 |
-
/* sync editor content */
|
155 |
-
syncEditor();
|
156 |
-
|
157 |
-
/* set scroll position */
|
158 |
-
$(source_cm.getScrollerElement()).scrollTop(scroll.sourceTop);
|
159 |
-
$(source_cm.getScrollerElement()).scrollLeft(scroll.sourceLeft);
|
160 |
-
}
|
161 |
-
break;
|
162 |
-
|
163 |
-
case "design":
|
164 |
-
/* design mode */
|
165 |
-
/* save scroll position */
|
166 |
-
scroll.sourceTop = $(source_cm.getScrollerElement()).scrollTop();
|
167 |
-
scroll.sourceLeft = $(source_cm.getScrollerElement()).scrollLeft();
|
168 |
-
|
169 |
-
/* 'save' the content and render the editor */
|
170 |
-
source_cm.save();
|
171 |
-
renderEditor();
|
172 |
-
|
173 |
-
$("#html_design").show();
|
174 |
-
$("#html_preview").hide();
|
175 |
-
$("#html_source").hide();
|
176 |
-
break;
|
177 |
-
|
178 |
-
case "preview":
|
179 |
-
/* html preview mode */
|
180 |
-
source_cm.save();
|
181 |
-
$("#html_preview_frame").contents().find("html").html($("#html_version").val());
|
182 |
-
|
183 |
-
$("#html_design").hide();
|
184 |
-
$("#html_source").hide();
|
185 |
-
$("#html_preview").show();
|
186 |
-
}
|
187 |
-
|
188 |
-
mode = m;
|
189 |
-
}
|
190 |
-
|
191 |
-
function renderEditor() {
|
192 |
-
design_frame.setContent($("#html_version").val());
|
193 |
-
}
|
194 |
-
|
195 |
-
function syncEditor() {
|
196 |
-
source_cm.setValue(design_frame.getContent());
|
197 |
-
source_cm.refresh();
|
198 |
-
source_cm.save();
|
199 |
-
}
|
200 |
-
|
201 |
-
/* stop an event from 'bubbling' */
|
202 |
-
function stop_event(e) {
|
203 |
-
if (!e) {
|
204 |
-
e = window.event;
|
205 |
-
}
|
206 |
-
|
207 |
-
if (e.cancelBubble) {
|
208 |
-
e.cancelBubble = true;
|
209 |
-
} else {
|
210 |
-
e.stopPropagation();
|
211 |
-
}
|
212 |
-
}
|
213 |
-
</script>
|
214 |
-
|
215 |
-
</div>
|
216 |
-
|
217 |
-
<form id="template_form" action="<?php echo($this->getUrl('*/*/save/')) ?>" method="post">
|
218 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
219 |
-
<div id="page:main-container">
|
220 |
-
<div class="content-header">
|
221 |
-
<table cellspacing="0">
|
222 |
-
<tr>
|
223 |
-
<td><h3>Create New AlphaMail Template</h3></td>
|
224 |
-
<td class="form-buttons">
|
225 |
-
<button type="button" class="scalable back" onclick="window.location='<?php echo($this->getUrl('*/*/index')) ?>'">
|
226 |
-
<span>Back</span>
|
227 |
-
</button>
|
228 |
-
<button type="button" class="scalable save" onclick="submit();">
|
229 |
-
<span>Create Template</span>
|
230 |
-
</button>
|
231 |
-
</td>
|
232 |
-
</tr>
|
233 |
-
</table>
|
234 |
-
</div>
|
235 |
-
<div class="entry-edit">
|
236 |
-
<div class="entry-edit-head">
|
237 |
-
<h4 class="icon-head head-edit-form fieldset-legend">Template Information</h4>
|
238 |
-
<div class="form-buttons"></div>
|
239 |
-
</div>
|
240 |
-
<div class="fieldset fieldset-wide" id="base_fieldset">
|
241 |
-
<div class="hor-scroll">
|
242 |
-
<table cellspacing="0" class="form-list">
|
243 |
-
<tbody>
|
244 |
-
<tr id="field_name">
|
245 |
-
<td class="label">
|
246 |
-
<label for="name">Name <span class="required">*</span></label>
|
247 |
-
</td>
|
248 |
-
<td class="value">
|
249 |
-
<input id="name" name="name" value="<?php echo($this->htmlEscape($template->name)) ?>" title="Template Name" type="text" class="input-text required-entry">
|
250 |
-
</td>
|
251 |
-
</tr>
|
252 |
-
</tbody>
|
253 |
-
</table>
|
254 |
-
|
255 |
-
<div class="c c_x2">
|
256 |
-
<div class="widget">
|
257 |
-
<div class="w_header wcolor_gray">
|
258 |
-
<div id="btn_html" class="w_header_text hdr_btn_active" onclick="text_html('html');">HTML-version</div>
|
259 |
-
<div id="btn_txt" class="w_header_text hdr_btn" onclick="text_html('text');">Text-version</div>
|
260 |
-
<div class="w_header_text" style="float: right;">
|
261 |
-
<div style="display: none;">
|
262 |
-
<div style="float: left; margin-right: 12px; margin-left: 10px;">Charset:</div>
|
263 |
-
<div style="float: left; margin-top: 4px; margin-right: 20px;">
|
264 |
-
<select class="txt" id="templ_charset">
|
265 |
-
<option value="utf-8" >UTF-8 (Unicode)</option>
|
266 |
-
<option value="iso-8859-1" >ISO-8859-1 (Latin1)</option>
|
267 |
-
</select>
|
268 |
-
</div>
|
269 |
-
</div>
|
270 |
-
</div>
|
271 |
-
</div>
|
272 |
-
<div class="w_menu"></div>
|
273 |
-
<div class="w_main">
|
274 |
-
<div class="w_main_inner">
|
275 |
-
<div id="div_html" class="w_main_inner2" style="margin-bottom: 12px; padding-top: 0; padding-left: 0; padding-right: 0;">
|
276 |
-
<div style="min-height: 210px;">
|
277 |
-
<div id="html_design">
|
278 |
-
<iframe id="html_design_frame" name="html_frame" src="<?php echo $skin_path ?>/editor.htm"></iframe>
|
279 |
-
</div>
|
280 |
-
<div id="html_source">
|
281 |
-
<textarea style="width: 100%; height: 210px;" id="html_version" name="html_version" class="txt" onclick="$(this).focus();"></textarea>
|
282 |
-
</div>
|
283 |
-
<div id="html_preview">
|
284 |
-
<iframe id="html_preview_frame"></iframe>
|
285 |
-
</div>
|
286 |
-
</div>
|
287 |
-
<div class="small_tab small_tab_active" style="margin-left: 4px;" onclick="source_preview(this, 'design');">Design</div>
|
288 |
-
<div class="small_tab" onclick="source_preview(this, 'source');">Källa</div>
|
289 |
-
</div>
|
290 |
-
|
291 |
-
<div id="div_txt" class="w_main_inner2" style="margin-bottom: 12px; padding-top: 0; padding-left: 0; padding-right: 0; display: none;">
|
292 |
-
<textarea style="width: 100%; height: 210px; padding: 0;" id="text_version" name="text_version" class="txt" onclick="$(this).focus();"></textarea>
|
293 |
-
</div>
|
294 |
-
</div>
|
295 |
-
</div>
|
296 |
-
</div>
|
297 |
-
</div>
|
298 |
-
</div>
|
299 |
-
</div>
|
300 |
-
</div>
|
301 |
-
</div>
|
302 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/alphamail/template/edit.phtml
DELETED
@@ -1,300 +0,0 @@
|
|
1 |
-
<?php if($template != null){ ?>
|
2 |
-
<style type="text/css">
|
3 |
-
table.projects-grid tbody tr:hover {
|
4 |
-
cursor: pointer;
|
5 |
-
background: #fcf5dd;
|
6 |
-
}
|
7 |
-
</style>
|
8 |
-
|
9 |
-
<script src="<?php echo $skin_path ?>/jquery.js" type="text/javascript" language="javascript"></script>
|
10 |
-
<script src="<?php echo $skin_path ?>/jquery-ui-1.8.15.custom.min.js" type="text/javascript" language="javascript"></script>
|
11 |
-
<script src="<?php echo $skin_path ?>/jquery.layout.js"></script>
|
12 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/jquery.sparkline.min.js"></script>
|
13 |
-
|
14 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/css/styles.css" type="text/css" />
|
15 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/css/fonts.css" type="text/css" />
|
16 |
-
|
17 |
-
<script src="<?php echo $skin_path ?>/messagebox.js"></script>
|
18 |
-
|
19 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/lib/codemirror.js"></script>
|
20 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/CodeMirror-2.18/lib/codemirror.css" type="text/css" />
|
21 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/xml/xml.js"></script>
|
22 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/javascript/javascript.js"></script>
|
23 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/css/css.js"></script>
|
24 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/clike/clike.js"></script>
|
25 |
-
<script type="text/javascript" src="<?php echo $skin_path ?>/CodeMirror-2.18/mode/comlang/comlang.js"></script>
|
26 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/CodeMirror-2.18/theme/default.css" type="text/css" />
|
27 |
-
<link rel="stylesheet" href="<?php echo $skin_path ?>/CodeMirror-2.18/theme/eclipse.css" type="text/css" />
|
28 |
-
|
29 |
-
<script>
|
30 |
-
var selected_tid = 288;
|
31 |
-
var source_cm;
|
32 |
-
|
33 |
-
var scroll = {
|
34 |
-
sourceTop: 0,
|
35 |
-
sourceLeft: 0,
|
36 |
-
designTop: 0,
|
37 |
-
designLeft: 0
|
38 |
-
};
|
39 |
-
|
40 |
-
var mode = "design";
|
41 |
-
var design_frame;
|
42 |
-
|
43 |
-
function render_code_textarea(id) {
|
44 |
-
/* styles a textatrea with the CodeMirror Editor */
|
45 |
-
return CodeMirror.fromTextArea(document.getElementById(id), {
|
46 |
-
mode: "clike",
|
47 |
-
lineNumbers: true,
|
48 |
-
matchBrackets: true,
|
49 |
-
indentUnit: 8,
|
50 |
-
indentWithTabs: true,
|
51 |
-
enterMode: "keep",
|
52 |
-
tabMode: "shift",
|
53 |
-
onKeyEvent: function (editor, e) {
|
54 |
-
|
55 |
-
}
|
56 |
-
});
|
57 |
-
};
|
58 |
-
|
59 |
-
$(document).ready(function() {
|
60 |
-
design_frame = document.getElementById("html_design_frame").contentWindow;
|
61 |
-
|
62 |
-
/* style the html source with the CodeMirror Editor */
|
63 |
-
source_cm = CodeMirror.fromTextArea(document.getElementById("html_version"), {
|
64 |
-
mode: {name: "comlang", htmlMode: true},
|
65 |
-
lineNumbers: true,
|
66 |
-
matchBrackets: true,
|
67 |
-
indentUnit: 8,
|
68 |
-
indentWithTabs: true,
|
69 |
-
enterMode: "keep",
|
70 |
-
tabMode: "shift",
|
71 |
-
onKeyEvent: function (editor, e) {
|
72 |
-
//window.parent.set_unsaved(true);
|
73 |
-
}
|
74 |
-
});
|
75 |
-
|
76 |
-
/* set the editor size */
|
77 |
-
resize_editor();
|
78 |
-
|
79 |
-
selected_tid = 287;
|
80 |
-
|
81 |
-
$("#text_version").val(<?php echo(json_encode($template->content->text)) ?>);
|
82 |
-
$("#html_version").val(<?php echo(json_encode($template->content->html)) ?>);
|
83 |
-
source_cm.setValue(<?php echo(json_encode($template->content->html)) ?>);
|
84 |
-
|
85 |
-
/* render design editor */
|
86 |
-
renderEditor();
|
87 |
-
});
|
88 |
-
|
89 |
-
/* resize the editor to fit the window */
|
90 |
-
function resize_editor() {
|
91 |
-
var height = $(window).height() - 81;
|
92 |
-
|
93 |
-
$("#html_design_frame").height(height);
|
94 |
-
$(".CodeMirror-scroll").height(height);
|
95 |
-
$("#html_preview_frame").height(height);
|
96 |
-
$("#text_version").height(height);
|
97 |
-
source_cm.refresh();
|
98 |
-
}
|
99 |
-
|
100 |
-
/* auto adjust the editor size */
|
101 |
-
$(window).resize(function() { resize_editor(); });
|
102 |
-
|
103 |
-
/* save a template */
|
104 |
-
function save_template() {
|
105 |
-
if (mode == "design") {
|
106 |
-
syncEditor();
|
107 |
-
}
|
108 |
-
|
109 |
-
$("form#template_form").submit();
|
110 |
-
|
111 |
-
return false;
|
112 |
-
}
|
113 |
-
|
114 |
-
/* switch between html and text version */
|
115 |
-
function text_html(mode) {
|
116 |
-
if (mode === "text") {
|
117 |
-
$("#btn_txt").addClass("hdr_btn_active");
|
118 |
-
$("#btn_txt").removeClass("hdr_btn");
|
119 |
-
|
120 |
-
$("#btn_html").removeClass("hdr_btn_active");
|
121 |
-
$("#btn_html").addClass("hdr_btn");
|
122 |
-
|
123 |
-
$("#div_txt").show();
|
124 |
-
$("#div_html").hide();
|
125 |
-
} else {
|
126 |
-
$("#btn_html").addClass("hdr_btn_active");
|
127 |
-
$("#btn_html").removeClass("hdr_btn");
|
128 |
-
|
129 |
-
$("#btn_txt").removeClass("hdr_btn_active");
|
130 |
-
$("#btn_txt").addClass("hdr_btn");
|
131 |
-
|
132 |
-
$("#div_txt").hide();
|
133 |
-
$("#div_html").show();
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
/* switch between design/preview/source mode */
|
138 |
-
function source_preview(elem, m) {
|
139 |
-
$(".small_tab_active").removeClass("small_tab_active");
|
140 |
-
$(elem).addClass("small_tab_active");
|
141 |
-
|
142 |
-
switch (m) {
|
143 |
-
case "source":
|
144 |
-
/* html source mode */
|
145 |
-
$("#html_design").hide();
|
146 |
-
$("#html_preview").hide();
|
147 |
-
$("#html_source").show();
|
148 |
-
|
149 |
-
if (this.mode == "design") {
|
150 |
-
/* sync editor content */
|
151 |
-
syncEditor();
|
152 |
-
|
153 |
-
/* set scroll position */
|
154 |
-
$(source_cm.getScrollerElement()).scrollTop(scroll.sourceTop);
|
155 |
-
$(source_cm.getScrollerElement()).scrollLeft(scroll.sourceLeft);
|
156 |
-
}
|
157 |
-
break;
|
158 |
-
|
159 |
-
case "design":
|
160 |
-
/* design mode */
|
161 |
-
/* save scroll position */
|
162 |
-
scroll.sourceTop = $(source_cm.getScrollerElement()).scrollTop();
|
163 |
-
scroll.sourceLeft = $(source_cm.getScrollerElement()).scrollLeft();
|
164 |
-
|
165 |
-
/* 'save' the content and render the editor */
|
166 |
-
source_cm.save();
|
167 |
-
renderEditor();
|
168 |
-
|
169 |
-
$("#html_design").show();
|
170 |
-
$("#html_preview").hide();
|
171 |
-
$("#html_source").hide();
|
172 |
-
break;
|
173 |
-
|
174 |
-
case "preview":
|
175 |
-
/* html preview mode */
|
176 |
-
source_cm.save();
|
177 |
-
$("#html_preview_frame").contents().find("html").html($("#html_version").val());
|
178 |
-
|
179 |
-
$("#html_design").hide();
|
180 |
-
$("#html_source").hide();
|
181 |
-
$("#html_preview").show();
|
182 |
-
}
|
183 |
-
|
184 |
-
mode = m;
|
185 |
-
}
|
186 |
-
|
187 |
-
function renderEditor() {
|
188 |
-
design_frame.setContent($("#html_version").val());
|
189 |
-
}
|
190 |
-
|
191 |
-
function syncEditor() {
|
192 |
-
source_cm.setValue(design_frame.getContent());
|
193 |
-
source_cm.refresh();
|
194 |
-
source_cm.save();
|
195 |
-
}
|
196 |
-
|
197 |
-
/* stop an event from 'bubbling' */
|
198 |
-
function stop_event(e) {
|
199 |
-
if (!e) {
|
200 |
-
e = window.event;
|
201 |
-
}
|
202 |
-
|
203 |
-
if (e.cancelBubble) {
|
204 |
-
e.cancelBubble = true;
|
205 |
-
} else {
|
206 |
-
e.stopPropagation();
|
207 |
-
}
|
208 |
-
}
|
209 |
-
</script>
|
210 |
-
|
211 |
-
<form id="template_form" action="<?php echo($this->getUrl('*/*/save/', array('id' => $template->id))) ?>" method="post">
|
212 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
213 |
-
<div id="page:main-container">
|
214 |
-
<div class="content-header">
|
215 |
-
<table cellspacing="0">
|
216 |
-
<tr>
|
217 |
-
<td><h3>Edit AlphaMail Template (#<?php echo($template->id); ?>)</h3></td>
|
218 |
-
<td class="form-buttons">
|
219 |
-
<button type="button" class="scalable back" onclick="window.location='<?php echo($this->getUrl('*/*/index')) ?>'">
|
220 |
-
<span>Back</span>
|
221 |
-
</button>
|
222 |
-
<!--<button id="id_26f247951f2bac9680cc62fc1938c748" type="button" class="scalable delete" onclick="">
|
223 |
-
<span>Delete Template</span>
|
224 |
-
</button>-->
|
225 |
-
<button type="button" class="scalable save" onclick="save_template();">
|
226 |
-
<span>Save Template</span>
|
227 |
-
</button>
|
228 |
-
</td>
|
229 |
-
</tr>
|
230 |
-
</table>
|
231 |
-
</div>
|
232 |
-
<div class="entry-edit">
|
233 |
-
<div class="entry-edit-head">
|
234 |
-
<h4 class="icon-head head-edit-form fieldset-legend">Template Information</h4>
|
235 |
-
<div class="form-buttons"></div>
|
236 |
-
</div>
|
237 |
-
<div class="fieldset fieldset-wide" id="base_fieldset">
|
238 |
-
<div class="hor-scroll">
|
239 |
-
<table cellspacing="0" class="form-list">
|
240 |
-
<tbody>
|
241 |
-
<tr id="field_name">
|
242 |
-
<td class="label">
|
243 |
-
<label for="name">Name <span class="required">*</span></label>
|
244 |
-
</td>
|
245 |
-
<td class="value">
|
246 |
-
<input id="name" name="name" value="<?php echo($this->htmlEscape($template->name)) ?>" title="Template Name" type="text" class="input-text required-entry">
|
247 |
-
</td>
|
248 |
-
</tr>
|
249 |
-
</tbody>
|
250 |
-
</table>
|
251 |
-
|
252 |
-
<div class="c c_x2">
|
253 |
-
<div class="widget">
|
254 |
-
<div class="w_header wcolor_gray">
|
255 |
-
<div id="btn_html" class="w_header_text hdr_btn_active" onclick="text_html('html');">HTML-version</div>
|
256 |
-
<div id="btn_txt" class="w_header_text hdr_btn" onclick="text_html('text');">Text-version</div>
|
257 |
-
<div class="w_header_text" style="float: right;">
|
258 |
-
<div style="display: none;">
|
259 |
-
<div style="float: left; margin-right: 12px; margin-left: 10px;">Charset:</div>
|
260 |
-
<div style="float: left; margin-top: 4px; margin-right: 20px;">
|
261 |
-
<select class="txt" id="templ_charset">
|
262 |
-
<option value="utf-8" >UTF-8 (Unicode)</option>
|
263 |
-
<option value="iso-8859-1" >ISO-8859-1 (Latin1)</option>
|
264 |
-
</select>
|
265 |
-
</div>
|
266 |
-
</div>
|
267 |
-
</div>
|
268 |
-
</div>
|
269 |
-
<div class="w_menu"></div>
|
270 |
-
<div class="w_main">
|
271 |
-
<div class="w_main_inner">
|
272 |
-
<div id="div_html" class="w_main_inner2" style="margin-bottom: 12px; padding-top: 0; padding-left: 0; padding-right: 0;">
|
273 |
-
<div style="min-height: 210px;">
|
274 |
-
<div id="html_design">
|
275 |
-
<iframe id="html_design_frame" name="html_frame" src="<?php echo $skin_path ?>/editor.htm"></iframe>
|
276 |
-
</div>
|
277 |
-
<div id="html_source">
|
278 |
-
<textarea style="width: 100%; height: 210px;" id="html_version" name="html_version" class="txt" onclick="$(this).focus();"></textarea>
|
279 |
-
</div>
|
280 |
-
<div id="html_preview">
|
281 |
-
<iframe id="html_preview_frame"></iframe>
|
282 |
-
</div>
|
283 |
-
</div>
|
284 |
-
<div class="small_tab small_tab_active" style="margin-left: 4px;" onclick="source_preview(this, 'design');">Design</div>
|
285 |
-
<div class="small_tab" onclick="source_preview(this, 'source');">Källa</div>
|
286 |
-
</div>
|
287 |
-
|
288 |
-
<div id="div_txt" class="w_main_inner2" style="margin-bottom: 12px; padding-top: 0; padding-left: 0; padding-right: 0; display: none;">
|
289 |
-
<textarea style="width: 100%; height: 210px; padding: 0;" id="text_version" name="text_version" class="txt" onclick="$(this).focus();"></textarea>
|
290 |
-
</div>
|
291 |
-
</div>
|
292 |
-
</div>
|
293 |
-
</div>
|
294 |
-
</div>
|
295 |
-
</div>
|
296 |
-
</div>
|
297 |
-
</div>
|
298 |
-
</div>
|
299 |
-
</form>
|
300 |
-
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/alphamail/template/index.phtml
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php $row_offset = 0; ?>
|
2 |
-
<?php if($templates != null){ ?>
|
3 |
-
<style type="text/css">
|
4 |
-
table.projects-grid tbody tr:hover {
|
5 |
-
cursor: pointer;
|
6 |
-
background: #fcf5dd;
|
7 |
-
}
|
8 |
-
</style>
|
9 |
-
<form action="<?php echo($this->getUrl('*/*/save/')) ?>" method="post">
|
10 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>">
|
11 |
-
<div class="content-header">
|
12 |
-
<table cellspacing="0">
|
13 |
-
<tr>
|
14 |
-
<td><h3>Templates</h3></td>
|
15 |
-
<td class="form-buttons">
|
16 |
-
<button class="scalable add" onclick="window.location='<?php echo($this->getUrl('*/*/create')) ?>'; return false;">
|
17 |
-
<span>Add New Template</span>
|
18 |
-
</button>
|
19 |
-
</td>
|
20 |
-
</tr>
|
21 |
-
</table>
|
22 |
-
</div>
|
23 |
-
<div class="grid">
|
24 |
-
<div class="hor-scroll">
|
25 |
-
<table cellspacing="0" class="data projects-grid">
|
26 |
-
<thead>
|
27 |
-
<tr class="headings">
|
28 |
-
<th style='width:100px;'>Id</th>
|
29 |
-
<th style='width:auto;'>Name</th>
|
30 |
-
</tr>
|
31 |
-
</thead>
|
32 |
-
<tbody>
|
33 |
-
<?php foreach($templates as $template){ ++$row_offset; ?>
|
34 |
-
<?php $template_url = $this->getUrl('*/*/edit', array('id' => $template->id)); ?>
|
35 |
-
<tr class="<?php echo($row_offset % 2 == 0 ? 'odd' : 'even') ?>" onclick="window.location='<?php echo($template_url) ?>';">
|
36 |
-
<td class="a-left"><?php echo($this->htmlEscape($template->id)) ?></td>
|
37 |
-
<td class="a-left"><?php echo($this->htmlEscape($template->name)) ?></td>
|
38 |
-
</tr>
|
39 |
-
<?php } ?>
|
40 |
-
</tbody>
|
41 |
-
</table>
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
</form>
|
45 |
-
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Comfirm_AlphaMail</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Transactional email module for integration with AlphaMail
|
10 |
-
<description>The
|
11 |
-
<notes
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<contents><target name="magecommunity"><dir name="Comfirm"><dir name="AlphaMail"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Wrapper.php" hash="db8262d817c4ce48d1f62345c08a13ca"/></dir></dir><dir name="Test"><file name="Authentication.php" hash="7686ab33c59f030b27b79e1276cac5b8"/><file name="Diagnostic.php" hash="3e375f1cbda77c55c296c40c4881345b"/><file name="Send.php" hash="f11c197f6c4b856161e016817c7e3b51"/></dir></dir><dir name="EventLog"><file name="Grid.php" hash="5911af8cfb886fa36147f540d3bcfc44"/><file name="View.php" hash="1f0a1dc52906faa4281a666d35479f2c"/></dir><file name="EventLog.php" hash="232beb62abe256a00fc464e8fca91eb4"/><file name="Project.php" hash="5fa965c5eddd3486382cb65265c3236d"/><dir name="ProjectMapping"><file name="Grid.php" hash="c1401e84a84e6592ef8826d1c63cd46d"/><file name="View.php" hash="9b5ee5c105defd33a9216ec0de31c4fa"/></dir><file name="ProjectMapping.php" hash="4c28a21c88b2023ea5540c6f67aa23cd"/><file name="Template.php" hash="290489e9069ab313b799ae734e0774d0"/></dir><dir name="Controller"><file name="Abstract.php" hash="d4dfd8fb0addd5dd170f87c0108ae2c7"/></dir><dir name="Helper"><file name="Data.php" hash="20f1e98319cd11eec2cefdabf861ff2b"/><file name="Diagnostic.php" hash="4223e70e66661811ebc3f525f4e88b3e"/><file name="Message.php" hash="cc896454112bd7e5ffabf93cd8d1a0fb"/></dir><dir name="Message"><dir name="Customer"><dir name="Email"><file name="Confirmation.php" hash="dccbf4512ecf82b6c7d480845b293cfb"/></dir><dir name="Password"><file name="Renewal.php" hash="032b8969aed2ad37d1b94ef22e27c252"/></dir><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Update.php" hash="e9815267f403dec845c3d313a33d7eae"/></dir><file name="Invoice.php" hash="c452bd6b15666708cf6ec85e9a33f7e5"/><file name="Update.php" hash="be9a17636f526ff45fed3a3ddd02aa58"/></dir><file name="Order.php" hash="9ad01367fcdf10677eeb234b28c26e09"/></dir><file name="Welcome.php" hash="f712e596b45b679e65519615f85cea70"/></dir></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="ffea8a0d923c45c87657bcb347346141"/></dir><dir name="Event"><file name="Log.php" hash="8403425f64d04f2bb1439e6a3834b59f"/></dir><dir name="Mysql4"><dir name="Event"><dir name="Log"><file name="Collection.php" hash="46e23089ef49b668fb97ff43da6b48c9"/></dir><file name="Log.php" hash="fd0200706ad7966bbd5fdf9353e45f23"/></dir><dir name="Project"><dir name="Map"><file name="Collection.php" hash="803ab517739a8f08d5957703f8ba9a48"/></dir><file name="Map.php" hash="34b973bf31a675a38967f7958cf2605e"/></dir><dir name="Send"><dir name="Log"><file name="Collection.php" hash="56fc46a4771f5aee35ff65873638a501"/></dir><file name="Log.php" hash="464c694d0daf7cb8577ab2f8937394d4"/></dir><file name="Setup.php" hash="aada6ed95c86cfd9f370113da07bc5d2"/></dir><dir name="Project"><file name="Map.php" hash="1f5a87e55237c6670eecc772379e166c"/></dir><dir name="Send"><file name="Log.php" hash="0d1c8e64ac8ff890bb9e1922e7251993"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="General"><file name="EnabledDisabled.php" hash="9ffec22ca17202547c9433145f25a05b"/><file name="Fallback.php" hash="f291cc7a363a88611f3c5c747ac502fa"/><file name="NumberOfRetries.php" hash="a89384039313ce9b803f3db8c307250e"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="EventLogController.php" hash="0753ca3bfa420f78f6d99cd932274583"/><file name="ProjectController.php" hash="71d7cca50a0c2192b2daef4fa3c96987"/><file name="ProjectMappingController.php" hash="72a4205cff36a01b33623f92ed3a3bcb"/><file name="ProjectMappingController.php.bak" hash="72a4205cff36a01b33623f92ed3a3bcb"/><file name="TemplateController.php" hash="771f3d5da75061329556c007c2ba9e66"/><file name="TestController.php" hash="f4adc512f507137962c0f9bf7b9d0ede"/></dir><dir name="data"><dir name="integration_defaults"><file name="email_confirmation.htm" hash="0af80701addd67f08b7a65eed53b4853"/><file name="email_confirmation.txt" hash="1fd7862262ee58a52d4a8a30bf61dd9d"/><file name="new_order_confirmation.htm" hash="a8cf51d585b363d8d553bb8ce0ff5f64"/><file name="new_order_confirmation.txt" hash="4b56b0d2c85f5643818d79f423ac5488"/><file name="order_update.htm" hash="4e157ce58a5bccaa26ba36e842806233"/><file name="order_update.txt" hash="7de48e9852b6289df406576a0ccc9653"/><file name="reset_password.htm" hash="ed0211256b7440fbbca8b7d16376d49d"/><file name="reset_password.txt" hash="6773028cea907880444a8787f2afd832"/><file name="welcome.htm" hash="6ccad54654ca9ca8912b3df87cdf25df"/><file name="welcome.txt" hash="e3646d12b18c1d23d6f2ce12cc125c04"/></dir><dir name="queue"><file name="4981757f-c28d-7eab-8077-11f1b435a8af.msg" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="templates"><dir name="confirm-email"><file name="data.json" hash="b2c1f23a74a5d45048a79810ac34d793"/><file name="template.htm" hash="679b6fe1cfa539a96f11deab2793ce58"/><file name="template.txt" hash="45bc1a150cc8127d9817616269063ecf"/></dir><dir name="order-confirmation"><file name="data.json" hash="5afc62bdddd2288eb696a4bda47f7142"/><file name="template.htm" hash="d414ea4bbb02b097b5e6bbfb05dcdb75"/><file name="template.txt" hash="b36ce7f5e1e84430624182d355691930"/></dir><dir name="order-update"><file name="data.json" hash="c5b7dab7c2fe07b5e5b5002cd16d33bc"/><file name="template.htm" hash="7def6b5399a64d702a3771c33ee6e115"/><file name="template.txt" hash="19ad7bd063edb90531c894232e0ad89f"/></dir><dir name="reset-password"><file name="data.json" hash="b4fd944f24cdbacd14a2649d05c279a5"/><file name="template.htm" hash="3c12431c254fc09285394abdd8345c8b"/><file name="template.txt" hash="ab364988a3671130725ffd82a4df8499"/></dir><dir name="welcome"><file name="data.json" hash="f022638f409c6e2bcb5968dd8e4d2ad0"/><file name="template.htm" hash="34aac6cf1d039842b2f6c5fcda7cd1ea"/><file name="template.txt" hash="6083f8b255b619c73b71576110d5295b"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="97b6ac2a1f1678d7e980469187ce41f8"/><file name="system.xml" hash="cbd0f9e3e02648be8a2409efc5393c40"/></dir><dir name="libraries"><dir name="comfirm.alphamail.client"><file name="emailservice.class.php" hash="1376bfe3d519e4882fed14d8e7884194"/><file name="emailservice.interface.php" hash="a89a39c6b1ad0385dbade68c59a95d7f"/><dir name="entities"><file name="emailcontact.class.php" hash="912f82fac1e6dad67dd9fe120d74f527"/><file name="emailmessagepayload.class.php" hash="32f9ad93d54ca65fb3b0408de29f9694"/><file name="idempotentemailmessagepayload.class.php" hash="ee1944cf5a2a637483bc5902e53dce41"/><file name="project.class.php" hash="056cc2d219fd9e007f9d34388ec86122"/><file name="serviceresponse.class.php" hash="10cbc9761e304c877b0c28cd18fc0c8c"/><file name="signature.class.php" hash="951dc5667a0e492640b26aae33a61765"/><file name="template.class.php" hash="13cc09cb93fe9abc0c0c37a765c5f895"/></dir><dir name="exceptions"><file name="alphamailauthorizationexception.class.php" hash="f023fee677c1e3b39b56023d6ec37bfa"/><file name="alphamailinternalexception.class.php" hash="f904c1ca0b6f7fb67226863355f527ee"/><file name="alphamailserviceexception.class.php" hash="504a6296576fed58d195fb6628e52b6a"/><file name="alphamailvalidationexception.class.php" hash="ca0274cf5ef8b1dabe2a44fab1c9f5e7"/></dir><file name="projectservice.class.php" hash="a21bfebde404aa13ae732b85ef59dee5"/><file name="projectservice.interface.php" hash="4a54c7cfbf959d01b6946216a8613366"/><file name="signatureservice.class.php" hash="20c7d060b5f3808f978168fc93feaec4"/><file name="signatureservice.interface.php" hash="9a9b90a695aead0844b50df6f0823f8f"/><file name="templateservice.class.php" hash="7d85d6e6f9e8c634f5dcd51510818ada"/><file name="templateservice.interface.php" hash="245ad486b7d8568e0016db036575c1ea"/></dir><dir name="comfirm.services.client.rest"><dir name="httprequest"><dir name="filters"><file name="basicauthenticationfilterchainitem.class.php" hash="c5c8fdeae1ac8b04cc4d58e322c2f126"/><file name="httpchunkfilterchainitem.class.php" hash="69ff142a4c492956f341a16121be8327"/><file name="httpgzipfilterchainitem.class.php" hash="83df3eef9cb52298f0df1ad49a5ce9cb"/><file name="jsondeserializerchainitem.class.php" hash="a84baba1208ab0fec635a176490539b0"/></dir><file name="httpfilter.class.php" hash="d5e7dcd6771185e092ee08ce38933c57"/><file name="httpheadercollection.class.php" hash="3f1040d7f4ce7911695615dc1bab256a"/><file name="httppacketcompiler.class.php" hash="931ea0ee1b5e2ca207ed470b7bc2de29"/><file name="httppacketparser.class.php" hash="e1a7fbff36c380822b8e821d1268338d"/><file name="httprequest.class.php" hash="98d6fa9909046f0b58f69ba9e1680a61"/><file name="httpsocket.class.php" hash="7d4f62d933507f8a940b415d4d63d57b"/><file name="httptypes.class.php" hash="47e6c7485835c530d94df9195d080739"/></dir><file name="restful.class.php" hash="d7774372ebf1556fdd5248a95889281d"/></dir><file name="license.txt" hash="ea21b75a1e26825c31ae29f29a870a34"/></dir><dir name="sql"><dir name="alphamail_setup"><file name="mysql4-install-1.1.7.php" hash="4ed919c0b813b6b3f72a971976cd513a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="alphamail"><dir name="project"><file name="create.phtml" hash="5dca65c2cdd0d6900e80dde8fcbcaf70"/><file name="edit.phtml" hash="332c10bfa9ce04a947087ff2a1f5d94a"/><file name="index.phtml" hash="fc2db9090d54ec070eac43cb0eb2356b"/></dir><dir name="projectmapping"><file name="index.phtml" hash="0feec3a54e8937c05e282cb229dd8dd9"/></dir><dir name="system"><file name="config.phtml" hash="f06e7d737f4ece8550daec08521bfab5"/></dir><dir name="template"><file name="create.phtml" hash="0e67af73030069e69d635cef09bba1cc"/><file name="edit.phtml" hash="7b6b8408a55ddfcf4a0cc926757a3a1f"/><file name="index.phtml" hash="ae4295f2a4d9cfba2c8ad3980c41fdee"/></dir></dir></dir><dir name="layout"><file name="alphamail.xml" hash="aa8606064c27d8b77c401568e94c8d53"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Comfirm_AlphaMail.xml" hash="41e608f730e29ee308a440eef9e4a6d7"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="alphamail"><dir name="CodeMirror-2.18"><file name="LICENSE" hash="88a46883b83470458c36a0d3ceeb93d9"/><file name="README.md" hash="abd2e59dd0d5d1219ab3e51e18d02a78"/><file name="compress.html" hash="56998a9496450c0a7ced0a9531f7fb1e"/><dir name="css"><file name="baboon.png" hash="f8a5922c3789f6fdc9c688910b4a2fc6"/><file name="baboon_vector.svg" hash="cbb2a762cc2cc473a55866fd183fdfd8"/><file name="docs.css" hash="880f5eccb6a233dd37f13eeab0d77240"/></dir><dir name="demo"><file name="activeline.html" hash="ab199706cfe18636ab3cb223480cd338"/><file name="changemode.html" hash="32c56f356328a8c79dff7dde167bfa91"/><file name="complete.html" hash="516467b12d46b4be50d11b229ae89d37"/><file name="folding.html" hash="85d5ef327c7701a9ff8d086fefd28e15"/><file name="fullscreen.html" hash="7d31a67869847d6b0f1eaab9daa085f6"/><file name="marker.html" hash="b96a7021d667c26ba8cbb7d3b52f2d35"/><file name="mustache.html" hash="91b3265c79cc2927b5abfedaf4df4f36"/><file name="preview.html" hash="e729a5e789db6f936d64a71ee3b74550"/><file name="resize.html" hash="2f3cf3d4196ee196a223b2bc6deeb9ed"/><file name="runmode.html" hash="d2850d3fb891233d71c5431b0de60b4a"/><file name="search.html" hash="7ca9114ab2a6e60c27b58b465821564a"/><file name="theme.html" hash="cc226662183164d7704caa6acf3ef49a"/></dir><file name="index.html" hash="6f48cd162b449e02713027a4ba19d40a"/><file name="internals.html" hash="ede4bfc781a60ab1e5faf6ac57552e4d"/><dir name="lib"><file name="codemirror.css" hash="f8060f5669782ea8073c1284d6b0e087"/><file name="codemirror.js" hash="1d761d052bc976f7a1e3aa3e48c1e840"/><dir name="util"><file name="foldcode.js" hash="ce39cf73fd6e555a5e6a84413639d25f"/><file name="javascript-hint.js" hash="be61d8fab65f1b16371d2ec0138a30b0"/><file name="overlay.js" hash="4e8f55ef7aecb45e63a5878dbc26d0b4"/><file name="runmode.js" hash="6f9dbd4bc4b12114a1619272ba22c4af"/><file name="simple-hint.css" hash="55a5102f1b82825aa13530eb6f037d04"/><file name="simple-hint.js" hash="32d841403fa1f847af48b711e7dbf0b5"/></dir></dir><file name="manual.html" hash="87815b37b4d896f147464a5517322459"/><dir name="mode"><dir name="clike"><file name="clike.js" hash="77938b56bcb965edd958d227e6e435cf"/><file name="index.html" hash="fc0525c00a90e58dbb74f3dfa574e24d"/></dir><dir name="clojure"><file name="clojure.js" hash="d0e5f988c3518c075de6a8079090a677"/><file name="index.html" hash="cecb248e3c926b62e6aff08af0fe8667"/></dir><dir name="coffeescript"><file name="LICENSE" hash="e1d0a7e1594e557cab9810f441c2f3d7"/><file name="coffeescript.js" hash="32e1df9643f3c2e433f9e1ba8c58eb71"/><file name="index.html" hash="53b5623875a779ab3800a03463122d59"/></dir><dir name="comlang"><file name="comlang.js" hash="437f2676a63a4864e2250bcd9df57686"/><file name="index.html" hash="d5a4cbcfb8666aba65e5f53a595ba747"/></dir><dir name="css"><file name="css.js" hash="80303c4fcebe219d9a75ed2486881e2e"/><file name="index.html" hash="986ed418c167141c2f01f4dd14c8b341"/></dir><dir name="diff"><file name="diff.css" hash="9750bed5e2f10a2a741eeb07c0a0b357"/><file name="diff.js" hash="df1bb436730e745e233ab0dc707d0064"/><file name="index.html" hash="0bb8a6bbaf3f54bd62f2d0ff304c734c"/></dir><dir name="gfm"><file name="gfm.js" hash="0d260bd0c0c3e6adb8c75e9870d1891d"/><file name="index.html" hash="2dd1b5f08712c6c808cd51b9f84eb0e4"/></dir><dir name="groovy"><file name="groovy.js" hash="2c13ec060d697e4ee98a060c1059db6b"/><file name="index.html" hash="6f9c93412c3e668c8c3f666efc3f03c9"/></dir><dir name="haskell"><file name="haskell.js" hash="e76871c0327e7bb9f90a6ab0e5e8dfb2"/><file name="index.html" hash="377123b1ca9fa7e69c9f3d1931f3065f"/></dir><dir name="htmlmixed"><file name="htmlmixed.js" hash="a53dad6bf844179ef8ad7a97a235824d"/><file name="index.html" hash="7629a23ff67438789967d951455ea20c"/></dir><dir name="javascript"><file name="index.html" hash="2bd482f36c40f6b1c9be349971df31e9"/><file name="javascript.js" hash="56acd16588fe4784aee6a2022e4b2782"/></dir><dir name="jinja2"><file name="index.html" hash="81e9ec1512748b7271f36ffbd56e9a73"/><file name="jinja2.js" hash="f418f62b67673c1143c52307e345e60d"/></dir><dir name="lua"><file name="index.html" hash="d17f11d3ff03877102592de58de69fe0"/><file name="lua.js" hash="c050459e3362db3343af71d0e6aeb014"/></dir><dir name="markdown"><file name="index.html" hash="5c0e890607a034c2d4e598d0cb62cc4f"/><file name="markdown.css" hash="6735953493f16359bfec6fab20af1091"/><file name="markdown.js" hash="b61c6857255ba65dd56636d1365c8a02"/></dir><dir name="ntriples"><file name="index.html" hash="228cbcd044cc02cb8ad30fd5d16fe814"/><file name="ntriples.js" hash="3adc74e87ef632d3540d0963848a6cf7"/></dir><dir name="pascal"><file name="LICENSE" hash="7a13e129f06bac8fb1156a669c4636c0"/><file name="index.html" hash="2c8728310f260eb3aa0a926e90597ca1"/><file name="pascal.js" hash="308a0ea2a068438a315045e5817efd3b"/></dir><dir name="perl"><file name="LICENSE" hash="0cf35a34df2038120c040643ca531933"/><file name="index.html" hash="dec38a62b34d66761c277e9001aae052"/><file name="perl.js" hash="f5a5f217352184b4c739b562f920c229"/></dir><dir name="php"><file name="index.html" hash="d5a4cbcfb8666aba65e5f53a595ba747"/><file name="php.js" hash="0d61a4af8637da038d86de0a52c0c02f"/></dir><dir name="plsql"><file name="index.html" hash="3acffd02bd80c0037911918b9f15611f"/><file name="plsql.js" hash="5a870dcfa98f8760ed4410d08427c04f"/></dir><dir name="python"><file name="LICENSE.txt" hash="50497a84927d62f41da638f19d3e36f4"/><file name="index.html" hash="5e91951d7a6447827ac9647057f56957"/><file name="python.js" hash="86e97b8a98b1663f03776272ce065fb2"/></dir><dir name="r"><file name="LICENSE" hash="846da3e9d63e927277b2d936c172b813"/><file name="index.html" hash="12b3427c4ca0371e387b384a4253d7d9"/><file name="r.js" hash="396af242b11605841020fdb83c4a288c"/></dir><dir name="rpm"><dir name="changes"><file name="changes.js" hash="6f7d626f89cc4af3ab26063dac3660af"/><file name="index.html" hash="740f367b4272f56ef55232f57035b03d"/></dir><dir name="spec"><file name="index.html" hash="a454c2afa198c67769c7130e90fa013a"/><file name="spec.css" hash="baaddfcd14b6e7e60c8d48e59bccef3a"/><file name="spec.js" hash="f4bf6152a54b2c191aa7ec0ce00103e3"/></dir></dir><dir name="rst"><file name="index.html" hash="2f5be2eb7efe6da03cb81562c74e535b"/><file name="rst.css" hash="cc869157d3da08b60a566779676c256e"/><file name="rst.js" hash="6983b9861337a430d7e92bd7c386ef3d"/></dir><dir name="ruby"><file name="LICENSE" hash="ae314caf12af93dfb8362df71778b16a"/><file name="index.html" hash="717a66bb28bf9143b440daf6c6141fba"/><file name="ruby.js" hash="e53b08854aa102c06205b683ae7fb136"/></dir><dir name="rust"><file name="index.html" hash="dde843579b9fc83b94d2d45768449e18"/><file name="rust.js" hash="69bde2212f4b48276ad549d86005c308"/></dir><dir name="scheme"><file name="index.html" hash="5172505e4f0778d4578a429276441070"/><file name="scheme.js" hash="b58ca4c1c3053aea6a4602815abaa948"/></dir><dir name="smalltalk"><file name="index.html" hash="3eb4f1e329d1abb90ea03228e36a1541"/><file name="smalltalk.js" hash="2a82fb925ea2cd3e324ec6f135538c2c"/></dir><dir name="sparql"><file name="index.html" hash="d3d79fd3b0a6c4a2352f31a27d6c15cb"/><file name="sparql.js" hash="19620ecd6fd9b8cb12b9b6445dc99a4d"/></dir><dir name="stex"><file name="index.html" hash="ee54a341be3482e11c205c508aee6b63"/><file name="stex.js" hash="c4ae78f9885041330bbde8fc5648477b"/></dir><dir name="tiddlywiki"><file name="index.html" hash="7ba47f8e8f4e2216054bfb477326d3f6"/><file name="tiddlywiki.css" hash="c11cdeb53a780caea1e9e6991993cbca"/><file name="tiddlywiki.js" hash="17ddeee4501ee9a0b3564f04db277140"/></dir><dir name="velocity"><file name="index.html" hash="9576af6a2ec6bed38dad8d7055956953"/><file name="velocity.js" hash="1575d55bcca5ef56ab5d9b801ed5e452"/></dir><dir name="xml"><file name="index.html" hash="8f3532f29b5d5a033b8366c1a4d38d2b"/><file name="xml.js" hash="8dc718d2bc75044bb6d9edb24ea331a6"/></dir><dir name="xmlpure"><file name="index.html" hash="1f0b8a37a3b56099ebc730485c4b7ba0"/><file name="xmlpure.js" hash="72df6042f863cc00e0d04d6b9502116e"/></dir><dir name="yaml"><file name="index.html" hash="52f27134149d98fd7188cb0fcc9cc1ac"/><file name="yaml.js" hash="26ba9f1907540d18fbd73c5d385d70cb"/></dir></dir><file name="oldrelease.html" hash="0abc467fdaaa262735c81f79ececf842"/><dir name="test"><file name="index.html" hash="6f920394d5aa9c6add944c5647da99a0"/><file name="test.js" hash="4b34cc09d735ffe7cabc773991e823f9"/></dir><dir name="theme"><file name="cobalt.css" hash="693dbdb4e697861a71c10cd7ec94e4bf"/><file name="default.css" hash="54af177b325ef85fb6c3bc4d4e862c7c"/><file name="eclipse.css" hash="120d3cc1f7db6b14be43e2ae82d5ed51"/><file name="elegant.css" hash="f43d2300bfe91c488089b0dfea5b091d"/><file name="monokai.css" hash="b4fc30a108bec5a6bd57c9c2246cf2b5"/><file name="neat.css" hash="e535a6e8ad9e6a7f226fe7d9ef574036"/><file name="night.css" hash="1c234d0158d1df6b2c1f7dbfca37cdab"/><file name="rubyblue.css" hash="3bfad81098b8501420bdb84f6869f031"/></dir></dir><file name="ajax.js" hash="95e3d2f29bd50e08b48fcd0776eb2fd4"/><dir name="alohaeditor"><file name="build.txt" hash="0553303b2feffa9e81ac6ca1ab8e3dda"/><dir name="css"><file name="aloha-core.css" hash="3605b9d654ca34c4417e99ae2e6070bd"/><file name="aloha-sidebar.css" hash="7d8181f13550616f687f5f3212a83d0e"/><file name="aloha.css" hash="a61890aeae5a99ab9a7c55ef07d4b8ae"/><file name="ext-aloha-reset.css" hash="acd3011809fb5aaa8b6b0f328b75df9a"/><file name="ext-aloha.css" hash="00a960ed7ad9c332a52abd80835a00d1"/></dir><dir name="img"><file name="arrow-down.png" hash="15b608454fe4d1f84bb2e55a54df50df"/><file name="arrow-left.png" hash="23a5163bce8cc7a7b66e996e43519d82"/><file name="arrow.png" hash="8f703083439192ca2a9fdc5b98fdbe1d"/><file name="base-big.png" hash="971cd845a71d374c7ea595586a003b6f"/><file name="base-multi.png" hash="068176d2be92778302d5d66a50103160"/><file name="base.png" hash="7ab811012967c740e088aa5f45ddee50"/><file name="bg.png" hash="dd72fc7a9a7e1a497a7888c686c0a94f"/><file name="breadcrumb-divider.png" hash="e5cf164a060b378ab52f21442246700a"/><file name="fade-in.png" hash="881ee65f4be19978c475f00d8eb74b2a"/><file name="fade-out.png" hash="a297f0bf80102561cc2204bb2ad2e0bc"/><file name="gentics-logo.png" hash="513c60aca53485d9d35c497ef8f59638"/><file name="grabhandle.png" hash="254665304865f7dd6e75c1d5eb017fb9"/><file name="maximize.png" hash="5b7582ed5f6ba63b49bad7191a36c991"/><file name="multisplit-base.jpg" hash="72d4ebe0738d4884208b56a01600a430"/><file name="multisplit-close.gif" hash="922cb2deeb043af28292a252bad111d8"/><file name="multisplit-open.gif" hash="e03b4949496321ff1ebd2e1c3a03989c"/><file name="pin.png" hash="6671a4f722edea1e108acd0bf5e8083b"/><file name="removeformat.png" hash="a9d57740c710afb9709009fb08e28657"/><file name="text_indent.png" hash="47f0424810cb024b398abb451b29b3c9"/><file name="text_indent_remove.png" hash="efa6fcdf3acc185503792870899ecc11"/></dir><dir name="lib"><dir name="aloha"><file name="command.js" hash="20b5ea6aad884b06c25794abc23c8957"/><file name="console.js" hash="e3c2dbf5ed1bc617912d35130e6bc36f"/><file name="contenthandlermanager.js" hash="ba3ea21bb7188d70d5d1a1cfb8de3cc0"/><file name="core.js" hash="d8eed09123ca89e5deadb489e5f7a9eb"/><file name="ecma5.js" hash="dc5f43e9c1594f03ec8929e2217699e8"/><file name="ecma5shims.js" hash="122c9bf76a54bc9bcc4eef7dcceeb6f5"/><file name="editable.js" hash="d866af72a4c2843220cdb485cf885c9c"/><file name="engine.js" hash="df5e61a45c2290d4f83d345020244514"/><file name="ext-alohaproxy.js" hash="6c2e03a65e2091f9630c82dea8c048a0"/><file name="ext-alohareader.js" hash="f3680fcd84e17d300a5139da64f7a06f"/><file name="ext-alohatreeloader.js" hash="97485da95858a00f36a27fcc41be434b"/><file name="ext.js" hash="9873e64b725a024d1a6b4330467bf000"/><file name="floatingmenu.js" hash="87858829bc72b1c6b2b664c2d07d188b"/><file name="ierange-m2.js" hash="7df05cfe62d2c3fca71225d6a03a75ce"/><file name="jquery.aloha.js" hash="8d9bd56d06e5f077941279b76d5924dd"/><file name="jquery.js" hash="ba4796914487cd6905f70648dc03067f"/><file name="jquery.patch.js" hash="8c22b519107adad3d813cfa21a3a27f5"/><file name="markup.js" hash="1829e7b18c3be7c25dd64c05f5118bd7"/><file name="message.js" hash="4d3151187f946c1939958d6fe9b69e03"/><dir name="nls"><dir name="de"><file name="i18n.js" hash="fe8d2e4e3d4ba4f34394b80b529636aa"/></dir><file name="i18n.js" hash="017c05fe064f2a9d4ecf86ea92f4aba2"/><dir name="sv"><file name="i18n.js" hash="c11f7ad8fe60b843d4650d29a2811739"/></dir></dir><file name="observable.js" hash="df9083444a55b5bd16aa86b56ab8bf62"/><file name="plugin.js" hash="abcfb1833414681cac95611fccc5ba9e"/><file name="pluginmanager.js" hash="4fd58ae6cbdcd595ee6480657dcb0e29"/><file name="rangy-core.js" hash="808d11808cef29e69c3fca745ce25760"/><file name="registry.js" hash="9622b5494feff83747674b5563fdd81c"/><file name="repository.js" hash="90986b589e96c944647ae0160cb83a9a"/><file name="repositorymanager.js" hash="205ade45ec620568e5ef697792597ff1"/><file name="repositoryobjects.js" hash="5638a269215559e22410755701d86327"/><file name="selection.js" hash="396bf1c0ca5b4ec9f670cd06bc348fae"/><file name="sidebar.js" hash="566e085049947fb75884643c74bf679c"/><file name="ui-attributefield.js" hash="bdf910a9b10317a79e209ab478d683b5"/><file name="ui-browser.js" hash="daf94d6a6c2ff4556143e84fc02cd91d"/><file name="ui.js" hash="fd22470d30618ba4deaf97df6a27fd44"/></dir><file name="aloha-bootstrap.js" hash="ae9c0eaf48a7fe17a733dc0ae388b934"/><file name="aloha.js" hash="6dabe668345e850a171960c9cd50df72"/><file name="css.js" hash="b2c0b512cc6188ad44bffa106fdd8cbb"/><file name="i18n.js" hash="2cd46ebeed271c6d79bd397722e522ca"/><file name="jquery-plugin.js" hash="886143e448dc7fab6f95076a0a07e77f"/><file name="order.js" hash="061959d61b8c7cb50d28797920c78514"/><file name="require.js" hash="03baff51cfb2419fe4a32bb245ee5684"/><file name="text.js" hash="c64b58411b743e3ca956fba73db0b7ba"/><dir name="util"><file name="class.js" hash="b6e58d2e3db1eb104acfafa612abdddc"/><file name="dom.js" hash="f55cda9d6e55aca8176416f82cf47d90"/><file name="json2.js" hash="391d5fc3498e5f1f23ea4dc8ba43c0c5"/><file name="lang.js" hash="17daf04cd7616c6061b7d1d11d07b0dc"/><file name="position.js" hash="e8da37f7e856ee2944cc2c0b4382d14d"/><file name="range.js" hash="c346272d513947335ee57551897c8ebc"/></dir><dir name="vendor"><dir name="ext-3.2.1"><dir name="adapter"><dir name="jquery"><file name="ext-jquery-adapter-debug.js" hash="13de37837f6f913c7da6f3bd83fdf60c"/><file name="ext-jquery-adapter.js" hash="eade1cfd0267ab2bf5ae23dd823b65c2"/></dir></dir><file name="ext-all-debug.js" hash="f06105c6b9ae5ddb2cde43014ebebe2d"/><file name="ext-all.js" hash="bf80a5438d598701a67630b962352d3f"/><file name="gpl-3.0.txt" hash="3c34afdc3adf82d2448f12715a255122"/><file name="license.txt" hash="c0a50aa77c22b5a3a7e54fec34cb54f0"/><dir name="resources"><file name="charts.swf" hash="59c6e2c9ae7de87f11dd3db3336de8b6"/><dir name="css"><file name="ext-all.css" hash="0feb438d6d85a6214101e895f945fa46"/><file name="ext-all.less" hash="37b2f7f0f54ae223d17332b1baed0073"/><file name="xtheme-gray.css" hash="514b32821be653201c8f8d91de0b5a05"/></dir><file name="expressinstall.swf" hash="8c4bdc47410fc7c000dcd1655e2f3a7a"/><dir name="images"><dir name="default"><dir name="box"><file name="corners-blue.gif" hash="86fd4c5664e0971bfc11959e8442604c"/><file name="corners.gif" hash="d2d1bc2085b369ce35ffd20c0121676e"/><file name="l-blue.gif" hash="ced9ffbf66ea39e77083a591f8257267"/><file name="l.gif" hash="c4d9dbbdc59ae06b5e9e72a6a865c981"/><file name="r-blue.gif" hash="82dbb522a80e3246f6297719371a9494"/><file name="r.gif" hash="bf1e1d4a45f951ae656968a8c834f04a"/><file name="tb-blue.gif" hash="7c4b19eb682afdc1bde0640d2321fb25"/><file name="tb.gif" hash="dd3f63afe7ba90983ba73dad1c66bf2f"/></dir><dir name="button"><file name="arrow.gif" hash="44b6dbf385236a2697932a7a3e20b4a0"/><file name="btn.gif" hash="40ac871755023cc11ad15dcd77b54dbf"/><file name="group-cs.gif" hash="5dc0252bd9ecf72f98d858427054cf08"/><file name="group-lr.gif" hash="cb7813012d6be17e083835d60037029e"/><file name="group-tb.gif" hash="4edf9b7db13b1331282eed298384cab9"/><file name="s-arrow-b-noline.gif" hash="30d04f652551f1df9d59d33a99c9a320"/><file name="s-arrow-b.gif" hash="a957a6d618d19b92a2d1a7a1b50f5235"/><file name="s-arrow-bo.gif" hash="53a15d7907a017122f7f60402c435753"/><file name="s-arrow-noline.gif" hash="13f08a275c58135365b8e58b3177ab1a"/><file name="s-arrow-o.gif" hash="5005d8dea2f9456aaf2ab27ca7bf5651"/><file name="s-arrow.gif" hash="bc71296ddf9c7ef5aa56b09ca3512c8a"/></dir><dir name="dd"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-no.gif" hash="ae536c37391ba78143b5c8283cec8d13"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/></dir><dir name="editor"><file name="tb-sprite.gif" hash="a2f06caddc2fb729db5cbbd874491128"/></dir><dir name="form"><file name="checkbox.gif" hash="75d685cab5665a935660a3d04f71c2be"/><file name="clear-trigger.gif" hash="97b3e5e9edf27b50d63d48098c2f1eae"/><file name="clear-trigger.psd" hash="c8c2d843458728df5c184a54862c5946"/><file name="date-trigger.gif" hash="30b5bace9f3dac358716c1415270f874"/><file name="date-trigger.psd" hash="3f10ecf0d961006507d043f9b9fce45e"/><file name="error-tip-corners.gif" hash="364474276178c7b48b6270056b42b808"/><file name="exclamation.gif" hash="37dbe02e3cbde0f6780650bfd8535e38"/><file name="radio.gif" hash="0239bdaef529be68530b86266a24742c"/><file name="search-trigger.gif" hash="559ef372cf27a38678d84e8c0b7237fc"/><file name="search-trigger.psd" hash="daacfb6d450b8cd56da5905db4c8b8c0"/><file name="text-bg.gif" hash="d5ba54c1f417e6a72cbce8b909078727"/><file name="trigger-square.gif" hash="c1cbaecc91209f77e2d20235c137e13e"/><file name="trigger-square.psd" hash="5e66abd0fa1313bd052db7d121f626c1"/><file name="trigger-tpl.gif" hash="d7be20f0dc38f4f46cd318fe32cf3ce3"/><file name="trigger.gif" hash="447d5b600f7527f5c8cc49e7453bbb27"/><file name="trigger.psd" hash="513a8c601e278a35a3cb3272fd1769df"/></dir><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><dir name="grid"><file name="arrow-left-white.gif" hash="b04e859bdcbd21ad1f06b8bfa7881df8"/><file name="arrow-right-white.gif" hash="714eb00f8134dde3a65c83f3f71ad2c4"/><file name="col-move-bottom.gif" hash="9c38bcb5cee1dc9b4ce64ad9ab1386f8"/><file name="col-move-top.gif" hash="c4584202d5172464050f675d396d1c6f"/><file name="columns.gif" hash="ef35242fa6514a81d17d5f700f561b7c"/><file name="dirty.gif" hash="decca3b96e2c37cf6eb04ddb0d9f669b"/><file name="done.gif" hash="365266930a93451414fe51ffc524a196"/><file name="drop-no.gif" hash="b53ca86d60fbcc7a45c8917299218bfd"/><file name="drop-yes.gif" hash="af96f4c3b32a470db2f38abb521b5c97"/><file name="footer-bg.gif" hash="65ed63e44c6149f1127ad3b4be4e0108"/><file name="grid-blue-hd.gif" hash="dd35d5c1202c440c2d1a945b335984d3"/><file name="grid-blue-split.gif" hash="0494ba49974ff2bc1bf81e1d82dfee18"/><file name="grid-hrow.gif" hash="55972a5063d80f35fb6b95a79bb0018a"/><file name="grid-loading.gif" hash="9ac6f737eb9b15272f12b00bfeb3c3c6"/><file name="grid-split.gif" hash="3ef419d4b9421d8e94f673a6238dc4c0"/><file name="grid-vista-hd.gif" hash="675f403e8a9cb5ab4bed725da9fe2023"/><file name="grid3-hd-btn.gif" hash="e3e77072c16a6b27556236961f29c552"/><file name="grid3-hrow-over.gif" hash="a92d8f6c106943995720f2884634670e"/><file name="grid3-hrow.gif" hash="3e4484ea8db10af1320808c8477346ea"/><file name="grid3-special-col-bg.gif" hash="c9df03a1c107360128da89fa47066405"/><file name="grid3-special-col-sel-bg.gif" hash="a94039f89dec164896ceff1fbdf6dbc5"/><file name="group-by.gif" hash="3ff8c5936e358cf213227509c9bee95a"/><file name="group-collapse.gif" hash="fd6a72ffa784170d83f9f13322266ca8"/><file name="group-expand-sprite.gif" hash="d0f614a387292177f3acb0c95a4cd760"/><file name="group-expand.gif" hash="8a9ad3ed3d74c2911b7f101268a1843b"/><file name="hd-pop.gif" hash="e5f27a2f68cc2d13b11cf41c46d298dc"/><file name="hmenu-asc.gif" hash="048e0bc30f7c39d473dad5dabcbe03f2"/><file name="hmenu-desc.gif" hash="f0a987b34b003b25a7c82624d41f018a"/><file name="hmenu-lock.gif" hash="bcef18e25342c69c37c44dab87086065"/><file name="hmenu-lock.png" hash="2a3b0b441834f443c1086930939efdae"/><file name="hmenu-unlock.gif" hash="8cc8205dafa587ef02d8a86903ae8074"/><file name="hmenu-unlock.png" hash="c1f61df70b98c5498ea81e7e7b9effbb"/><file name="invalid_line.gif" hash="04a88e97b56e8a8ece4a66d49cc78828"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="mso-hd.gif" hash="37fba9c02f0eefe57f655890eef1c4a1"/><file name="nowait.gif" hash="23c91166dbb16ba8655363321bf5a400"/><file name="page-first-disabled.gif" hash="8d3185028c541cbcce67b5909c04824e"/><file name="page-first.gif" hash="16ec00fa770d860b768cf5034ddfca96"/><file name="page-last-disabled.gif" hash="1d123237ceeb5109a1b9274f0cf19d73"/><file name="page-last.gif" hash="ef524dd0b8dfe4eefecffaa1c0bb8edd"/><file name="page-next-disabled.gif" hash="0f4b8681772c91921fa93ede9c755ea0"/><file name="page-next.gif" hash="f6f9d2209dfc99912ffc9848d97646db"/><file name="page-prev-disabled.gif" hash="eefcbed15c8d37a89618b08f7b224297"/><file name="page-prev.gif" hash="80daad880483eed682b22ec70514ecc4"/><file name="pick-button.gif" hash="b431fdf306f1e2f033d0a431996de93f"/><file name="refresh.gif" hash="f1a2e7df30394c5a30bc76c2d09013b7"/><file name="row-check-sprite.gif" hash="2d0aa7e501c3e6f97a97faf75e35d3c3"/><file name="row-expand-sprite.gif" hash="be81199d9d4fa69bef47a8f036a5a7d8"/><file name="row-over.gif" hash="f639094bd0560aefabc86e51a825f23d"/><file name="row-sel.gif" hash="ca87d6b950386edd5e17c985769d9101"/><file name="sort-hd.gif" hash="2640addef6e987b4c5dfa4c8c2dfb10c"/><file name="sort_asc.gif" hash="2352874b5f636ca331fe9509a2f9bdd7"/><file name="sort_desc.gif" hash="d104fcf119d40c51554ddb8b377142e5"/><file name="wait.gif" hash="b0cd5a5dc070c705ebf8814a909802c3"/></dir><dir name="layout"><file name="collapse.gif" hash="dfcec0803d488a783916c750fd83a897"/><file name="expand.gif" hash="c9c9b0ea5311c3dc016c69dc234912bc"/><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><file name="mini-bottom.gif" hash="ae8e3674fd32997dc5217d5d6199a5a5"/><file name="mini-left.gif" hash="8654fdb45ecf4406af2fce1d3beb7596"/><file name="mini-right.gif" hash="cbdf9fb0c45466b4217ac9f7bd6a9ed4"/><file name="mini-top.gif" hash="fbd91e98576f66fd2702495251b15240"/><file name="ns-collapse.gif" hash="efa9fbd7a1f3f0f1f22360391e16126f"/><file name="ns-expand.gif" hash="da1f9d40c091d3b6dc7a8dee4fc02ac6"/><file name="panel-close.gif" hash="b185da1837344529bfb684a96d8371b5"/><file name="panel-title-bg.gif" hash="b66384c309a397963389a76b07e9ecd4"/><file name="panel-title-light-bg.gif" hash="688d3a263442db125da170e5d3aebf70"/><file name="stick.gif" hash="be9e67ae0b61b01cfd15928ca7a3da51"/><file name="stuck.gif" hash="745e0cacb51250ea0216efc4a1cb50cb"/><file name="tab-close-on.gif" hash="0ae2c978e85391a69f0dce8da18d8b23"/><file name="tab-close.gif" hash="f92107cc6b4cb78af084648a628e01d2"/></dir><dir name="menu"><file name="checked.gif" hash="cb7b3408df56f5585aaa1242cd2f0b45"/><file name="group-checked.gif" hash="f7973443d91e5e074013f1b07ee79479"/><file name="item-over.gif" hash="bb4cdc0ea257834cd5ed01f883387d8f"/><file name="menu-parent.gif" hash="d303ad7e3ced891736e80f77e1d4e51d"/><file name="menu.gif" hash="ae128d5f3f3a39213f3d4e23aec8728f"/><file name="unchecked.gif" hash="31846118bddc7945b595ea2090589cf1"/></dir><dir name="panel"><file name="corners-sprite.gif" hash="d4546c86ed835fee767212279ee98b68"/><file name="left-right.gif" hash="6553647bad54d83e2c235f339d12f6be"/><file name="light-hd.gif" hash="b058affcc8b3e8a03be74bc9d9697da7"/><file name="tool-sprite-tpl.gif" hash="e0449768cd5dce80b18fac904818ab33"/><file name="tool-sprites.gif" hash="c2ac6edef318ed18a0efcc9c74c7a81b"/><file name="tools-sprites-trans.gif" hash="8331513f15bd26be38974a7d7fc4ee41"/><file name="top-bottom.gif" hash="a4854e1b3aea60123522cb687a462c05"/><file name="top-bottom.png" hash="2a65a27def756a0951644b511f6f2cce"/><file name="white-corners-sprite.gif" hash="81f089d0247ca1ad12093be21884d773"/><file name="white-left-right.gif" hash="77a6389c6737ad507ca5330ad8816524"/><file name="white-top-bottom.gif" hash="f865d7237bff3c45fd4a8c448f97d236"/></dir><dir name="progress"><file name="progress-bg.gif" hash="fd75abcd9d1cb8534f24f438a71e6fd8"/></dir><dir name="qtip"><file name="bg.gif" hash="49c0a530cc16357bb39d51c13065a88f"/><file name="close.gif" hash="0379d036250096cae2e42b427b3df2e7"/><file name="tip-anchor-sprite.gif" hash="f39bc3283b69431ce6e7aed2fe6882b9"/><file name="tip-sprite.gif" hash="090b2d83952e682fab43b2ab16be2991"/></dir><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/><file name="shadow-c.png" hash="7ab6163237099f2529452b88953a4049"/><file name="shadow-lr.png" hash="986270d8ab4330fa7499dc33ed135598"/><file name="shadow.png" hash="860bf4f690d2ea2aba7b11500925da62"/><dir name="shared"><file name="blue-loading.gif" hash="dc2fd7c0ed853c56b4ac65710af3bd0a"/><file name="calendar.gif" hash="81296cff1f97f5365524f2b9dcf626da"/><file name="glass-bg.gif" hash="bc2cd5c5ac9b3874d956c892d23f2119"/><file name="hd-sprite.gif" hash="6a54ae98bef53397d52282201852c204"/><file name="large-loading.gif" hash="d96f6517e00399c37a9765e045eaaf22"/><file name="left-btn.gif" hash="6bf30c6cf0b5d70436c3e463b5532b35"/><file name="loading-balls.gif" hash="ac062b94ed674aaa50a6c18df92acdf3"/><file name="right-btn.gif" hash="e7ad3a7f4814791cecf1b90e77e9e139"/><file name="warning.gif" hash="448dc934a7f0dd6092b51f88a1e47b2d"/></dir><dir name="sizer"><file name="e-handle-dark.gif" hash="b86289f41d7ad1a7401dd2b2a9b3c3d8"/><file name="e-handle.gif" hash="510edc95ebaa36306916c50ca10596f7"/><file name="ne-handle-dark.gif" hash="115f71b851c7f0b5f354caa7b8dfff15"/><file name="ne-handle.gif" hash="8e268b962dc909d275997b572ff17a72"/><file name="nw-handle-dark.gif" hash="4a361e6920b2e34a39fd425a515c83b9"/><file name="nw-handle.gif" hash="1120600505249c38c3d1cc2ab120cd13"/><file name="s-handle-dark.gif" hash="4a6bf15d308a4ae580dd03cbd431a95c"/><file name="s-handle.gif" hash="5e3338cb09e9df7f52383d6b1423fc86"/><file name="se-handle-dark.gif" hash="f3d8d8aac23e3e9633072e2366cda847"/><file name="se-handle.gif" hash="71edc3f63f79f447d2c81ee09e1fbbc3"/><file name="square.gif" hash="4431ea1954bfd2a9cea0931f07fc7ffa"/><file name="sw-handle-dark.gif" hash="44b2400d873cf8a23d84424827cde44d"/><file name="sw-handle.gif" hash="c3e0befc4208a51180344765fd7deeda"/></dir><dir name="slider"><file name="slider-bg.png" hash="0903ad3af985419767a60a5b025e0a18"/><file name="slider-thumb.png" hash="24a893c9606f3a6892eb62f29a08870c"/><file name="slider-v-bg.png" hash="0682c28925a7296730f7f221e4a76b96"/><file name="slider-v-thumb.png" hash="2fc3430dc351d9a118e048b9aafb7c3c"/></dir><dir name="tabs"><file name="scroll-left.gif" hash="f1ce5158650880e9fe256e739f60dd23"/><file name="scroll-right.gif" hash="905ea778cb64c74ef3cd49ae4fa64b71"/><file name="scroller-bg.gif" hash="43457068d919fadd0e959542cfd81ad2"/><file name="tab-btm-inactive-left-bg.gif" hash="ed19092d440c5bfbdc864f714f26ee03"/><file name="tab-btm-inactive-right-bg.gif" hash="c3f340dc9f7f9398e1395f351e706dfd"/><file name="tab-btm-left-bg.gif" hash="768ac4e5531974feda076cbca7a5cb6e"/><file name="tab-btm-over-left-bg.gif" hash="f7f13c4c2a7c1e3497b2f8931227df3f"/><file name="tab-btm-over-right-bg.gif" hash="7bf3f17738b6c53f6a3f08760eaa5089"/><file name="tab-btm-right-bg.gif" hash="dfe63a170d5391d56645dbfed27b5d22"/><file name="tab-close.gif" hash="59304a56f5e0f506bf671aeafb8fc767"/><file name="tab-strip-bg.gif" hash="5b1b94e9669aaab4e76e5aba8bf8ec1d"/><file name="tab-strip-bg.png" hash="d99e3b7b2610f3c85aa943fe139e6afa"/><file name="tab-strip-btm-bg.gif" hash="f76eec7881fcc7a0f76354d184e0087e"/><file name="tabs-sprite.gif" hash="2562a17ad0076bdd3711d18e62f74c27"/></dir><dir name="toolbar"><file name="bg.gif" hash="b795052041aa76a42466b3be5575077f"/><file name="btn-arrow-light.gif" hash="fa49b39a0fd88ef26264da44a2b4edea"/><file name="btn-arrow.gif" hash="12bda29a4c8016cfa047e852c4353f59"/><file name="btn-over-bg.gif" hash="faddf9b24cefa721326ba3f87f3ef31f"/><file name="gray-bg.gif" hash="cf2d9408f320e696e607d8472afa7ff0"/><file name="more.gif" hash="15c7a30d4131305b672fe1e76d962d4d"/><file name="tb-bg.gif" hash="5309337fd7a22cab9d9467fd9eaa0a0c"/><file name="tb-btn-sprite.gif" hash="ba0a5d77db72942782fc4bf23f710738"/><file name="tb-xl-btn-sprite.gif" hash="3ffd5589b41889230755ea2108cc0e92"/><file name="tb-xl-sep.gif" hash="06e026387e2dd0f49e88a04791cf26fa"/></dir><dir name="tree"><file name="arrows.gif" hash="ab65037de34763ce1b489e5c0f12185d"/><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-between.gif" hash="edb544a0de58547d4a39c526e06e3c82"/><file name="drop-no.gif" hash="67f83ea04a2eb1c50614a96faf625f25"/><file name="drop-over.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-under.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/><file name="elbow-end-minus-nl.gif" hash="5e5bffba157eceee7989db95b919e4d5"/><file name="elbow-end-minus.gif" hash="a469f6a4394d797c2efeffc70409f6db"/><file name="elbow-end-plus-nl.gif" hash="f0f50c0dd3ee6dd4b11c1f245b36eb01"/><file name="elbow-end-plus.gif" hash="ec1482391363612d9e5f8c7087fddaba"/><file name="elbow-end.gif" hash="345551384aa325189ba28a1c20f3405e"/><file name="elbow-line.gif" hash="90e478158df476dc989a60daaafc87e6"/><file name="elbow-minus-nl.gif" hash="5e5bffba157eceee7989db95b919e4d5"/><file name="elbow-minus.gif" hash="71bb1bd44b1274c60d30dba1de472ed7"/><file name="elbow-plus-nl.gif" hash="f0f50c0dd3ee6dd4b11c1f245b36eb01"/><file name="elbow-plus.gif" hash="945572d06a74b5f952251a86c595f2da"/><file name="elbow.gif" hash="27679f3b1222ba95d9925885d7d82d02"/><file name="folder-open.gif" hash="c569141d6ae7c61d838ed8af26aa9380"/><file name="folder.gif" hash="b7209740bb4a825a06beb8698d92c2b1"/><file name="leaf.gif" hash="23757d6e353f343e3c7edfe28428f198"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/></dir><dir name="window"><file name="icon-error.gif" hash="f477b54b6b8361362e96c2218dce7ea0"/><file name="icon-info.gif" hash="ec6b7a5d4caeea767c8674689bae47c6"/><file name="icon-question.gif" hash="2713644a8aa582728d71e35eca62fbcd"/><file name="icon-warning.gif" hash="3f20258272af0e00f6b7531b3b9aee35"/><file name="left-corners.png" hash="1d8a9cdb663e292ab70def47094dc528"/><file name="left-corners.psd" hash="18618115985e5905c7a6345c3ef0255a"/><file name="left-right.png" hash="d65dd5318f003143927bc0d7c5ff6e2f"/><file name="left-right.psd" hash="029c8ba62b77e910b07764e324c32a84"/><file name="right-corners.png" hash="e7c4dad6996685750acfba2f4e29115a"/><file name="right-corners.psd" hash="51aea4dd6bbdedf7923342e43bacbb7a"/><file name="top-bottom.png" hash="4f1e86207b228c192c2e243f77854adb"/><file name="top-bottom.psd" hash="826ca83fb9892be49f1b1aaaf61fd6c4"/></dir></dir><dir name="gray"><dir name="button"><file name="btn-arrow.gif" hash="9e2365ef98c6096f6b5f411ab618bb4e"/><file name="btn-sprite.gif" hash="945adfe198d7231a1c1ad761c353a405"/><file name="btn.gif" hash="dfa89e24b5dca6731dc699ba8d56950a"/><file name="group-cs.gif" hash="6d1c2edcd710057762396ccff6b5a33f"/><file name="group-lr.gif" hash="61b5fce46df447e1076ccc7037836b5c"/><file name="group-tb.gif" hash="828252b241154dbe45716a64a7bebe63"/><file name="s-arrow-bo.gif" hash="c455519fc9ff5b43c1f19a5cdbfc6b7c"/><file name="s-arrow-o.gif" hash="11e75d35ed05d06d42ee48366853f770"/></dir><dir name="form"><file name="clear-trigger.gif" hash="814bc78e7d14264bd024dee10717d1f9"/><file name="date-trigger.gif" hash="53d247e91d07172526a17e66e3365b0a"/><file name="search-trigger.gif" hash="5e093905f73ff1bd885a972f9298a6ae"/><file name="trigger-square.gif" hash="993f3e139f8153108cf36246e6c13304"/><file name="trigger.gif" hash="fce4c76ce39c38ea12f63aae88260b66"/></dir><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><dir name="grid"><file name="col-move-bottom.gif" hash="4caef6fed1128b1e28efd611b1d05b75"/><file name="col-move-top.gif" hash="19e021b4eb21053d55236115d1d7151d"/><file name="grid3-hd-btn.gif" hash="614e2bfd1aee447b6c06b4952b747553"/><file name="grid3-hrow-over.gif" hash="a198f359b87cbc5df0d99bfa8bed268c"/><file name="grid3-hrow-over2.gif" hash="599fa1925a97da601a5d600cc053bdc3"/><file name="grid3-hrow.gif" hash="3e4484ea8db10af1320808c8477346ea"/><file name="grid3-hrow2.gif" hash="327fa686bcaaf02a305d56a801fd2bab"/><file name="grid3-special-col-bg.gif" hash="bef8da30fbdebda6c46c52ec677aa7fd"/><file name="grid3-special-col-bg2.gif" hash="e01a722fad667447946194168335723c"/><file name="grid3-special-col-sel-bg.gif" hash="604dae97d814027ec90ea893bd82aac6"/><file name="group-collapse.gif" hash="94415d98e2a80ba4032cc2f1d7e39180"/><file name="group-expand-sprite.gif" hash="7e6f947a866eeb249ef07e7149a08301"/><file name="group-expand.gif" hash="5cb72da3f62a00c819271e1e4bd4b064"/><file name="page-first.gif" hash="4a7421d31823d53cc6483adebbf4e612"/><file name="page-last.gif" hash="79765f1921de6b5c3876d2137d1bb6b9"/><file name="page-next.gif" hash="3aede076a4e04cbb9ec3f5e9366eb85f"/><file name="page-prev.gif" hash="d3feff4ce5031c61236d08081acd5e32"/><file name="refresh.gif" hash="c8e02891ee272feb291fb3e1d160aca7"/><file name="row-expand-sprite.gif" hash="af003a335c529b768ae54341c55f286d"/><file name="sort_asc.gif" hash="cee26d5226e56e505af9fe2e92b703e4"/><file name="sort_desc.gif" hash="8d391c69a118af01c77fe812da2317d0"/></dir><dir name="menu"><file name="group-checked.gif" hash="7fb15d614b479da1164de9c213e4b4c4"/><file name="item-over-disabled.gif" hash="ef4c60a3965660a40aaac87434cd47b6"/><file name="item-over.gif" hash="448c69a3758682479a5cb532b5df902a"/><file name="menu-parent.gif" hash="f95f840cbfda084c891ed6e9841fd4e2"/></dir><dir name="panel"><file name="corners-sprite.gif" hash="154047c3b38abc110a43c348ea693c77"/><file name="left-right.gif" hash="1050c80869b13c1bcca6319b048ea1a5"/><file name="light-hd.gif" hash="30be5fa3a5bc389f4de260e91ff24f5b"/><file name="tool-sprite-tpl.gif" hash="4b1322b5966a588abb0829b27818f738"/><file name="tool-sprites.gif" hash="2f408e54b7eff4f7d95a5271cb77d58b"/><file name="tools-sprites-trans.gif" hash="cae0c8ca75402cc7e096b743abbf154c"/><file name="top-bottom.gif" hash="2cc75c4c076232ba842d63778e20aaf6"/><file name="top-bottom.png" hash="2a65a27def756a0951644b511f6f2cce"/><file name="white-corners-sprite.gif" hash="c22ed792c859ce8dcdfd52f6d6b15e3f"/><file name="white-left-right.gif" hash="52d662a46dc90b5043765f2d6d0c1acd"/><file name="white-top-bottom.gif" hash="67dc9d08c730ee91bdcf078d5071580a"/></dir><dir name="progress"><file name="progress-bg.gif" hash="adc5ea35c3741781897e075608b6c92f"/></dir><dir name="qtip"><file name="bg.gif" hash="63f297dd8fa77f097616d840e9ad0e70"/><file name="close.gif" hash="0379d036250096cae2e42b427b3df2e7"/><file name="tip-anchor-sprite.gif" hash="d5449663db06c74c4d8fada9b2572ff9"/><file name="tip-sprite.gif" hash="93e366d85a0cbd19cb6001a9254dfa2c"/></dir><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/><dir name="shared"><file name="hd-sprite.gif" hash="dcfc6da1969e38360f4a0b858303fe27"/><file name="left-btn.gif" hash="fdcd1ea713557afe17bd7412a490c329"/><file name="right-btn.gif" hash="192c5bc33dd9f780439db51c8777dc4f"/></dir><dir name="sizer"><file name="e-handle.gif" hash="b92c94b88dfd8743226fa470f1496801"/><file name="ne-handle.gif" hash="fbd3e5f90df02cc9084ba43a40dafb60"/><file name="nw-handle.gif" hash="b1cbf1aa7df6305701152f0708f2a5b2"/><file name="s-handle.gif" hash="ce25405d986f9c38a6b61e6291aecf4b"/><file name="se-handle.gif" hash="a71d1f8a7d1d1e554bac77d838c1e1d2"/><file name="square.gif" hash="0ce14318c0a8643d11e723f2c95b3cb1"/><file name="sw-handle.gif" hash="7e8854d3f963767ccbafd3e4fb4f4a26"/></dir><dir name="slider"><file name="slider-thumb.png" hash="aae90a90a30074bed9aec149d39f0864"/><file name="slider-v-thumb.png" hash="80a24e024df1ece670f4a074f11b91ca"/></dir><dir name="tabs"><file name="scroll-left.gif" hash="2e262700bde38f1a5e0b433bff392e5d"/><file name="scroll-right.gif" hash="1333d896f57dfdcc8b73b4a391af8c65"/><file name="scroller-bg.gif" hash="85fc3011aa8416fc9f6cd6cdfee8ff54"/><file name="tab-btm-inactive-left-bg.gif" hash="79692d0d06efdfee4352eb2313fc405f"/><file name="tab-btm-inactive-right-bg.gif" hash="2f38f98c02e576e7c07abab79b635599"/><file name="tab-btm-left-bg.gif" hash="174345d57983dcf5d38ed7717b3a17b3"/><file name="tab-btm-over-left-bg.gif" hash="84c12e3dfab9d5db75d05c0057a8cb63"/><file name="tab-btm-over-right-bg.gif" hash="661d17f45d9bd60be78d7b62931821f6"/><file name="tab-btm-right-bg.gif" hash="904bd37fe0eac4fd2e42adc3693eeed3"/><file name="tab-close.gif" hash="9ed7d602bee0483b8aa34d2084c77754"/><file name="tab-strip-bg.gif" hash="5b8f86def656924e8d4e49e438a205a1"/><file name="tab-strip-bg.png" hash="d99e3b7b2610f3c85aa943fe139e6afa"/><file name="tab-strip-btm-bg.gif" hash="8e5594b6e95ef5edd30b3a2d0bb1f3cd"/><file name="tabs-sprite.gif" hash="4dc716e5213e4d9d2731d0e79953ea2f"/></dir><dir name="toolbar"><file name="bg.gif" hash="5c8ff0ea2f6e1226154f660006bb5013"/><file name="btn-arrow-light.gif" hash="fa49b39a0fd88ef26264da44a2b4edea"/><file name="btn-arrow.gif" hash="12bda29a4c8016cfa047e852c4353f59"/><file name="btn-over-bg.gif" hash="faddf9b24cefa721326ba3f87f3ef31f"/><file name="gray-bg.gif" hash="4bf225cf4ff1919a265531d824dd52aa"/><file name="more.gif" hash="18af410b9b19aac389fa81fe6d5c4d79"/><file name="tb-bg.gif" hash="5309337fd7a22cab9d9467fd9eaa0a0c"/><file name="tb-btn-sprite.gif" hash="7c7d5c1029d25748b9323a67dd8dc92f"/></dir><dir name="tree"><file name="arrows.gif" hash="e0d51c37061742fcdc5e141d9030c483"/><file name="elbow-end-minus-nl.gif" hash="f97a7974397413cedcc4da01c695c5c0"/><file name="elbow-end-minus.gif" hash="ad767cf0df09e850978cfad5903ada3e"/><file name="elbow-end-plus-nl.gif" hash="07b4ba4f1d4c0f3d24f987740b5d97d4"/><file name="elbow-end-plus.gif" hash="07c97874af5a14d909bc462c38d1d5c2"/></dir><dir name="window"><file name="icon-error.gif" hash="f477b54b6b8361362e96c2218dce7ea0"/><file name="icon-info.gif" hash="ec6b7a5d4caeea767c8674689bae47c6"/><file name="icon-question.gif" hash="2713644a8aa582728d71e35eca62fbcd"/><file name="icon-warning.gif" hash="3f20258272af0e00f6b7531b3b9aee35"/><file name="left-corners.png" hash="f5cccec900e527983d402d1a8cccecb3"/><file name="left-corners.pspimage" hash="cbd1e105535264872643345cd53df57c"/><file name="left-right.png" hash="2bc0b5bcc87f58d7825754a457f8d671"/><file name="right-corners.png" hash="d0c47fa4e6f1ecdbe8aed7444c8724ca"/><file name="top-bottom.png" hash="22bb60d1a515987e330b169d2d85290f"/></dir></dir></dir><file name="resources.jsb" hash="a260baacbb946040b32af83ec8338720"/></dir></dir><file name="jquery-1.5.1.js" hash="6dc6e4228017b636f11219814557140c"/><file name="jquery-1.6.1.js" hash="224b35c665c4da1ca48c0e4e1e45bf22"/><file name="jquery-1.6.js" hash="55923e3f8725714066ff2dab2f44a558"/><file name="jquery.json-2.2.min.js" hash="c35073f4c0a702e2343b64f330089a81"/><file name="jquery.store.js" hash="939a5a76f6963629c6ae0882f5e7d4ef"/><file name="sanitize.js" hash="a2fb0b1897ce9b6a4f08b9bfcff6e37c"/></dir></dir><file name="package.json" hash="bce605e9114b898debc347f12e455493"/><dir name="plugins"><dir name="common"><dir name="abbr"><dir name="css"><file name="abbr.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="lib"><file name="abbr-plugin.js" hash="4fa988644a52539b577e46c8145026c8"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="5d4c1762c21e0c467b4d7c0c20d1fd98"/></dir><file name="i18n.js" hash="e254d2a5cccef92ce3301c365f15f012"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="align"><file name="LICENSE" hash="3ff425193c10ca6a9375e287cb2c5c7e"/><file name="README" hash="2ca9425ae8d8209ddc282885d158a6fd"/><dir name="css"><file name="align.css" hash="e00da6b17e9970689a167560b56422b3"/></dir><dir name="img"><file name="align.png" hash="37576554bc097195c180ae7500c480cd"/></dir><dir name="lib"><file name="align-plugin.js" hash="2e1bd101469face9febeb6bd9fc800b5"/></dir><dir name="nls"><dir name="en"><file name="i18n.js" hash="0deaa30fccaeb6d765636fc9809e7fd3"/></dir><dir name="fr"><file name="i18n.js" hash="336f7188ccba16474e90ccd3eb97cfa0"/></dir><file name="i18n.js" hash="7b909244c11beb704074683397562e35"/></dir><file name="package.json" hash="da3d4e6914c3fd5140d638a103e94b15"/></dir><dir name="block"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="block.css" hash="070d42ce424589e51eb4e8921bfc36d7"/></dir><dir name="img"><file name="toolbar-draghandle.gif" hash="eb4decc8476551903a24f66f788e8793"/></dir><dir name="lib"><file name="block-plugin.js" hash="c68bf9da6bedf019cfa57677872f42b4"/><file name="block.js" hash="4a3712febeeba4641d1b2c08549f4443"/><file name="blockcontenthandler.js" hash="a8122c7b1c23109244b5f90a1b2df1b6"/><file name="blockmanager.js" hash="5a8878096dd57c13298ccef6f6565120"/><file name="editor.js" hash="7af65eb03e1376987e12c6a7ba504271"/><file name="editormanager.js" hash="344c08f707618d195e1a24bab263036c"/><file name="sidebarattributeeditor.js" hash="4549b30151ad6b5b62ad4e8ca8be9ec8"/></dir><file name="package.json" hash="e33741b838a104126c8603c877a9f293"/></dir><dir name="characterpicker"><dir name="css"><file name="characterpicker.css" hash="cf4a0347bdc31f0b28f36f1590eb06c7"/></dir><dir name="img"><file name="icon.png" hash="9c227d1d31a57e04feacddff9a2c5648"/></dir><dir name="lib"><file name="characterpicker-plugin.js" hash="eaca9268b185b851a24104be7492f685"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="907ae1f1e333ee06d1bca445270c7bb2"/></dir><file name="i18n.js" hash="db9b178e36c66d20e8fe361f1d243226"/></dir></dir><dir name="commands"><dir name="css"><file name="abbr.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="lib"><file name="commands-plugin.js" hash="5959952ff44097c371a03679b32aa7d4"/><file name="inserthtml.js" hash="877f8abc0a15ee71a450622794e86c9c"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="contenthandler"><file name="README.md" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="lib"><file name="contenthandler-plugin.js" hash="e00590b431446704dc427b4dbc0f5f98"/><file name="genericcontenthandler.js" hash="90385ee5adc376bb64ca26519e3a7a16"/><file name="oembedcontenthandler.js" hash="caa2cf241768337bcc6a3bb2c013511c"/><file name="sanitizecontenthandler.js" hash="b35938402db0440f3d39ad8f89eb648b"/><file name="wordcontenthandler.js" hash="cf4ab620ec8adbafc1a0ab618ab78afa"/></dir><file name="package.json" hash="99914b932bd37a50b983c5e7c90ae93b"/></dir><dir name="format"><dir name="css"><file name="format.css" hash="6861fed2e14a2acf1d6d3dea5693cc9c"/></dir><dir name="img"><file name="em.png" hash="0360b83b79c8e835a3105148e58ca5e5"/><file name="strong.png" hash="7915567b2d094f11debd728827d59f40"/></dir><dir name="lib"><file name="format-plugin.js" hash="fc4f1f1e10e3f61f9d9c861f25e518ed"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="edbb27aa036b3ed4b86ed6ff3d7ecaea"/></dir><dir name="eo"><file name="i18n.js" hash="ec2f3e02978d561bd5568a7e95764a67"/></dir><dir name="fi"><file name="i18n.js" hash="60c9294a20827e6da5b908ab43d13aa4"/></dir><dir name="fr"><file name="i18n.js" hash="205109959b86eae4db7e85304b758906"/></dir><file name="i18n.js" hash="29af4f07b85487e1972e329be63d0588"/><dir name="it"><file name="i18n.js" hash="f394c11f2339e83ff7cec9ff03a5ed33"/></dir><dir name="pl"><file name="i18n.js" hash="c44a5da4cd985395739cf4d6ee81b29f"/></dir><dir name="ru"><file name="i18n.js" hash="2bbff95b12d7a202bce7a0a3f09bb6cd"/></dir></dir></dir><dir name="highlighteditables"><dir name="css"><file name="highlighteditables.css" hash="5f9f2e7e79b38b38d92951dc03285163"/></dir><dir name="lib"><file name="highlighteditables-plugin.js" hash="adf15104410d66624ddf078601fb28c4"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="horizontalruler"><dir name="css"><file name="horizontalruler.css" hash="2b93564ebe3b6c830eb439604da59ce2"/></dir><dir name="img"><file name="icon.png" hash="0e3bca3460798e2a00c4ac437e2b7cdd"/></dir><dir name="lib"><file name="horizontalruler-plugin.js" hash="24e62e70a694b2b9fe9ea91d004cc4af"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="a20013dba6bd343b243463e7ec82039c"/></dir><file name="i18n.js" hash="ee3de246cbfb27e710e109db0d3ae983"/></dir></dir><dir name="image"><file name="AGPL3" hash="c5edf65bb50f2284b1be0196d5a95c89"/><file name="LICENSE" hash="3e62a489a9c73be5487ef9038e002c3b"/><file name="README.md" hash="6c0b3051d9fd87e45a88a7cc00e42dd8"/><dir name="css"><file name="image.css" hash="6d31e1cd7a271931e2e642fb273844a4"/></dir><dir name="demo"><file name="crop.html" hash="82488dc281a1613cb1599a7285cfbb7e"/><file name="crop.php" hash="501237a45ef8c345f95e159843c3236b"/><file name="cropnresize.jpg" hash="0edf07c3ea54e42ab7853229b5dca0a9"/><file name="index.html" hash="3119be3754949bfec58e78aba7f7c58a"/></dir><dir name="img"><file name="blank.jpg" hash="6d5bfd4672e0efede2e504ae7bb2cf32"/><file name="crop-buttons.gif" hash="0e4da82afb71162a3a0af60630d3e337"/><file name="cropnresize.png" hash="d7b16b232d8c50bd752124d2913eb7c3"/><file name="handle-sw.png" hash="3186033209be1fe35a23b76c31846045"/><file name="image-align-left.png" hash="2dde195149c676d7efd3499f1e9da1a4"/><file name="image-align-none.png" hash="e9c1995da7259d2a8fa781f4c25985dd"/><file name="image-align-right.png" hash="054a533583c93c6f8d188b90862e0176"/><file name="image-border.png" hash="3571557fc1ecee72bf6534eb9c7f906c"/><file name="image-title.png" hash="995887637e91caac42c98b1c9eefb831"/><file name="image.gif" hash="afaf217b75f8a0f0e80d2d49e88ced4e"/><file name="padding-decrease.gif" hash="1e286415e3acdffd37c039baff4f9362"/><file name="padding-increase.gif" hash="1f7ef1c19e5c90b339be4e04a88240be"/><file name="page.png" hash="55a687e848244b76f8d8249b111df860"/><file name="size-decrease.gif" hash="8fd3a7236e97fd5abe2215fe11ef39fc"/><file name="size-increase.gif" hash="693618eba55979b4c7e03484b92a52f3"/></dir><dir name="lib"><file name="image-plugin.js" hash="a767413cff4d03e8f9cc07dbd6eb4f35"/></dir><dir name="nls"><dir name="cz"><file name="i18n.js" hash="79b54d1f0ba8ba6d313c171c412e6553"/></dir><dir name="de"><file name="i18n.js" hash="a82bb4c7508a558f3b7638c87a3f75a1"/></dir><dir name="fr"><file name="i18n.js" hash="f5007dfc86ad1a9a4cd708638156d19e"/></dir><file name="i18n.js" hash="955a3243f98f92002e19f36b8ad8af8b"/><dir name="ru"><file name="i18n.js" hash="0aeb948daf24af5d6a6bfa0080249094"/></dir></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/><dir name="test"><file name="test.css" hash="e940fc900051dcd8805e0acc98e0d0bf"/><file name="test.html" hash="e038d522dbbd74e1df52e52839470c78"/></dir><dir name="vendor"><dir name="jcrop"><file name="jcrop.gif" hash="7a4b4c6ebdb549fcbe47408f9457493e"/><file name="jquery.jcrop.css" hash="0442701ebd3542ecd17573ba1175ae1a"/><file name="jquery.jcrop.min.js" hash="3bbd52bffc25a16db572ff43eb3a841c"/></dir><dir name="mousewheel"><file name="mousewheel.js" hash="973f3b0b9e90b6c17331032407f83143"/></dir><dir name="ui"><file name="jquery-ui-1.8.10.custom.min.js" hash="23bf25c6a6930bc9b955db2a58229709"/><dir name="ui-lightness"><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="95f9cceeb9d742dd3e917ec16ed754f8"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="f040b255ca13e693da34ab33c7d6b554"/><file name="ui-bg_flat_10_000000_40x100.png" hash="c18cd01623c7fed23c80d53e2f5e7c78"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="5f1847175ba18c41322cb9cb0581e0fb"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="d26e8f463195a7b86f86b7d550cfc114"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="58d2cd501e01573cf537089c694ba899"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="384c3f17709ba0f809b023b6e7b10b84"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="b806658954cb4d16ade8977af737f486"/><file name="ui-icons_222222_256x240.png" hash="ebe6b6902a408fbf9cac6379a1477525"/><file name="ui-icons_228ef1_256x240.png" hash="79f41c0765e9ec18562b20b0801d748b"/><file name="ui-icons_ef8c08_256x240.png" hash="ef9a6ccfe3b14041928ddc708665b226"/><file name="ui-icons_ffd27a_256x240.png" hash="ab8c30acc0e3608fb79e01fccf832c70"/><file name="ui-icons_ffffff_256x240.png" hash="342bc03f6264c75d3f1d7f99e34295b9"/></dir><file name="jquery-ui-1.8.10.cropnresize.css" hash="851152e46271d895d2e9d4061b833eff"/><file name="jquery-ui-1.8.10.custom.css" hash="d94d6cfc82c0942b6e3841586788cf04"/></dir></dir></dir></dir><dir name="link"><dir name="css"><file name="link.css" hash="1f95e0fab434698b7cbba2d05ff0aa5c"/></dir><dir name="demo"><file name="background.png" hash="f040b255ca13e693da34ab33c7d6b554"/><file name="external-link-ltr-icon.png" hash="ddbdb9378a821fc07947f54d26237b51"/><file name="index.css" hash="a6b3e9c419c962e4866469578b6b98da"/><file name="index.html" hash="404b32311a774f4c3511fc94fd812140"/></dir><dir name="extra"><file name="delicious.js" hash="633805e5b8241b49b3b198d60c70b67b"/><file name="linklist.js" hash="5945e0e3bbbc1e42becb1ce8ea223b9f"/><file name="slowlinklist.js" hash="ccef47b7f52705cb58e3b84054c6e153"/></dir><dir name="lib"><file name="link-plugin.js" hash="1e4f40b2653d38aee8b5762d2520cdac"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="d99fc803f4f91751e6daf9c3cc7e08a6"/></dir><dir name="fr"><file name="i18n.js" hash="8f789ed2a046f93e852c00c9c726b191"/></dir><file name="i18n.js" hash="32fbe55d130eb228b9133c65b7081d84"/><dir name="pl"><file name="i18n.js" hash="eb8d4d76407d90b7ae53350f01d92bf6"/></dir><dir name="ru"><file name="i18n.js" hash="4f56f53941c22e9d4b1d1c589bcbe806"/></dir></dir></dir><dir name="list"><dir name="lib"><file name="list-plugin.js" hash="4dc58630f1d752237b5ed5987f5c6937"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="d3407657a23d77c834a215d7bf3b8df5"/></dir><dir name="eo"><file name="i18n.js" hash="da3a34d8833bcca6abed2cbbb094d4d1"/></dir><dir name="fi"><file name="i18n.js" hash="4973655cb37200c31d008fd32f2715fb"/></dir><dir name="fr"><file name="i18n.js" hash="721ed4f10e28cb55c604c624440afcfc"/></dir><file name="i18n.js" hash="233206aff494f605e25cbc267741ae4b"/><dir name="it"><file name="i18n.js" hash="b46598e5b5b8ef742fe27ff2d7bf5b50"/></dir><dir name="ru"><file name="i18n.js" hash="4a68a5ca235ba3192cfd11a2466ebdd5"/></dir></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="paste"><file name="README.md" hash="3d5f9f079a3bfb9724af1cb433693ae4"/><dir name="lib"><file name="paste-plugin.js" hash="71632a4580656526dcea5388084ad833"/></dir><file name="package.json" hash="1a8f3a3a4ee37a9a66a4a0cf26cd2f11"/></dir><dir name="table"><dir name="css"><file name="table.css" hash="856755f60e184c46d19c3a119feedba2"/></dir><dir name="img"><file name="down.cur" hash="4a8143598b132d1866933b6aa43a5090"/><file name="left.cur" hash="d005b5f77f028c3848d747f27504cd67"/><file name="table_layout.png" hash="99dc211325386a792e289576356245f7"/><file name="wai-green.png" hash="702a0ddbb339531909d57c53ae7e68e6"/><file name="wai-red.png" hash="84f1be7bc7005575742bda4f778ba5cc"/></dir><dir name="lib"><file name="table-cell.js" hash="45cfda06bd0d312a2146ed977a362144"/><file name="table-create-layer.js" hash="8288651b20fff3f87d615ef0678006aa"/><file name="table-plugin-utils.js" hash="c9cf7c4eed7c6b221d467000d4cf49ca"/><file name="table-plugin.js" hash="6c335ddc986b1499da59150065b1aea9"/><file name="table-selection.js" hash="4b46f81520ddfb83b78ec3a0f41ebf0f"/><file name="table.js" hash="133ba9028000d3a543aec8e146c8764b"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="43b5b78eb8d565a617a95de8b6192551"/></dir><dir name="eo"><file name="i18n.js" hash="81235be488daa67a07db9c56122c6640"/></dir><dir name="fi"><file name="i18n.js" hash="2479b5c25399986d56859c26f104b7eb"/></dir><dir name="fr"><file name="i18n.js" hash="f02f3353ac8a0f8694028234edfea6d5"/></dir><file name="i18n.js" hash="0e00d3e981c15934feae36aa8b99c6b0"/><dir name="it"><file name="i18n.js" hash="da8533c0e6506984f9b7a1070fe9dfff"/></dir><dir name="pl"><file name="i18n.js" hash="bf5d7b0802aeddf24dfd330b488c5968"/></dir><dir name="ru"><file name="i18n.js" hash="f9d96be10d92eb6dd9ce6c57a7d2d978"/></dir></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="undo"><dir name="demo"><file name="index.css" hash="9e891121c2afbebf93e7e60246e4ad83"/><file name="index.html" hash="d568ce5e98f9125a537804b9da5b5727"/></dir><dir name="lib"><file name="undo-plugin.js" hash="924f5fab6fc06a703a93c91e0c52396d"/></dir><file name="package.json" hash="18c1a188849323bf6e7e9cff41afaac1"/><dir name="vendor"><file name="diff_match_patch_uncompressed.js" hash="9638822ae1bce2e292fcfedc62bb1f59"/><file name="undo.js" hash="da570c614fdbca470fec4e8ad148fc88"/></dir></dir></dir><dir name="extra"><dir name="attributes"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="attributes.css" hash="1fdb19dfbee928ab94cbdae4f83c9a97"/></dir><dir name="lib"><file name="attributes-plugin.js" hash="5e5097a65f6fdcab9594d8df0ae4834b"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="dd9bd5e3a7d01e1c09b5308c8ca34a21"/></dir><dir name="en"><file name="i18n.js" hash="712183db4b838ce7d90478722333f0f1"/></dir><file name="i18n.js" hash="5ba01bebc68d37746351bd2d87df415f"/></dir></dir><dir name="browser"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="browser.css" hash="4e1b1592c1122fb001641a08f97663d7"/><file name="browser.jqgrid.css" hash="64479006b4e1ff84490e17af9c16b225"/><file name="browsercombined.css" hash="6fc54ddc5610fb3acdc8b6a1870a2af3"/><file name="browsercombined.css.backup" hash="2c4d264b7f8792d01fd98b75dcaafcea"/><dir name="images"><file name="ui-bg_flat_0_aaaaaa_40x100.png" hash="2a44fbdb7360c60122bcf6dcef0387d8"/><file name="ui-bg_flat_75_ffffff_40x100.png" hash="8692e6efddf882acbff144c38ea7dfdf"/><file name="ui-bg_glass_55_fbf9ee_1x400.png" hash="f8f4558e0b92ff2cd6136781533902ec"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_glass_75_dadada_1x400.png" hash="c12c6510dad3ebfa64c8a30e959a2469"/><file name="ui-bg_glass_75_e6e6e6_1x400.png" hash="f4254356c2a8c9a383205ef2c4de22c4"/><file name="ui-bg_glass_95_fef1ec_1x400.png" hash="5a3be2d8fff8324d59aec3df7b0a0c83"/><file name="ui-bg_highlight-soft_75_cccccc_1x100.png" hash="72c593d16e998952cd8d798fee33c6f3"/><file name="ui-icons_222222_256x240.png" hash="ebe6b6902a408fbf9cac6379a1477525"/><file name="ui-icons_2e83ff_256x240.png" hash="2b99a5e48d3c3957d03027d36a25e8bb"/><file name="ui-icons_454545_256x240.png" hash="119dd0c2e94ad689de873ef39fd43e6e"/><file name="ui-icons_888888_256x240.png" hash="9c46d7cab43e22a14bad26d2d4806d80"/><file name="ui-icons_cd0a0a_256x240.png" hash="3e450c2a2c66328d9498e7001ad7197c"/></dir><file name="jquery-ui-1.8.13.custom.css" hash="add5823bf09137483b9a3b79594c5244"/><file name="jstree.css" hash="af6da23bddd3db20b51765d4e802cee1"/><file name="throbber.gif" hash="7b9776076d5fceef4993b55c9383dedd"/><file name="ui.jqgrid.css" hash="5e9d7c95ff319a2101ff5e81cb905d47"/></dir><dir name="img"><file name="arrow-000-medium.png" hash="c2870570006136595d4737f89c0c5516"/><file name="arrow-180.png" hash="ad22f4334ecfb3e893b916a79cc1ae67"/><file name="arrow-315-medium.png" hash="4670462a741f95158e8e277d2d0383bb"/><file name="arrow-stop-180.png" hash="cb7973a56cd00a0921c470c88265a003"/><file name="arrow-stop.png" hash="f42613a7be2001780d299b2ef41ca77b"/><file name="arrow.png" hash="64c6eb55ead1f4fecb2c645f66d9079e"/><file name="control-stop-square-small.png" hash="c96acaae6af582895d71c3e8b2442245"/><file name="folder-horizontal-open.png" hash="838cb1eedd8fa64c941fc3a49fd0cc82"/><file name="folder-open.png" hash="d7d8fc83a85febaab02389d4e7dc9bd1"/><dir name="gcn-icons"><file name="gcn-icon-file.gif" hash="ac2aab27953019e09c128a4ae499487d"/><file name="gcn-icon-image.gif" hash="ad4ef7a3f1b21642a3146688d73992b6"/><file name="gcn-icon-page.gif" hash="56e8bb8b44a09fe321b3ef9bcf20fbbe"/></dir><file name="magnifier-left.png" hash="03d386f15d932839012de55ec2262563"/><file name="page.png" hash="55a687e848244b76f8d8249b111df860"/><file name="picture.png" hash="d2040c34ba1ffd8fa5b72ab37be11eca"/><file name="sort-alphabet-descending.png" hash="b0687ee5cb61abb9f35c9b7c13c4636b"/><file name="sort-alphabet.png" hash="c70f28d00c668f48764dd7e84ce1e077"/><file name="throbber.gif" hash="7b9776076d5fceef4993b55c9383dedd"/></dir><dir name="lib"><file name="browser-plugin.js" hash="1998a46712ed1d997288f7b30141cd86"/><file name="browser.js" hash="6148d01c9ba94789c38b158ecd8120fb"/><file name="locale.js" hash="a847e910384e41b2842b20791f348484"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="45a966d44587f35700fcf8987ffb65ef"/></dir><file name="de.json" hash="da83f1ee8d94a5d126d71a89ba5ee1a2"/><dir name="en"><file name="i18n.js" hash="17374af52c2aa88a0b5cafdf954e4291"/></dir><file name="en.json" hash="c99f6a248ca7be514520b612b1105347"/><file name="i18n.js" hash="d2371ed0d45cb2d895e771f9b78cb434"/></dir><dir name="vendor"><file name="grid.locale.de.js" hash="4df90894fc5b4b6e1988ecbab13c8f63"/><file name="grid.locale.en.js" hash="1b7a16d0a6027a808a7d6360b47b5f72"/><file name="jquery.jqGrid.js" hash="718d3905698f62dd5d88a6fa3ebd56ff"/><file name="jquery.jstree.js" hash="f1c8261f0fa89950cd9257d1698430b6"/><file name="jquery.ui.js" hash="f08f2b04c76fad103aba44601e386580"/><file name="ui-layout.js" hash="72d2d5555fa66aa693b3973cbd8ce458"/></dir></dir><dir name="cite"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="cite.css" hash="3a940e1148b6f6355b04a3617b274c2c"/></dir><dir name="img"><file name="blockquote.png" hash="cd835c578628f97c9e005ccf84b3ab53"/><file name="icon_cite.png" hash="8e79ff67005c66bcd6b1f14df213073b"/></dir><dir name="lib"><file name="cite-plugin.js" hash="f95b8845a87929b1bed43c71494bcbe8"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="d1820518e50b2c33596ae1212e2d6cc6"/></dir><dir name="en"><file name="i18n.js" hash="d17d574df1dc2c9822d31e38b4303192"/></dir><file name="i18n.js" hash="9f95915cac533f2f6187431991c1c0b2"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="comments"><dir name="img"><file name="add-icon.png" hash="1fce54244839a6752fc4c50493c9f073"/><file name="add.png" hash="2e964921e93f16be8443468e440a931e"/><file name="comments.png" hash="761cd09498144b2d04532ddf3a0661c5"/><file name="hr.png" hash="dc2c6cbf786afad881889e896b541f3b"/><file name="textbox.png" hash="51d41b814c14c1aa42ea7d496d724ce6"/></dir><file name="package.json" hash="99914b932bd37a50b983c5e7c90ae93b"/><dir name="src"><file name="comments.css" hash="f5127e74b38aee1c700f3c3ec85c1851"/><file name="comments.js" hash="9d133ed95eee8efc238adaa7de4db8b5"/></dir></dir><dir name="draganddropfiles"><file name="AGPL3" hash="c5edf65bb50f2284b1be0196d5a95c89"/><file name="LICENSE" hash="5b77f1f48f8f9ae828474ea28169a6e4"/><file name="README.md" hash="48f4b8edd1bc74d5eb513f496dc0e34d"/><file name="TODO.md" hash="12358ef24fe64cdbc45a7360ea6e4508"/><dir name="demo"><file name="index.css" hash="eda9095e66bbb23be82cab846a46b018"/><file name="index.html" hash="0becd9d06b155c38a6d261434868be3a"/><dir name="migration"><file name="index.css" hash="65428b4044219dcf3c9e3a04e7d4d118"/><file name="index.html" hash="2ae8ccec41e7f311f33057d79a9ec846"/></dir><dir name="specs"><file name="DragnDropnImage.graphml" hash="6f05cbb2740b456cb54543a9bdddcc2c"/></dir><file name="style.css" hash="eda9095e66bbb23be82cab846a46b018"/><file name="upload.php" hash="45ec2904a41bae9d338c9c90fb8756a7"/></dir><dir name="i18n"><file name="en.json" hash="d08757e391c65e12e7c36ecb1a637263"/><file name="fr.json" hash="406a8a7cd58f4b89e52557b1df3ce5b5"/></dir><dir name="img"><file name="cross.png" hash="42492684e24356a4081134894eabeb9e"/><file name="hourglass.png" hash="b88dbbae104c8c7c939641993b2872ae"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="page.png" hash="55a687e848244b76f8d8249b111df860"/><file name="tick.png" hash="c9b528b9541e127967eda62f79118ef0"/></dir><dir name="lib"><file name="draganddropfiles-plugin.js" hash="213c6b37963801bf1bae42d969db6ece"/><file name="dragndropfiles.css" hash="25d0c7654b280019773f1f2b86e54b66"/><file name="dragndropfiles.js" hash="05512f8dbae550cdfd19bb477b0b0db5"/><file name="dropfilesrepository.js" hash="117cf2ea2d3c1a3bc58061e87a05673c"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="flag-icons"><dir name="img"><dir name="flags"><file name="aa.png" hash="ff12619c22af4199394503222998e329"/><file name="ab.png" hash="aac61a45d2a8b539135c86c541e61487"/><file name="ad.png" hash="cc750844215aed20b2b05c10d6082b0d"/><file name="ae.png" hash="7391e6b6df7b181d51ffeb2a5a6d7bd4"/><file name="af.png" hash="ae7c58272ae46cde945ccc4bed00fe9e"/><file name="ag.png" hash="390af4c36d462bbf2627a1182946825a"/><file name="ai.png" hash="08cf0788a582710062140f69887300fc"/><file name="ak.png" hash="bc6bc75ca2a8a944806625f6c30c72c4"/><file name="al.png" hash="7c5bc720b2cf3047c9fab800e271eec9"/><file name="am.png" hash="fd5d9d1d864ea76406afec5e11f2632f"/><file name="an.png" hash="7d7d682a9dc9f2a26a6dea1fdb87334f"/><file name="ao.png" hash="41a8aa1e11f7086d2413d8d9a777680b"/><file name="ar.png" hash="2fa357868e66f1aec9c4c4230baa45b3"/><file name="as.png" hash="96e49204e758277b6720584c4d844ecc"/><file name="at.png" hash="62bf1a5653692b34b2ee1f734a59b062"/><file name="au.png" hash="2fba49c88880e9ffcff947015cb7ab9c"/><file name="av.png" hash="785b4464ecbc9101cc951cafcd28a013"/><file name="aw.png" hash="6e82279ceb4702171f345fead7ff3e35"/><file name="ax.png" hash="27708378fcc025e375fd3c303fc1cbd6"/><file name="ay.png" hash="fea52366cf644c57cff3ea9e417c21ae"/><file name="az.png" hash="d63f5c99e25eca9de2a97f63161f38e6"/><file name="ba.png" hash="cbb6ce46c69e14bbd8d2c8fd91680d33"/><file name="bb.png" hash="47c8aea417660e5f4e8b5a7a73f2cb18"/><file name="bd.png" hash="f02d8deb9de271cd246646872798af15"/><file name="be.png" hash="2404b88a07bdb7aef652eec0f6fce287"/><file name="bf.png" hash="cc65efa74cd7367933ecd52115204b2d"/><file name="bg.png" hash="77b2183ab10cd26ee4e79fdfc12b8621"/><file name="bh.png" hash="5bbf6106968b2517d924bac4d99b41bd"/><file name="bi.png" hash="427c72cd341f288faf0e62f03586c7ba"/><file name="bj.png" hash="67bd2e990cc7e3dc5bbae821fd38f20c"/><file name="bm.png" hash="cf195bf1921659202cf8ae899e9171d0"/><file name="bn.png" hash="4911cd2a8fae48d82f9ce124d908be3c"/><file name="bo.png" hash="151854ff619d7a44894a37b5be73f463"/><file name="br.png" hash="54c40b8a9ad7df4783d19acc05910f8e"/><file name="bs.png" hash="8b45f84cb140ec2448692187a82abfc7"/><file name="bt.png" hash="2f13e87c1868b03b0b47cd0bb60737d5"/><file name="bv.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="bw.png" hash="15d59270fb25d9e467d5a730682c5644"/><file name="by.png" hash="9e18ac464c49a91d90eaf11ad21357e9"/><file name="bz.png" hash="6e14aaafe632fe367409415545c27e73"/><file name="ca.png" hash="8618709a45d8d1c4d9d254c61bdf29b8"/><file name="catalonia.png" hash="76991f3da407b7dec2603ff86f1b9724"/><file name="cc.png" hash="ebbfb19d79975289e7a9cbb12caf0a23"/><file name="cd.png" hash="34e2a72a9cb9e873db413b020d7f1845"/><file name="ce.png" hash="91d3b05187115efb95a9529063b6dfbf"/><file name="cf.png" hash="252d14145f4c47374a3e0bc2bb8ae0bf"/><file name="cg.png" hash="b5bed6c75a72dc56f8eb8c559d437f59"/><file name="ch.png" hash="e67b19a7767114078cda2b3c874a5d5b"/><file name="ci.png" hash="90e8d52c215176bb04b7453b84e6fa43"/><file name="ck.png" hash="e70409285b72ac2ebd8d6ee1849e4083"/><file name="cl.png" hash="dc7b3be27813faeb454d02b55b79b9e3"/><file name="cm.png" hash="f5cdc865bf36948532707c42e716e14a"/><file name="cn.png" hash="a82ff00f39eff54062328b4474c33dbc"/><file name="co.png" hash="4bd223b284a0900cda6826ee656c5333"/><file name="cr.png" hash="cd28a01f91e89fa2b844857642fd5fb7"/><file name="cs.png" hash="4db37e9044c342fb819515d13768e058"/><file name="cu.png" hash="9d5366e9b01d5cd428429e608433d5f3"/><file name="cv.png" hash="2f4edfdcba4cdb3fa903047a235f3296"/><file name="cx.png" hash="8efc55a14b900c47f4b920c4510f192f"/><file name="cy.png" hash="f29741d622fe02759bb7a2a91eb5e2e0"/><file name="cz.png" hash="815b6d2bf60a3179c0652f0b6895bcbb"/><file name="da.png" hash="fe926c8271b35febf4a6cb0a41b111eb"/><file name="de.png" hash="ddabae687ecae5edaaeb808d440543e6"/><file name="dj.png" hash="197e6fc2579eec8bcd7303393de841ba"/><file name="dk.png" hash="fe926c8271b35febf4a6cb0a41b111eb"/><file name="dm.png" hash="85845da8ae28e94f2885ceeb16515dd0"/><file name="do.png" hash="153949105845e18a133a4c778b3de31e"/><file name="dv.png" hash="333df6f9fa1479579533dee0563f7bf1"/><file name="dz.png" hash="c57f3c0951ba1525b3359fc0acbfd6b1"/><file name="ec.png" hash="0152114421e281913d0c1c148e196c92"/><file name="ee.png" hash="1cdfaaa10ff170ce19ed46339efe3af6"/><file name="eg.png" hash="09c48d3562f0dc51e2f9507704f6437f"/><file name="eh.png" hash="7dd5a46a34bee2f10532f1213a941d7b"/><file name="el.png" hash="fd9b321b80be31c027585c8992f1799f"/><file name="en.png" hash="73f2f220f6d51d249e45a04d9a03da91"/><file name="eo.png" hash="33ceb5d48b9ff154cf6f3beeb24f1845"/><file name="er.png" hash="481d394ac9a44f3040f7c457fc1f23a6"/><file name="es.png" hash="d6693ce2a6346b2da89ceda335554e0a"/><file name="et.png" hash="73763e46da896f3e951954ad473b4a4b"/><file name="eu.png" hash="76cb57759df376c7f16c399e31e477cb"/><file name="europeanunion.png" hash="ffce5e64df4d367a20e1ef4033f60257"/><file name="fa.png" hash="086cfe2fc3d0d14d032aa53542678bb6"/><file name="fam.png" hash="0b36de21772c8d87e1d0106878b65231"/><file name="ff.png" hash="fcc4e17a79c19f8ca6098530cb13a3e4"/><file name="fi.png" hash="e30bd2493de78c998d1ac6c22d20146b"/><file name="fj.png" hash="7c3e78e31bb34b0fafbb0865737f8d36"/><file name="fk.png" hash="9627317fe9a5757ee8c06df7d8e8a887"/><file name="fm.png" hash="d3767ea95466571e10c7e563d456d754"/><file name="fo.png" hash="d0e6b0a3fdb4e2271b5b5057bd969966"/><file name="fr.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="fy.png" hash="18fa69db68a4cbf79ae660dc0346115a"/><file name="ga.png" hash="972da84bdea1359d69c719a37d89d219"/><file name="gb.png" hash="0894999b108830afc0733ee7b6e08310"/><file name="gd.png" hash="95b8b79fafc6b1510978977bc8067b46"/><file name="ge.png" hash="aa40721b7a179f6c9c8f666a64063767"/><file name="gf.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="gh.png" hash="12da850e724de5ff779572bbdb8ded71"/><file name="gi.png" hash="0ca5a4db2ac11c8a5cb57701b18b8088"/><file name="gl.png" hash="073b6bf37f6eefe07145d9dd89bc9e7d"/><file name="gm.png" hash="a7d785fa41e66a5e6d82301688686f20"/><file name="gn.png" hash="acba9c908c29db8aa890b6a20265ac22"/><file name="gp.png" hash="c2dc0a2062b24f906431337186888f01"/><file name="gq.png" hash="70f64b2b38b8a21152e7446a1b3e1133"/><file name="gr.png" hash="fd9b321b80be31c027585c8992f1799f"/><file name="gs.png" hash="3b510d36dc70edd5b301da8096c9b71c"/><file name="gt.png" hash="384e9d38421a6853f9c35d48d8c49a85"/><file name="gu.png" hash="2d058f7cea364d247fee5bb53fe70390"/><file name="gv.png" hash="02a47e21c8adc33f6b22e9996e202e6b"/><file name="gw.png" hash="35eb1d9b882111ccec5f58cd778364bf"/><file name="gy.png" hash="d816170967c67a98db73cd89c56014fd"/><file name="ha.png" hash="cc65efa74cd7367933ecd52115204b2d"/><file name="he.png" hash="5c8964621cbdf37b1d3dce91656350bf"/><file name="hi.png" hash="50d62cba8134c8c097d073646cda1b9b"/><file name="hk.png" hash="389d0451c5c2ff40e88a93588dcbd6f1"/><file name="hm.png" hash="2fba49c88880e9ffcff947015cb7ab9c"/><file name="hn.png" hash="ac9242c256af7800a223bdcbf0798f57"/><file name="ho.png" hash="eb8655ae58a0ab9a3f241fa07b76ab19"/><file name="hr.png" hash="0868c49000b253d9b4f290471898c961"/><file name="ht.png" hash="b5360c0f01d574333b3bfa27c3dce856"/><file name="hu.png" hash="6c6fce8a6fd09c340964b00c5e82a8c3"/><file name="hy.png" hash="e75fcdc9c2ef13a1a67aad43ca2308c2"/><file name="hz.png" hash="2ad5f9c4e8e5af5ef005fe2fba00d50f"/><file name="id.png" hash="fed538f9c8cd0500a6a655b55426744c"/><file name="ie.png" hash="48e42d0d1451e7b19b7b79d631a3a95c"/><file name="ig.png" hash="4a793309d11e9dedd6f4265d778c6133"/><file name="ii.png" hash="a82ff00f39eff54062328b4474c33dbc"/><file name="il.png" hash="a135fcdefe8a391b416bdb102476e12b"/><file name="in.png" hash="50d62cba8134c8c097d073646cda1b9b"/><file name="io.png" hash="38afe5a0e9817027e1f1615028aca521"/><file name="iq.png" hash="39cfe476621ad630cf3418c3234f0594"/><file name="ir.png" hash="2ac099e190547501704d309d59831d2b"/><file name="is.png" hash="7fffd4f1acabc2ccc890049e48587e8a"/><file name="it.png" hash="784f7eb333f0591558bcce9616a3c105"/><file name="ja.png" hash="10958397bc7c25c746e6e122365c003c"/><file name="jm.png" hash="a582c95e205f76277afa1571940121cd"/><file name="jo.png" hash="9dd19e8da30782b2bfb9b5a0d1c51e8b"/><file name="jp.png" hash="10958397bc7c25c746e6e122365c003c"/><file name="jv.png" hash="35c4e24cbd280288152f5e3244e9ee69"/><file name="ka.png" hash="c563ba062d5b58ce5977779f45ef336d"/><file name="ke.png" hash="357152ed37ece2a45a7d57c5bf30ab3c"/><file name="kg.png" hash="192033ce169b1b107dc4aabb1f635c1c"/><file name="kh.png" hash="8658c066eb4f9d6c15efb31a821b482c"/><file name="ki.png" hash="45b580b5a72835f271562b54b146a77c"/><file name="kk.png" hash="01b898ff57cb85421599611fb6fca484"/><file name="kl.png" hash="430f0d7d9f88242efa72f268496820cc"/><file name="km.png" hash="cc942486999d072021c0b3582306f834"/><file name="kn.png" hash="f096727a7612c065259c6334b61a8b6a"/><file name="ko.png" hash="cf63c15bf955e54afed8061497c7f7ea"/><file name="kp.png" hash="0eaa3e8dc84bae9283a9969f2e360080"/><file name="kr.png" hash="cf63c15bf955e54afed8061497c7f7ea"/><file name="ks.png" hash="f1321803dc07f45a58f0355bc714dcd0"/><file name="ku.png" hash="88a7d2944161b9ddd846b61c826305e0"/><file name="kv.png" hash="ac9d8de692abc2e48d1dcc8d8cfefd02"/><file name="kw.png" hash="2e0485cdb9ca8240c9fc372e4cef0eb7"/><file name="ky.png" hash="da2c56cc2568d516031e3082713fd90c"/><file name="kz.png" hash="6d51066ba152b15fd05d761745333135"/><file name="la.png" hash="d082bb175a3510a7a50dcde5b1d8f784"/><file name="lb.png" hash="dad5d86f0d90cca0ff4ab5332d7fd7fc"/><file name="lc.png" hash="18c05f2c79f8774bbb201593b20a06e2"/><file name="lg.png" hash="6bcc5e9452749a8001ea10aa22e17929"/><file name="li.png" hash="822034b39b46abaa91127f8342092a32"/><file name="lk.png" hash="4e90c553f186c9776976b5b11dba4ea4"/><file name="ln.png" hash="dbabdf7a9362054d8b00819d0e41058a"/><file name="lo.png" hash="f6af5d318d988977478ca26c49f479fb"/><file name="lr.png" hash="3b6d8d720721f68ceb465249aad32b27"/><file name="ls.png" hash="c228783a0785a8541d96d5515a2a16cf"/><file name="lt.png" hash="95efec9db9d274d25fbb98eb53a9c384"/><file name="lu.png" hash="3be0b3a6096e9d77d9d7b997d464e612"/><file name="lv.png" hash="6ffae4cc65036d3de052a58e062d1ed7"/><file name="ly.png" hash="3f9d6e8cba5fd7cb8c201acfe9b7bc15"/><file name="ma.png" hash="c936b9f794def7d85fbb4c120d68684e"/><file name="mc.png" hash="63c6fd073106c8b0eb7336d9c19653a2"/><file name="md.png" hash="e414980c55af38676c5312bd330d6bb9"/><file name="me.png" hash="7a2ee5d7f1bc5ef478106a86d2c1cc09"/><file name="mg.png" hash="5aea24a18ca7e8b65770dcf2a738dd08"/><file name="mh.png" hash="948dd15821a6fe45b0df8667b6601ead"/><file name="mi.png" hash="7cfae05d0e87377b038844eae7859d51"/><file name="mk.png" hash="617997cbcaafaea0035a4c0474ae16dd"/><file name="ml.png" hash="d951cb1c43a8077167b731a1aea70b6c"/><file name="mm.png" hash="82ad2104b5490e1f6adfcfa777ab8243"/><file name="mn.png" hash="4adb9a834188753731add527aa4f67f0"/><file name="mo.png" hash="6339bdf0e24c871301d1fc0207e2685f"/><file name="mp.png" hash="929b9802e7bfb58bab0330a4c6925595"/><file name="mq.png" hash="be5fb2cd33e8df13e0b2f2feffb9373f"/><file name="mr.png" hash="6c1cc8a1babe91421a38ddc573ee7cb4"/><file name="ms.png" hash="bfddbc2aae078e0aa80633f784e18526"/><file name="mt.png" hash="7a7ee4f98185ecfb6e1ba753aa6f2111"/><file name="mu.png" hash="48d5cbc23fedfbb77b06ed0e9b04522f"/><file name="mv.png" hash="24c90cfb0c883f9d1b303276c3b069e7"/><file name="mw.png" hash="1d2b8e369b2d4384d1ab4b24315fa139"/><file name="mx.png" hash="479a865f838c70d654a9f818a23f9a7d"/><file name="my.png" hash="e1c0f262c141e8615f819b1cd18393d3"/><file name="mz.png" hash="159c85011041bea6bd3c68b6ba2919d7"/><file name="na.png" hash="e582101531b620fb0138c83602aab920"/><file name="nb.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="nc.png" hash="ad8bf708e9db5fa423b5da123c914378"/><file name="nd.png" hash="45b580b5a72835f271562b54b146a77c"/><file name="ne.png" hash="f2eccd65605d8babcdd3af4b01215ecc"/><file name="nf.png" hash="c624a221dae959256a3e143a5147f825"/><file name="ng.png" hash="0c506131e1841cee782e4faf5cec89a9"/><file name="ni.png" hash="f43a5f35488513de58e2e5fbda9a98db"/><file name="nl.png" hash="6186550ebc77b1c51cd3ae37e78c33c1"/><file name="nn.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="no.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="np.png" hash="52c16445053df13abb08cedbe82f1f28"/><file name="nr.png" hash="2fb04b74787698835b63a46cbdef6fab"/><file name="nu.png" hash="9a2f682db640f1c36ee40f296f63dc87"/><file name="nv.png" hash="f07743dbf1a1451925583cbcf4bc1005"/><file name="ny.png" hash="95e9be7a7e1afbe7dffbb80ea4a532e2"/><file name="nz.png" hash="179cc39a58e324df1e9a19a5eae9dca0"/><file name="oc.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="om.png" hash="7b002bc8c4ab1a85c2c807ec2c4442d2"/><file name="or.png" hash="50d62cba8134c8c097d073646cda1b9b"/><file name="os.png" hash="0a87600c12a03f25750f6ca8236508ec"/><file name="pa.png" hash="64795009d69b36b6a4461b8159dcf356"/><file name="pe.png" hash="d1ed0462edb8cbc3220b7aca250b0437"/><file name="pf.png" hash="e59d18e48cf0924687618bbf60ea4fee"/><file name="pg.png" hash="48f68aaeefaa3b8ee7ce1f1761e6c11d"/><file name="ph.png" hash="8ff2d08518d3e1224d34467f5e24fcc2"/><file name="pk.png" hash="3bd18971ec170e6e9c461026068508da"/><file name="pl.png" hash="fad0e96c20f20be196499d26a6c74cd1"/><file name="pm.png" hash="ba41b8c349070250f814188080c2a8e8"/><file name="pn.png" hash="e4dcc857f534b48e8377ee36f63be013"/><file name="pr.png" hash="40b7fb1a4c1ebb076d40f0df5c6fd59a"/><file name="ps.png" hash="68d5f99924c67ef7d3b3aa32ff22b805"/><file name="pt.png" hash="5b8ab69ac52129bd32a3927f1b94d170"/><file name="pw.png" hash="f2bff7cd01d8eff6401e811f3de6af4f"/><file name="py.png" hash="b9d3d10b185a3144e21a452903857870"/><file name="qa.png" hash="c1dc363a27f5b5d19e24032747d7bedf"/><file name="re.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="rm.png" hash="d038c9c152c5e14f875c7b13afcd4711"/><file name="rn.png" hash="89be44926846abc76e7e3b5a71d140ad"/><file name="ro.png" hash="d038c9c152c5e14f875c7b13afcd4711"/><file name="rs.png" hash="5b672e3ee63317614288615ba0774bf7"/><file name="ru.png" hash="0d31ef75adef220e73f0cb93a84a7422"/><file name="rw.png" hash="bef92348e3ea38dc462326e1ba2ff622"/><file name="sa.png" hash="605884cec6f446d418a092c0941acad5"/><file name="sb.png" hash="5e4b74f8a611742bdc3a04629e871eb4"/><file name="sc.png" hash="39650e922851e1b72165d7b016dc3b44"/><file name="scotland.png" hash="eca5bebe6e4dbc9eb858d4f58ea3f9de"/><file name="sd.png" hash="b972f90fea3369c020d258d1b860a6e0"/><file name="se.png" hash="4c01f06db23324267e2802dcade3572f"/><file name="sg.png" hash="8af65159c137a6a7ed3d1bc9c2eed18b"/><file name="sh.png" hash="e707aacb0986ad7a4a60ab8d82cf093d"/><file name="si.png" hash="d94ea79a5a8e0b6900941a1271c58191"/><file name="sj.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="sk.png" hash="5a7edc7e4492629ea5ce24b830839d32"/><file name="sl.png" hash="73904ec1cf4f0be282693c4e954e5821"/><file name="sm.png" hash="56e3c1b483bf27e619146b50ee5181bc"/><file name="sn.png" hash="501a5fab662d127ad588825cd0cd4954"/><file name="so.png" hash="4be2ffc4d06de407434a877dc03ff88b"/><file name="sq.png" hash="7ad607e32e143c3a047e64aef307a330"/><file name="sr.png" hash="8f9aca73767b8e7876c72add438a6007"/><file name="ss.png" hash="d23ec216d4b0865912e1c8e1dd04358a"/><file name="st.png" hash="ab272a50ea656512c036c001fcaca61c"/><file name="su.png" hash="b2a10dd9ef92e4fd4fc658f32dee1adb"/><file name="sv.png" hash="c6c853766dfbab2ddd225980d3012f5c"/><file name="sw.png" hash="df5ba64f61a3b83a3fa282be21a61050"/><file name="sy.png" hash="a0886eca3ef87d646af1514d025752f6"/><file name="sz.png" hash="e97675a21b5280b9cb4c1fc99aab004f"/><file name="ta.png" hash="f765d3525b985c93500c0f9548d1b6ee"/><file name="tc.png" hash="50733ccc670058e9a737b652089287ca"/><file name="td.png" hash="6c8d3f6c96bcd5d34a0bae497d0e13ca"/><file name="te.png" hash="50d62cba8134c8c097d073646cda1b9b"/><file name="tf.png" hash="f7ccbaa513a24eb3dc4c7860ab8007ee"/><file name="tg.png" hash="ac323c8259468d0d02fcc805895f26f3"/><file name="th.png" hash="af85286bf1cadae9c2c636fe83195251"/><file name="ti.png" hash="e28e0f5115ca4becd9224c722d59f03a"/><file name="tj.png" hash="5cc548d1858d19f336ca7390b381ad07"/><file name="tk.png" hash="896fb1a34638a76361d4307668cd5414"/><file name="tl.png" hash="093e76da6759647c331ea75ef1ba9da0"/><file name="tm.png" hash="b36ce71226fad4da67764e05b800292b"/><file name="tn.png" hash="ae9947d99c48894d1d1824d624361eb9"/><file name="to.png" hash="ce868fde2d77788a669001995f4b73df"/><file name="tr.png" hash="31ea1f705854ad57c432845068bd05d3"/><file name="tt.png" hash="9ead47e1d48627b1806cd992b62c8c2b"/><file name="tv.png" hash="6fec556dd8bd936ca706b0d7cc864993"/><file name="tw.png" hash="0e41af2b3ca03d145e7665d0821931fa"/><file name="ty.png" hash="3be1be69bee819219287102ea24466a7"/><file name="tz.png" hash="c846788492ef1188f631113bd8cced5c"/><file name="ua.png" hash="7ef7a6f5def3a4117d5c2f08e37008ff"/><file name="ug.png" hash="17e134aa84a076bf5541f5d11c616e5d"/><file name="uk.png" hash="b1901378ddede69f619f2ead439878e0"/><file name="um.png" hash="f0f12f4afaccb13ea40e15f3b81c5921"/><file name="ur.png" hash="958d512e18c1ed35b2d54d601c7a393e"/><file name="us.png" hash="968591e0050981be9fa94bd2597afb48"/><file name="uy.png" hash="9ca8f3d9b1b1101d30a4555c997e871b"/><file name="uz.png" hash="37e4bdb64229f4624cacec7d4297214d"/><file name="va.png" hash="493642ad6bf3a344602fe006e7d44fa2"/><file name="vc.png" hash="60eec8d579d55ea0f2ec62d837c104d2"/><file name="ve.png" hash="3aee24fa5f6a85f5ce452001182fdccc"/><file name="vg.png" hash="79ef17575149f2663df51419f39feff2"/><file name="vi.png" hash="c95b9175142cd29177a9b25e16c3fc39"/><file name="vn.png" hash="638136b1a6f5dab7be6cec84fcc2cd53"/><file name="vo.png" hash="488430cd9a358f4a5110cffd352705a1"/><file name="vu.png" hash="c37b82a52cdf80492ee94dc7f46256cf"/><file name="wa.png" hash="2404b88a07bdb7aef652eec0f6fce287"/><file name="wales.png" hash="42c7ca83721190322499c94d7ff2ae26"/><file name="wf.png" hash="86cc1aa337ebb6cb74a2c3196770a7f5"/><file name="wo.png" hash="501a5fab662d127ad588825cd0cd4954"/><file name="ws.png" hash="68183f64328d121a9ee77a92319bbfcd"/><file name="xh.png" hash="18851b500f3cda4245698fc62a39cc39"/><file name="ye.png" hash="290e09160bb2ef42ba8129a41159eb07"/><file name="yt.png" hash="f46c7cd7b2474cbcf61c5b2007a7558f"/><file name="za.png" hash="98e1044d0ffd11afc67a79f3676ba97a"/><file name="zh.png" hash="a82ff00f39eff54062328b4474c33dbc"/><file name="zm.png" hash="ec69def9e77d23446867caeb4a5223b1"/><file name="zw.png" hash="e7ae0b7e3c49a5a775a9d6854912e21a"/></dir></dir><dir name="lib"><file name="flag-icons-plugin.js" hash="8de745481726c22c579becc11691e3a7"/></dir></dir><dir name="formatlesspaste"><file name="README.md" hash="3d5f9f079a3bfb9724af1cb433693ae4"/><dir name="css"><file name="formatless.css" hash="1d4145e16292c84f82d7d3df96a4902d"/></dir><dir name="img"><file name="button.png" hash="2abbec214757b64641000dda108ce9ce"/></dir><dir name="lib"><file name="formatlesshandler.js" hash="a3b34dde4227febdc6be8acc1a70e40a"/><file name="formatlesspaste-plugin.js" hash="b94d3d0cd3c28385daec688bc912d714"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="3311f31f2d2fc224cb000e181f2d5d8e"/></dir><file name="i18n.js" hash="a2a6ee5c10e67ee6c558b5d1b30ac77a"/></dir><file name="package.json" hash="dad18d16d8c04dc4d3d03c28a0288c0a"/></dir><dir name="googletranslate"><file name="README.md" hash="57786a6fae68a5d577f4a30b8f79bd81"/><dir name="css"><file name="googletranslate.css" hash="f8172c9498d1ed609155edab49206320"/></dir><dir name="img"><file name="ad.png" hash="cc750844215aed20b2b05c10d6082b0d"/><file name="ae.png" hash="7391e6b6df7b181d51ffeb2a5a6d7bd4"/><file name="af.png" hash="ae7c58272ae46cde945ccc4bed00fe9e"/><file name="ag.png" hash="390af4c36d462bbf2627a1182946825a"/><file name="ai.png" hash="08cf0788a582710062140f69887300fc"/><file name="al.png" hash="7c5bc720b2cf3047c9fab800e271eec9"/><file name="am.png" hash="fd5d9d1d864ea76406afec5e11f2632f"/><file name="an.png" hash="7d7d682a9dc9f2a26a6dea1fdb87334f"/><file name="ao.png" hash="41a8aa1e11f7086d2413d8d9a777680b"/><file name="ar.png" hash="2fa357868e66f1aec9c4c4230baa45b3"/><file name="as.png" hash="96e49204e758277b6720584c4d844ecc"/><file name="at.png" hash="62bf1a5653692b34b2ee1f734a59b062"/><file name="au.png" hash="2fba49c88880e9ffcff947015cb7ab9c"/><file name="aw.png" hash="6e82279ceb4702171f345fead7ff3e35"/><file name="ax.png" hash="27708378fcc025e375fd3c303fc1cbd6"/><file name="az.png" hash="d63f5c99e25eca9de2a97f63161f38e6"/><file name="ba.png" hash="cbb6ce46c69e14bbd8d2c8fd91680d33"/><file name="bb.png" hash="47c8aea417660e5f4e8b5a7a73f2cb18"/><file name="bd.png" hash="f02d8deb9de271cd246646872798af15"/><file name="be.png" hash="2404b88a07bdb7aef652eec0f6fce287"/><file name="bf.png" hash="cc65efa74cd7367933ecd52115204b2d"/><file name="bg.png" hash="77b2183ab10cd26ee4e79fdfc12b8621"/><file name="bh.png" hash="5bbf6106968b2517d924bac4d99b41bd"/><file name="bi.png" hash="427c72cd341f288faf0e62f03586c7ba"/><file name="bj.png" hash="67bd2e990cc7e3dc5bbae821fd38f20c"/><file name="bm.png" hash="cf195bf1921659202cf8ae899e9171d0"/><file name="bn.png" hash="4911cd2a8fae48d82f9ce124d908be3c"/><file name="bo.png" hash="151854ff619d7a44894a37b5be73f463"/><file name="br.png" hash="54c40b8a9ad7df4783d19acc05910f8e"/><file name="bs.png" hash="8b45f84cb140ec2448692187a82abfc7"/><file name="bt.png" hash="2f13e87c1868b03b0b47cd0bb60737d5"/><file name="bv.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="bw.png" hash="15d59270fb25d9e467d5a730682c5644"/><file name="by.png" hash="9e18ac464c49a91d90eaf11ad21357e9"/><file name="bz.png" hash="6e14aaafe632fe367409415545c27e73"/><file name="ca.png" hash="8618709a45d8d1c4d9d254c61bdf29b8"/><file name="catalonia.png" hash="76991f3da407b7dec2603ff86f1b9724"/><file name="cc.png" hash="ebbfb19d79975289e7a9cbb12caf0a23"/><file name="cd.png" hash="34e2a72a9cb9e873db413b020d7f1845"/><file name="cf.png" hash="252d14145f4c47374a3e0bc2bb8ae0bf"/><file name="cg.png" hash="b5bed6c75a72dc56f8eb8c559d437f59"/><file name="ch.png" hash="e67b19a7767114078cda2b3c874a5d5b"/><file name="ci.png" hash="90e8d52c215176bb04b7453b84e6fa43"/><file name="ck.png" hash="e70409285b72ac2ebd8d6ee1849e4083"/><file name="cl.png" hash="dc7b3be27813faeb454d02b55b79b9e3"/><file name="cm.png" hash="f5cdc865bf36948532707c42e716e14a"/><file name="cn.png" hash="a82ff00f39eff54062328b4474c33dbc"/><file name="co.png" hash="4bd223b284a0900cda6826ee656c5333"/><file name="cr.png" hash="cd28a01f91e89fa2b844857642fd5fb7"/><file name="cs.png" hash="4db37e9044c342fb819515d13768e058"/><file name="cu.png" hash="9d5366e9b01d5cd428429e608433d5f3"/><file name="cv.png" hash="2f4edfdcba4cdb3fa903047a235f3296"/><file name="cx.png" hash="8efc55a14b900c47f4b920c4510f192f"/><file name="cy.png" hash="f29741d622fe02759bb7a2a91eb5e2e0"/><file name="cz.png" hash="815b6d2bf60a3179c0652f0b6895bcbb"/><file name="de.png" hash="ddabae687ecae5edaaeb808d440543e6"/><file name="dj.png" hash="197e6fc2579eec8bcd7303393de841ba"/><file name="dk.png" hash="fe926c8271b35febf4a6cb0a41b111eb"/><file name="dm.png" hash="85845da8ae28e94f2885ceeb16515dd0"/><file name="do.png" hash="153949105845e18a133a4c778b3de31e"/><file name="dz.png" hash="c57f3c0951ba1525b3359fc0acbfd6b1"/><file name="ec.png" hash="0152114421e281913d0c1c148e196c92"/><file name="ee.png" hash="1cdfaaa10ff170ce19ed46339efe3af6"/><file name="eg.png" hash="09c48d3562f0dc51e2f9507704f6437f"/><file name="eh.png" hash="7dd5a46a34bee2f10532f1213a941d7b"/><file name="en.png" hash="73f2f220f6d51d249e45a04d9a03da91"/><file name="er.png" hash="481d394ac9a44f3040f7c457fc1f23a6"/><file name="es.png" hash="d6693ce2a6346b2da89ceda335554e0a"/><file name="et.png" hash="73763e46da896f3e951954ad473b4a4b"/><file name="europeanunion.png" hash="ffce5e64df4d367a20e1ef4033f60257"/><file name="fam.png" hash="0b36de21772c8d87e1d0106878b65231"/><file name="fi.png" hash="e30bd2493de78c998d1ac6c22d20146b"/><file name="fj.png" hash="7c3e78e31bb34b0fafbb0865737f8d36"/><file name="fk.png" hash="9627317fe9a5757ee8c06df7d8e8a887"/><file name="fm.png" hash="d3767ea95466571e10c7e563d456d754"/><file name="fo.png" hash="d0e6b0a3fdb4e2271b5b5057bd969966"/><file name="fr.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="ga.png" hash="972da84bdea1359d69c719a37d89d219"/><file name="gb.png" hash="0894999b108830afc0733ee7b6e08310"/><file name="gd.png" hash="95b8b79fafc6b1510978977bc8067b46"/><file name="ge.png" hash="aa40721b7a179f6c9c8f666a64063767"/><file name="gf.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="gh.png" hash="12da850e724de5ff779572bbdb8ded71"/><file name="gi.png" hash="0ca5a4db2ac11c8a5cb57701b18b8088"/><file name="gl.png" hash="073b6bf37f6eefe07145d9dd89bc9e7d"/><file name="gm.png" hash="a7d785fa41e66a5e6d82301688686f20"/><file name="gn.png" hash="acba9c908c29db8aa890b6a20265ac22"/><file name="gp.png" hash="c2dc0a2062b24f906431337186888f01"/><file name="gq.png" hash="70f64b2b38b8a21152e7446a1b3e1133"/><file name="gr.png" hash="fd9b321b80be31c027585c8992f1799f"/><file name="gs.png" hash="3b510d36dc70edd5b301da8096c9b71c"/><file name="gt.png" hash="384e9d38421a6853f9c35d48d8c49a85"/><file name="gu.png" hash="2d058f7cea364d247fee5bb53fe70390"/><file name="gw.png" hash="35eb1d9b882111ccec5f58cd778364bf"/><file name="gy.png" hash="d816170967c67a98db73cd89c56014fd"/><file name="hk.png" hash="389d0451c5c2ff40e88a93588dcbd6f1"/><file name="hm.png" hash="2fba49c88880e9ffcff947015cb7ab9c"/><file name="hn.png" hash="ac9242c256af7800a223bdcbf0798f57"/><file name="hr.png" hash="0868c49000b253d9b4f290471898c961"/><file name="ht.png" hash="b5360c0f01d574333b3bfa27c3dce856"/><file name="hu.png" hash="6c6fce8a6fd09c340964b00c5e82a8c3"/><file name="id.png" hash="fed538f9c8cd0500a6a655b55426744c"/><file name="ie.png" hash="48e42d0d1451e7b19b7b79d631a3a95c"/><file name="il.png" hash="a135fcdefe8a391b416bdb102476e12b"/><file name="in.png" hash="50d62cba8134c8c097d073646cda1b9b"/><file name="io.png" hash="38afe5a0e9817027e1f1615028aca521"/><file name="iq.png" hash="39cfe476621ad630cf3418c3234f0594"/><file name="ir.png" hash="2ac099e190547501704d309d59831d2b"/><file name="is.png" hash="7fffd4f1acabc2ccc890049e48587e8a"/><file name="it.png" hash="784f7eb333f0591558bcce9616a3c105"/><file name="jm.png" hash="a582c95e205f76277afa1571940121cd"/><file name="jo.png" hash="9dd19e8da30782b2bfb9b5a0d1c51e8b"/><file name="jp.png" hash="10958397bc7c25c746e6e122365c003c"/><file name="ke.png" hash="357152ed37ece2a45a7d57c5bf30ab3c"/><file name="kg.png" hash="192033ce169b1b107dc4aabb1f635c1c"/><file name="kh.png" hash="8658c066eb4f9d6c15efb31a821b482c"/><file name="ki.png" hash="703ced92b97cc2713038f0d50ee5a0f0"/><file name="km.png" hash="cc942486999d072021c0b3582306f834"/><file name="kn.png" hash="f096727a7612c065259c6334b61a8b6a"/><file name="kp.png" hash="0eaa3e8dc84bae9283a9969f2e360080"/><file name="kr.png" hash="cf63c15bf955e54afed8061497c7f7ea"/><file name="kw.png" hash="2e0485cdb9ca8240c9fc372e4cef0eb7"/><file name="ky.png" hash="da2c56cc2568d516031e3082713fd90c"/><file name="kz.png" hash="6d51066ba152b15fd05d761745333135"/><file name="la.png" hash="3375d707535d69248f0ab23ef80268c8"/><file name="lb.png" hash="dad5d86f0d90cca0ff4ab5332d7fd7fc"/><file name="lc.png" hash="18c05f2c79f8774bbb201593b20a06e2"/><file name="li.png" hash="822034b39b46abaa91127f8342092a32"/><file name="lk.png" hash="4e90c553f186c9776976b5b11dba4ea4"/><file name="lr.png" hash="3b6d8d720721f68ceb465249aad32b27"/><file name="ls.png" hash="c228783a0785a8541d96d5515a2a16cf"/><file name="lt.png" hash="95efec9db9d274d25fbb98eb53a9c384"/><file name="lu.png" hash="3be0b3a6096e9d77d9d7b997d464e612"/><file name="lv.png" hash="6ffae4cc65036d3de052a58e062d1ed7"/><file name="ly.png" hash="3f9d6e8cba5fd7cb8c201acfe9b7bc15"/><file name="ma.png" hash="c936b9f794def7d85fbb4c120d68684e"/><file name="mc.png" hash="63c6fd073106c8b0eb7336d9c19653a2"/><file name="md.png" hash="e414980c55af38676c5312bd330d6bb9"/><file name="me.png" hash="7a2ee5d7f1bc5ef478106a86d2c1cc09"/><file name="mg.png" hash="5aea24a18ca7e8b65770dcf2a738dd08"/><file name="mh.png" hash="948dd15821a6fe45b0df8667b6601ead"/><file name="mk.png" hash="617997cbcaafaea0035a4c0474ae16dd"/><file name="ml.png" hash="d951cb1c43a8077167b731a1aea70b6c"/><file name="mm.png" hash="82ad2104b5490e1f6adfcfa777ab8243"/><file name="mn.png" hash="4adb9a834188753731add527aa4f67f0"/><file name="mo.png" hash="6339bdf0e24c871301d1fc0207e2685f"/><file name="mp.png" hash="929b9802e7bfb58bab0330a4c6925595"/><file name="mq.png" hash="be5fb2cd33e8df13e0b2f2feffb9373f"/><file name="mr.png" hash="6c1cc8a1babe91421a38ddc573ee7cb4"/><file name="ms.png" hash="bfddbc2aae078e0aa80633f784e18526"/><file name="mt.png" hash="7a7ee4f98185ecfb6e1ba753aa6f2111"/><file name="mu.png" hash="48d5cbc23fedfbb77b06ed0e9b04522f"/><file name="mv.png" hash="24c90cfb0c883f9d1b303276c3b069e7"/><file name="mw.png" hash="1d2b8e369b2d4384d1ab4b24315fa139"/><file name="mx.png" hash="479a865f838c70d654a9f818a23f9a7d"/><file name="my.png" hash="e1c0f262c141e8615f819b1cd18393d3"/><file name="mz.png" hash="159c85011041bea6bd3c68b6ba2919d7"/><file name="na.png" hash="e582101531b620fb0138c83602aab920"/><file name="nc.png" hash="ad8bf708e9db5fa423b5da123c914378"/><file name="ne.png" hash="f2eccd65605d8babcdd3af4b01215ecc"/><file name="nf.png" hash="c624a221dae959256a3e143a5147f825"/><file name="ng.png" hash="0c506131e1841cee782e4faf5cec89a9"/><file name="ni.png" hash="f43a5f35488513de58e2e5fbda9a98db"/><file name="nl.png" hash="6186550ebc77b1c51cd3ae37e78c33c1"/><file name="no.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="np.png" hash="52c16445053df13abb08cedbe82f1f28"/><file name="nr.png" hash="2fb04b74787698835b63a46cbdef6fab"/><file name="nu.png" hash="9a2f682db640f1c36ee40f296f63dc87"/><file name="nz.png" hash="179cc39a58e324df1e9a19a5eae9dca0"/><file name="om.png" hash="7b002bc8c4ab1a85c2c807ec2c4442d2"/><file name="pa.png" hash="64795009d69b36b6a4461b8159dcf356"/><file name="pe.png" hash="d1ed0462edb8cbc3220b7aca250b0437"/><file name="pf.png" hash="e59d18e48cf0924687618bbf60ea4fee"/><file name="pg.png" hash="48f68aaeefaa3b8ee7ce1f1761e6c11d"/><file name="ph.png" hash="8ff2d08518d3e1224d34467f5e24fcc2"/><file name="pk.png" hash="3bd18971ec170e6e9c461026068508da"/><file name="pl.png" hash="fad0e96c20f20be196499d26a6c74cd1"/><file name="pm.png" hash="ba41b8c349070250f814188080c2a8e8"/><file name="pn.png" hash="e4dcc857f534b48e8377ee36f63be013"/><file name="pr.png" hash="40b7fb1a4c1ebb076d40f0df5c6fd59a"/><file name="ps.png" hash="68d5f99924c67ef7d3b3aa32ff22b805"/><file name="pt.png" hash="5b8ab69ac52129bd32a3927f1b94d170"/><file name="pw.png" hash="f2bff7cd01d8eff6401e811f3de6af4f"/><file name="py.png" hash="b9d3d10b185a3144e21a452903857870"/><file name="qa.png" hash="c1dc363a27f5b5d19e24032747d7bedf"/><file name="re.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="ro.png" hash="d038c9c152c5e14f875c7b13afcd4711"/><file name="rs.png" hash="5b672e3ee63317614288615ba0774bf7"/><file name="ru.png" hash="0d31ef75adef220e73f0cb93a84a7422"/><file name="rw.png" hash="bef92348e3ea38dc462326e1ba2ff622"/><file name="sa.png" hash="605884cec6f446d418a092c0941acad5"/><file name="sb.png" hash="5e4b74f8a611742bdc3a04629e871eb4"/><file name="sc.png" hash="39650e922851e1b72165d7b016dc3b44"/><file name="scotland.png" hash="eca5bebe6e4dbc9eb858d4f58ea3f9de"/><file name="sd.png" hash="b972f90fea3369c020d258d1b860a6e0"/><file name="se.png" hash="4c01f06db23324267e2802dcade3572f"/><file name="sg.png" hash="8af65159c137a6a7ed3d1bc9c2eed18b"/><file name="sh.png" hash="e707aacb0986ad7a4a60ab8d82cf093d"/><file name="si.png" hash="d94ea79a5a8e0b6900941a1271c58191"/><file name="sj.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="sk.png" hash="5a7edc7e4492629ea5ce24b830839d32"/><file name="sl.png" hash="73904ec1cf4f0be282693c4e954e5821"/><file name="sm.png" hash="56e3c1b483bf27e619146b50ee5181bc"/><file name="sn.png" hash="501a5fab662d127ad588825cd0cd4954"/><file name="so.png" hash="4be2ffc4d06de407434a877dc03ff88b"/><file name="sr.png" hash="8f9aca73767b8e7876c72add438a6007"/><file name="st.png" hash="ab272a50ea656512c036c001fcaca61c"/><file name="sv.png" hash="c6c853766dfbab2ddd225980d3012f5c"/><file name="sy.png" hash="a0886eca3ef87d646af1514d025752f6"/><file name="sz.png" hash="e97675a21b5280b9cb4c1fc99aab004f"/><file name="tc.png" hash="50733ccc670058e9a737b652089287ca"/><file name="td.png" hash="6c8d3f6c96bcd5d34a0bae497d0e13ca"/><file name="tf.png" hash="f7ccbaa513a24eb3dc4c7860ab8007ee"/><file name="tg.png" hash="5c62720575f914ffff9fe06e2b9c1b95"/><file name="th.png" hash="af85286bf1cadae9c2c636fe83195251"/><file name="tj.png" hash="5cc548d1858d19f336ca7390b381ad07"/><file name="tk.png" hash="896fb1a34638a76361d4307668cd5414"/><file name="tl.png" hash="093e76da6759647c331ea75ef1ba9da0"/><file name="tm.png" hash="b36ce71226fad4da67764e05b800292b"/><file name="tn.png" hash="ae9947d99c48894d1d1824d624361eb9"/><file name="to.png" hash="ce868fde2d77788a669001995f4b73df"/><file name="tr.png" hash="31ea1f705854ad57c432845068bd05d3"/><file name="tt.png" hash="9ead47e1d48627b1806cd992b62c8c2b"/><file name="tv.png" hash="6fec556dd8bd936ca706b0d7cc864993"/><file name="tw.png" hash="0e41af2b3ca03d145e7665d0821931fa"/><file name="tz.png" hash="c846788492ef1188f631113bd8cced5c"/><file name="ua.png" hash="7ef7a6f5def3a4117d5c2f08e37008ff"/><file name="ug.png" hash="17e134aa84a076bf5541f5d11c616e5d"/><file name="um.png" hash="f0f12f4afaccb13ea40e15f3b81c5921"/><file name="us.png" hash="968591e0050981be9fa94bd2597afb48"/><file name="uy.png" hash="9ca8f3d9b1b1101d30a4555c997e871b"/><file name="uz.png" hash="37e4bdb64229f4624cacec7d4297214d"/><file name="va.png" hash="493642ad6bf3a344602fe006e7d44fa2"/><file name="vc.png" hash="60eec8d579d55ea0f2ec62d837c104d2"/><file name="ve.png" hash="3aee24fa5f6a85f5ce452001182fdccc"/><file name="vg.png" hash="79ef17575149f2663df51419f39feff2"/><file name="vi.png" hash="c95b9175142cd29177a9b25e16c3fc39"/><file name="vn.png" hash="638136b1a6f5dab7be6cec84fcc2cd53"/><file name="vu.png" hash="c37b82a52cdf80492ee94dc7f46256cf"/><file name="wales.png" hash="42c7ca83721190322499c94d7ff2ae26"/><file name="wf.png" hash="86cc1aa337ebb6cb74a2c3196770a7f5"/><file name="ws.png" hash="68183f64328d121a9ee77a92319bbfcd"/><file name="ye.png" hash="290e09160bb2ef42ba8129a41159eb07"/><file name="yt.png" hash="f46c7cd7b2474cbcf61c5b2007a7558f"/><file name="za.png" hash="98e1044d0ffd11afc67a79f3676ba97a"/><file name="zm.png" hash="ec69def9e77d23446867caeb4a5223b1"/><file name="zw.png" hash="e7ae0b7e3c49a5a775a9d6854912e21a"/></dir><dir name="lib"><file name="googletranslate-plugin.js" hash="3c52f201fa4eeb1b2137b7e863c66d0a"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="headerids"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="headerids.css" hash="61c7a2551ce3119dc0b428b9e80eb18c"/></dir><dir name="lib"><file name="headerids-plugin.js" hash="fa51dd72c85ff0c3af31892f2c6582bd"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="dd9bd5e3a7d01e1c09b5308c8ca34a21"/></dir><dir name="en"><file name="i18n.js" hash="712183db4b838ce7d90478722333f0f1"/></dir><file name="i18n.js" hash="5ba01bebc68d37746351bd2d87df415f"/></dir></dir><dir name="hints"><dir name="dep"><file name="jquery.poshytip.js" hash="533e1946f8b04ab676648c265e6ada1b"/></dir><dir name="i18n"><file name="de.json" hash="c4f5371347ce9ae8b079c1e4033a701f"/><file name="en.json" hash="8b82c1ca2c0cc6becbea84e3fcfbb3c3"/></dir><dir name="img"><file name="tip-twitter_arrows.gif" hash="6d6bbf94a6e54cc32efa86c958ee71ee"/></dir><file name="package.json" hash="20e479119976054c92a3e19fbe164b18"/><dir name="src"><file name="hints.css" hash="756f3b384c2dfdcafad59b682d884b06"/><file name="hints.js" hash="ec84322a697aeef808fd477dd740c524"/></dir></dir><dir name="linkbrowser"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="img"><dir name="flags"><file name="ad.png" hash="cc750844215aed20b2b05c10d6082b0d"/><file name="ae.png" hash="7391e6b6df7b181d51ffeb2a5a6d7bd4"/><file name="af.png" hash="ae7c58272ae46cde945ccc4bed00fe9e"/><file name="ag.png" hash="390af4c36d462bbf2627a1182946825a"/><file name="ai.png" hash="08cf0788a582710062140f69887300fc"/><file name="al.png" hash="7c5bc720b2cf3047c9fab800e271eec9"/><file name="am.png" hash="fd5d9d1d864ea76406afec5e11f2632f"/><file name="an.png" hash="7d7d682a9dc9f2a26a6dea1fdb87334f"/><file name="ao.png" hash="41a8aa1e11f7086d2413d8d9a777680b"/><file name="ar.png" hash="2fa357868e66f1aec9c4c4230baa45b3"/><file name="as.png" hash="96e49204e758277b6720584c4d844ecc"/><file name="at.png" hash="62bf1a5653692b34b2ee1f734a59b062"/><file name="au.png" hash="2fba49c88880e9ffcff947015cb7ab9c"/><file name="aw.png" hash="6e82279ceb4702171f345fead7ff3e35"/><file name="ax.png" hash="27708378fcc025e375fd3c303fc1cbd6"/><file name="az.png" hash="d63f5c99e25eca9de2a97f63161f38e6"/><file name="ba.png" hash="cbb6ce46c69e14bbd8d2c8fd91680d33"/><file name="bb.png" hash="47c8aea417660e5f4e8b5a7a73f2cb18"/><file name="bd.png" hash="f02d8deb9de271cd246646872798af15"/><file name="be.png" hash="2404b88a07bdb7aef652eec0f6fce287"/><file name="bf.png" hash="cc65efa74cd7367933ecd52115204b2d"/><file name="bg.png" hash="77b2183ab10cd26ee4e79fdfc12b8621"/><file name="bh.png" hash="5bbf6106968b2517d924bac4d99b41bd"/><file name="bi.png" hash="427c72cd341f288faf0e62f03586c7ba"/><file name="bj.png" hash="67bd2e990cc7e3dc5bbae821fd38f20c"/><file name="bm.png" hash="cf195bf1921659202cf8ae899e9171d0"/><file name="bn.png" hash="4911cd2a8fae48d82f9ce124d908be3c"/><file name="bo.png" hash="151854ff619d7a44894a37b5be73f463"/><file name="br.png" hash="54c40b8a9ad7df4783d19acc05910f8e"/><file name="bs.png" hash="8b45f84cb140ec2448692187a82abfc7"/><file name="bt.png" hash="2f13e87c1868b03b0b47cd0bb60737d5"/><file name="bv.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="bw.png" hash="15d59270fb25d9e467d5a730682c5644"/><file name="by.png" hash="9e18ac464c49a91d90eaf11ad21357e9"/><file name="bz.png" hash="6e14aaafe632fe367409415545c27e73"/><file name="ca.png" hash="8618709a45d8d1c4d9d254c61bdf29b8"/><file name="catalonia.png" hash="76991f3da407b7dec2603ff86f1b9724"/><file name="cc.png" hash="ebbfb19d79975289e7a9cbb12caf0a23"/><file name="cd.png" hash="34e2a72a9cb9e873db413b020d7f1845"/><file name="cf.png" hash="252d14145f4c47374a3e0bc2bb8ae0bf"/><file name="cg.png" hash="b5bed6c75a72dc56f8eb8c559d437f59"/><file name="ch.png" hash="e67b19a7767114078cda2b3c874a5d5b"/><file name="ci.png" hash="90e8d52c215176bb04b7453b84e6fa43"/><file name="ck.png" hash="e70409285b72ac2ebd8d6ee1849e4083"/><file name="cl.png" hash="dc7b3be27813faeb454d02b55b79b9e3"/><file name="cm.png" hash="f5cdc865bf36948532707c42e716e14a"/><file name="cn.png" hash="a82ff00f39eff54062328b4474c33dbc"/><file name="co.png" hash="4bd223b284a0900cda6826ee656c5333"/><file name="cr.png" hash="cd28a01f91e89fa2b844857642fd5fb7"/><file name="cs.png" hash="4db37e9044c342fb819515d13768e058"/><file name="cu.png" hash="9d5366e9b01d5cd428429e608433d5f3"/><file name="cv.png" hash="2f4edfdcba4cdb3fa903047a235f3296"/><file name="cx.png" hash="8efc55a14b900c47f4b920c4510f192f"/><file name="cy.png" hash="f29741d622fe02759bb7a2a91eb5e2e0"/><file name="cz.png" hash="815b6d2bf60a3179c0652f0b6895bcbb"/><file name="de.png" hash="ddabae687ecae5edaaeb808d440543e6"/><file name="dj.png" hash="197e6fc2579eec8bcd7303393de841ba"/><file name="dk.png" hash="fe926c8271b35febf4a6cb0a41b111eb"/><file name="dm.png" hash="85845da8ae28e94f2885ceeb16515dd0"/><file name="do.png" hash="153949105845e18a133a4c778b3de31e"/><file name="dz.png" hash="c57f3c0951ba1525b3359fc0acbfd6b1"/><file name="ec.png" hash="0152114421e281913d0c1c148e196c92"/><file name="ee.png" hash="1cdfaaa10ff170ce19ed46339efe3af6"/><file name="eg.png" hash="09c48d3562f0dc51e2f9507704f6437f"/><file name="eh.png" hash="7dd5a46a34bee2f10532f1213a941d7b"/><file name="en.png" hash="73f2f220f6d51d249e45a04d9a03da91"/><file name="er.png" hash="481d394ac9a44f3040f7c457fc1f23a6"/><file name="es.png" hash="d6693ce2a6346b2da89ceda335554e0a"/><file name="et.png" hash="73763e46da896f3e951954ad473b4a4b"/><file name="europeanunion.png" hash="ffce5e64df4d367a20e1ef4033f60257"/><file name="fam.png" hash="0b36de21772c8d87e1d0106878b65231"/><file name="fi.png" hash="e30bd2493de78c998d1ac6c22d20146b"/><file name="fj.png" hash="7c3e78e31bb34b0fafbb0865737f8d36"/><file name="fk.png" hash="9627317fe9a5757ee8c06df7d8e8a887"/><file name="fm.png" hash="d3767ea95466571e10c7e563d456d754"/><file name="fo.png" hash="d0e6b0a3fdb4e2271b5b5057bd969966"/><file name="fr.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="ga.png" hash="972da84bdea1359d69c719a37d89d219"/><file name="gb.png" hash="0894999b108830afc0733ee7b6e08310"/><file name="gd.png" hash="95b8b79fafc6b1510978977bc8067b46"/><file name="ge.png" hash="aa40721b7a179f6c9c8f666a64063767"/><file name="gf.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="gh.png" hash="12da850e724de5ff779572bbdb8ded71"/><file name="gi.png" hash="0ca5a4db2ac11c8a5cb57701b18b8088"/><file name="gl.png" hash="073b6bf37f6eefe07145d9dd89bc9e7d"/><file name="gm.png" hash="a7d785fa41e66a5e6d82301688686f20"/><file name="gn.png" hash="acba9c908c29db8aa890b6a20265ac22"/><file name="gp.png" hash="c2dc0a2062b24f906431337186888f01"/><file name="gq.png" hash="70f64b2b38b8a21152e7446a1b3e1133"/><file name="gr.png" hash="fd9b321b80be31c027585c8992f1799f"/><file name="gs.png" hash="3b510d36dc70edd5b301da8096c9b71c"/><file name="gt.png" hash="384e9d38421a6853f9c35d48d8c49a85"/><file name="gu.png" hash="2d058f7cea364d247fee5bb53fe70390"/><file name="gw.png" hash="35eb1d9b882111ccec5f58cd778364bf"/><file name="gy.png" hash="d816170967c67a98db73cd89c56014fd"/><file name="hk.png" hash="389d0451c5c2ff40e88a93588dcbd6f1"/><file name="hm.png" hash="2fba49c88880e9ffcff947015cb7ab9c"/><file name="hn.png" hash="ac9242c256af7800a223bdcbf0798f57"/><file name="hr.png" hash="0868c49000b253d9b4f290471898c961"/><file name="ht.png" hash="b5360c0f01d574333b3bfa27c3dce856"/><file name="hu.png" hash="6c6fce8a6fd09c340964b00c5e82a8c3"/><file name="id.png" hash="fed538f9c8cd0500a6a655b55426744c"/><file name="ie.png" hash="48e42d0d1451e7b19b7b79d631a3a95c"/><file name="il.png" hash="a135fcdefe8a391b416bdb102476e12b"/><file name="in.png" hash="50d62cba8134c8c097d073646cda1b9b"/><file name="io.png" hash="38afe5a0e9817027e1f1615028aca521"/><file name="iq.png" hash="39cfe476621ad630cf3418c3234f0594"/><file name="ir.png" hash="2ac099e190547501704d309d59831d2b"/><file name="is.png" hash="7fffd4f1acabc2ccc890049e48587e8a"/><file name="it.png" hash="784f7eb333f0591558bcce9616a3c105"/><file name="jm.png" hash="a582c95e205f76277afa1571940121cd"/><file name="jo.png" hash="9dd19e8da30782b2bfb9b5a0d1c51e8b"/><file name="jp.png" hash="10958397bc7c25c746e6e122365c003c"/><file name="ke.png" hash="357152ed37ece2a45a7d57c5bf30ab3c"/><file name="kg.png" hash="192033ce169b1b107dc4aabb1f635c1c"/><file name="kh.png" hash="8658c066eb4f9d6c15efb31a821b482c"/><file name="ki.png" hash="703ced92b97cc2713038f0d50ee5a0f0"/><file name="km.png" hash="cc942486999d072021c0b3582306f834"/><file name="kn.png" hash="f096727a7612c065259c6334b61a8b6a"/><file name="kp.png" hash="0eaa3e8dc84bae9283a9969f2e360080"/><file name="kr.png" hash="cf63c15bf955e54afed8061497c7f7ea"/><file name="kw.png" hash="2e0485cdb9ca8240c9fc372e4cef0eb7"/><file name="ky.png" hash="da2c56cc2568d516031e3082713fd90c"/><file name="kz.png" hash="6d51066ba152b15fd05d761745333135"/><file name="la.png" hash="3375d707535d69248f0ab23ef80268c8"/><file name="lb.png" hash="dad5d86f0d90cca0ff4ab5332d7fd7fc"/><file name="lc.png" hash="18c05f2c79f8774bbb201593b20a06e2"/><file name="li.png" hash="822034b39b46abaa91127f8342092a32"/><file name="lk.png" hash="4e90c553f186c9776976b5b11dba4ea4"/><file name="lr.png" hash="3b6d8d720721f68ceb465249aad32b27"/><file name="ls.png" hash="c228783a0785a8541d96d5515a2a16cf"/><file name="lt.png" hash="95efec9db9d274d25fbb98eb53a9c384"/><file name="lu.png" hash="3be0b3a6096e9d77d9d7b997d464e612"/><file name="lv.png" hash="6ffae4cc65036d3de052a58e062d1ed7"/><file name="ly.png" hash="3f9d6e8cba5fd7cb8c201acfe9b7bc15"/><file name="ma.png" hash="c936b9f794def7d85fbb4c120d68684e"/><file name="mc.png" hash="63c6fd073106c8b0eb7336d9c19653a2"/><file name="md.png" hash="e414980c55af38676c5312bd330d6bb9"/><file name="me.png" hash="7a2ee5d7f1bc5ef478106a86d2c1cc09"/><file name="mg.png" hash="5aea24a18ca7e8b65770dcf2a738dd08"/><file name="mh.png" hash="948dd15821a6fe45b0df8667b6601ead"/><file name="mk.png" hash="617997cbcaafaea0035a4c0474ae16dd"/><file name="ml.png" hash="d951cb1c43a8077167b731a1aea70b6c"/><file name="mm.png" hash="82ad2104b5490e1f6adfcfa777ab8243"/><file name="mn.png" hash="4adb9a834188753731add527aa4f67f0"/><file name="mo.png" hash="6339bdf0e24c871301d1fc0207e2685f"/><file name="mp.png" hash="929b9802e7bfb58bab0330a4c6925595"/><file name="mq.png" hash="be5fb2cd33e8df13e0b2f2feffb9373f"/><file name="mr.png" hash="6c1cc8a1babe91421a38ddc573ee7cb4"/><file name="ms.png" hash="bfddbc2aae078e0aa80633f784e18526"/><file name="mt.png" hash="7a7ee4f98185ecfb6e1ba753aa6f2111"/><file name="mu.png" hash="48d5cbc23fedfbb77b06ed0e9b04522f"/><file name="mv.png" hash="24c90cfb0c883f9d1b303276c3b069e7"/><file name="mw.png" hash="1d2b8e369b2d4384d1ab4b24315fa139"/><file name="mx.png" hash="479a865f838c70d654a9f818a23f9a7d"/><file name="my.png" hash="e1c0f262c141e8615f819b1cd18393d3"/><file name="mz.png" hash="159c85011041bea6bd3c68b6ba2919d7"/><file name="na.png" hash="e582101531b620fb0138c83602aab920"/><file name="nc.png" hash="ad8bf708e9db5fa423b5da123c914378"/><file name="ne.png" hash="f2eccd65605d8babcdd3af4b01215ecc"/><file name="nf.png" hash="c624a221dae959256a3e143a5147f825"/><file name="ng.png" hash="0c506131e1841cee782e4faf5cec89a9"/><file name="ni.png" hash="f43a5f35488513de58e2e5fbda9a98db"/><file name="nl.png" hash="6186550ebc77b1c51cd3ae37e78c33c1"/><file name="no.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="np.png" hash="52c16445053df13abb08cedbe82f1f28"/><file name="nr.png" hash="2fb04b74787698835b63a46cbdef6fab"/><file name="nu.png" hash="9a2f682db640f1c36ee40f296f63dc87"/><file name="nz.png" hash="179cc39a58e324df1e9a19a5eae9dca0"/><file name="om.png" hash="7b002bc8c4ab1a85c2c807ec2c4442d2"/><file name="pa.png" hash="64795009d69b36b6a4461b8159dcf356"/><file name="pe.png" hash="d1ed0462edb8cbc3220b7aca250b0437"/><file name="pf.png" hash="e59d18e48cf0924687618bbf60ea4fee"/><file name="pg.png" hash="48f68aaeefaa3b8ee7ce1f1761e6c11d"/><file name="ph.png" hash="8ff2d08518d3e1224d34467f5e24fcc2"/><file name="pk.png" hash="3bd18971ec170e6e9c461026068508da"/><file name="pl.png" hash="fad0e96c20f20be196499d26a6c74cd1"/><file name="pm.png" hash="ba41b8c349070250f814188080c2a8e8"/><file name="pn.png" hash="e4dcc857f534b48e8377ee36f63be013"/><file name="pr.png" hash="40b7fb1a4c1ebb076d40f0df5c6fd59a"/><file name="ps.png" hash="68d5f99924c67ef7d3b3aa32ff22b805"/><file name="pt.png" hash="5b8ab69ac52129bd32a3927f1b94d170"/><file name="pw.png" hash="f2bff7cd01d8eff6401e811f3de6af4f"/><file name="py.png" hash="b9d3d10b185a3144e21a452903857870"/><file name="qa.png" hash="c1dc363a27f5b5d19e24032747d7bedf"/><file name="re.png" hash="c1cf1874c3305e5663547a48f6ad2d8c"/><file name="ro.png" hash="d038c9c152c5e14f875c7b13afcd4711"/><file name="rs.png" hash="5b672e3ee63317614288615ba0774bf7"/><file name="ru.png" hash="0d31ef75adef220e73f0cb93a84a7422"/><file name="rw.png" hash="bef92348e3ea38dc462326e1ba2ff622"/><file name="sa.png" hash="605884cec6f446d418a092c0941acad5"/><file name="sb.png" hash="5e4b74f8a611742bdc3a04629e871eb4"/><file name="sc.png" hash="39650e922851e1b72165d7b016dc3b44"/><file name="scotland.png" hash="eca5bebe6e4dbc9eb858d4f58ea3f9de"/><file name="sd.png" hash="b972f90fea3369c020d258d1b860a6e0"/><file name="se.png" hash="4c01f06db23324267e2802dcade3572f"/><file name="sg.png" hash="8af65159c137a6a7ed3d1bc9c2eed18b"/><file name="sh.png" hash="e707aacb0986ad7a4a60ab8d82cf093d"/><file name="si.png" hash="d94ea79a5a8e0b6900941a1271c58191"/><file name="sj.png" hash="559ce5baaee373db8da150a5066c1062"/><file name="sk.png" hash="5a7edc7e4492629ea5ce24b830839d32"/><file name="sl.png" hash="73904ec1cf4f0be282693c4e954e5821"/><file name="sm.png" hash="56e3c1b483bf27e619146b50ee5181bc"/><file name="sn.png" hash="501a5fab662d127ad588825cd0cd4954"/><file name="so.png" hash="4be2ffc4d06de407434a877dc03ff88b"/><file name="sr.png" hash="8f9aca73767b8e7876c72add438a6007"/><file name="st.png" hash="ab272a50ea656512c036c001fcaca61c"/><file name="sv.png" hash="c6c853766dfbab2ddd225980d3012f5c"/><file name="sy.png" hash="a0886eca3ef87d646af1514d025752f6"/><file name="sz.png" hash="e97675a21b5280b9cb4c1fc99aab004f"/><file name="tc.png" hash="50733ccc670058e9a737b652089287ca"/><file name="td.png" hash="6c8d3f6c96bcd5d34a0bae497d0e13ca"/><file name="tf.png" hash="f7ccbaa513a24eb3dc4c7860ab8007ee"/><file name="tg.png" hash="5c62720575f914ffff9fe06e2b9c1b95"/><file name="th.png" hash="af85286bf1cadae9c2c636fe83195251"/><file name="tj.png" hash="5cc548d1858d19f336ca7390b381ad07"/><file name="tk.png" hash="896fb1a34638a76361d4307668cd5414"/><file name="tl.png" hash="093e76da6759647c331ea75ef1ba9da0"/><file name="tm.png" hash="b36ce71226fad4da67764e05b800292b"/><file name="tn.png" hash="ae9947d99c48894d1d1824d624361eb9"/><file name="to.png" hash="ce868fde2d77788a669001995f4b73df"/><file name="tr.png" hash="31ea1f705854ad57c432845068bd05d3"/><file name="tt.png" hash="9ead47e1d48627b1806cd992b62c8c2b"/><file name="tv.png" hash="6fec556dd8bd936ca706b0d7cc864993"/><file name="tw.png" hash="0e41af2b3ca03d145e7665d0821931fa"/><file name="tz.png" hash="c846788492ef1188f631113bd8cced5c"/><file name="ua.png" hash="7ef7a6f5def3a4117d5c2f08e37008ff"/><file name="ug.png" hash="17e134aa84a076bf5541f5d11c616e5d"/><file name="um.png" hash="f0f12f4afaccb13ea40e15f3b81c5921"/><file name="us.png" hash="968591e0050981be9fa94bd2597afb48"/><file name="uy.png" hash="9ca8f3d9b1b1101d30a4555c997e871b"/><file name="uz.png" hash="37e4bdb64229f4624cacec7d4297214d"/><file name="va.png" hash="493642ad6bf3a344602fe006e7d44fa2"/><file name="vc.png" hash="60eec8d579d55ea0f2ec62d837c104d2"/><file name="ve.png" hash="3aee24fa5f6a85f5ce452001182fdccc"/><file name="vg.png" hash="79ef17575149f2663df51419f39feff2"/><file name="vi.png" hash="c95b9175142cd29177a9b25e16c3fc39"/><file name="vn.png" hash="638136b1a6f5dab7be6cec84fcc2cd53"/><file name="vu.png" hash="c37b82a52cdf80492ee94dc7f46256cf"/><file name="wales.png" hash="42c7ca83721190322499c94d7ff2ae26"/><file name="wf.png" hash="86cc1aa337ebb6cb74a2c3196770a7f5"/><file name="ws.png" hash="68183f64328d121a9ee77a92319bbfcd"/><file name="ye.png" hash="290e09160bb2ef42ba8129a41159eb07"/><file name="yt.png" hash="f46c7cd7b2474cbcf61c5b2007a7558f"/><file name="za.png" hash="98e1044d0ffd11afc67a79f3676ba97a"/><file name="zm.png" hash="ec69def9e77d23446867caeb4a5223b1"/><file name="zw.png" hash="e7ae0b7e3c49a5a775a9d6854912e21a"/></dir></dir><dir name="lib"><file name="linkbrowser-plugin.js" hash="fd87f19114c7d4b9be0e66f838b8faf3"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="0b35b7662d581fb73f15d57241dc712c"/></dir><dir name="fr"><file name="i18n.js" hash="c4c40a8ee7b9838b2d19c64aeb20bc02"/></dir><file name="i18n.js" hash="9c1b1bab4a0cbeeca43f0a7d2973ed6c"/><dir name="pl"><file name="i18n.js" hash="e437a8fd96d668e434e2c54335076c57"/></dir><dir name="ru"><file name="i18n.js" hash="2ed0f0820c48e216320ed394f688d692"/></dir></dir></dir><dir name="linkchecker"><dir name="demo"><file name="index.css" hash="9e891121c2afbebf93e7e60246e4ad83"/><file name="index.html" hash="a4b5ea8b3379165a7e029d5c5ca6b60f"/></dir><dir name="i18n"><file name="en.json" hash="a04e2aadf4cde44a1d7f37e1f8cdd6f3"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/><file name="proxy.php" hash="0df3a89cb6377d67b7a8369550da759d"/><dir name="src"><file name="linkchecker.css" hash="3b6655782ef891892b4b6a832fda637d"/><file name="linkchecker.js" hash="09fa73da4941bb69e15e94ed6d4057b6"/></dir></dir><dir name="listenforcer"><dir name="lib"><file name="listenforcer-plugin.js" hash="fa7c8bf0a3bd5cd8ed6cc80b4890a7f5"/></dir></dir><dir name="metaview"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="metaview.css" hash="7872517ca153db1161440259d68be1b6"/></dir><dir name="img"><file name="anchor.png" hash="b7374ee3cf18e7e75bed7d3442dcfecf"/><file name="blockquote.png" hash="5cd5fb5fe87078c1cae941dad05db2e2"/><file name="button.png" hash="7aff9916eb0a720c7c481a68870a0c1e"/><file name="caption.png" hash="d6a9ecd231fc5d6a323a6d83c6618cbd"/><file name="cite.png" hash="33980d500326461381a8aeb09276d8f4"/><file name="dd.png" hash="3c5f188bf831d0842533b5b347ed1acd"/><file name="div.png" hash="5acf97d2095a72f83029f77bd1dee2a7"/><file name="dl.png" hash="5373ef01a0c1fdfbe518be953b6d6546"/><file name="dt.png" hash="f990c191b6b040108adb41f7217e161b"/><file name="h1.png" hash="b3782df976443f4a0086893d4da991d2"/><file name="h2.png" hash="6e4bfdbfc57415b8c650347bd1704154"/><file name="h3.png" hash="8915729f6e8b98436f9a1a0723bc2d6a"/><file name="h4.png" hash="03bfccf7f8d474142bafeabf86b4732f"/><file name="h5.png" hash="c0f5d3d29f3cf277960182af39f5028a"/><file name="h6.png" hash="f19136291f975688a3784353ac0fc83c"/><file name="icon_cite.png" hash="8e79ff67005c66bcd6b1f14df213073b"/><file name="p.png" hash="afe885e1e018a8aecee52a08e605c565"/><file name="pre.png" hash="7ad78e30f68e5007ed479516f583e10f"/><file name="table.png" hash="dd437067595683daf8604a2da0135ef1"/><file name="td.png" hash="3c521695391fd4362ebfceaa2dbe879e"/><file name="th.png" hash="80d9f15fe860ddfbee8789d1e764ec48"/></dir><dir name="lib"><file name="metaview-plugin.js" hash="52dd9c630cde4b8e9dc8636835da7539"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="37becb02812c958c05a8d1e37bbc48f2"/></dir><file name="de.json" hash="da83f1ee8d94a5d126d71a89ba5ee1a2"/><dir name="en"><file name="i18n.js" hash="fdf9627e82d6185f945f081874c37834"/></dir><file name="en.json" hash="c99f6a248ca7be514520b612b1105347"/><file name="i18n.js" hash="f51b1b72cace2cd80df94e235153ec40"/></dir></dir><dir name="numerated-headers"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="numerated-headers.css" hash="47d8c6f3f407d0af63ee2285ea27fef7"/></dir><dir name="demo"><file name="index.css" hash="32059e4d2a4b889370e39ad7cc4f2a4e"/><file name="index.html" hash="5d1a1345e5c047d5db99b8776529dcb1"/><dir name="js"><file name="aloha-config.js" hash="805eb7f2786ae00e8231bfac3846a2e8"/></dir></dir><dir name="img"><file name="headers.png" hash="7630590f7ea5d00fec556943a2183f5a"/></dir><dir name="lib"><file name="numerated-headers-plugin.js" hash="aa2fe8eec580885ab4c10f6c02385254"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="62d6a5c04f12a2ae2479ca468ad90778"/></dir><dir name="en"><file name="i18n.js" hash="712183db4b838ce7d90478722333f0f1"/></dir><file name="i18n.js" hash="9e9897258fa3ab691cc7ca8f901ed54a"/></dir></dir><dir name="profiler"><dir name="css"><file name="profiler.css" hash="2ca2d9c39d9b15824c41456ca24ba1b1"/></dir><dir name="lib"><file name="profiler-plugin.js" hash="edd509d9a5b67958eb52ef4d7fbbcb65"/></dir></dir><dir name="ribbon"><file name="LICENSE.md" hash="e3ec45ebf5c494127af801d4850a1daf"/><file name="README.md" hash="1637ac1b809dd57be434e79010ef4972"/><dir name="css"><file name="ribbon.css" hash="e9d735353947297e65b75b9d2ef4db2f"/></dir><dir name="lib"><file name="ribbon-plugin.js" hash="9d5f9cfe70ad430591f28c2ee9c2ae29"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="speak"><file name="README" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="css"><file name="speak.css" hash="8d4afbb4c5b726ac0d40adf33e8ba581"/></dir><dir name="img"><file name="speaker.png" hash="9d3c09c35a5ccbc0b363612abed94b5b"/></dir><dir name="lib"><file name="speak-plugin.js" hash="132b6c16592aed735ef288daeb0fdf03"/><file name="speak.js" hash="695dd170d4216eddb77edd2594ef585a"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/></dir><dir name="toc"><dir name="i18n"><file name="de.json" hash="313608ba11e30d2dcdfa205baeb77aec"/><file name="en.json" hash="1c7c7c34adff34cee45f1c073301d529"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/><dir name="src"><file name="toc.js" hash="3278aa8b4e68ba8060d80b9f072b9628"/></dir></dir><dir name="vie"><file name="LICENSE" hash="94d261f8b69f0bc57ece9e7e2c2ef614"/><file name="README.markdown" hash="0337bcb88f08635c37815294d6931d3d"/><dir name="demo"><file name="index.html" hash="b4bdc507a87514358bea9c7c29fd8d4a"/></dir><dir name="img"><file name="cms-decoupled-communications.png" hash="e3c73d2d62a171d1561b40f0e7edc762"/></dir><file name="package.json" hash="c443b04d0fc26b0a5a4573a78e0082a1"/><dir name="src"><file name="backbone-min.js" hash="5d7dc1cbe7f0b177cf66187937001fb9"/><file name="underscore-min.js" hash="178201c529411d163a6801134d2d45fc"/><file name="vie-aloha.js" hash="35e4377798770a44035c1c370bbda464"/><file name="vie-collectionmanager.js" hash="bff7ab42ade6f9ecafad553505224a3d"/><file name="vie-containermanager.js" hash="7ae8c63fffd549125d4d2859bab6d531"/><file name="vie.js" hash="f5e19b32939e655d6959a6743ddd12f4"/></dir></dir><dir name="wai-lang"><file name="README.md" hash="c40bb8969ac220ccde8fd6d06db4858c"/><dir name="css"><file name="wai-lang.css" hash="f16081c94638324b35488ee0791925c2"/></dir><dir name="img"><file name="button.png" hash="f41f65165ae81e7313633719a9c970ba"/><file name="remove-button.png" hash="a090a788e86b2569db2d934ddf31517f"/></dir><dir name="lib"><file name="language-codes.json" hash="239b1391054204eae80aab04f1a50c45"/><file name="languages.js" hash="20a6879ef651bff364ad01f6e208e632"/><file name="wai-lang-plugin.js" hash="ce68feae1848a874c85bd8a520654281"/></dir><dir name="nls"><dir name="de"><file name="i18n.js" hash="e463f7950e2bf46a9c9c3455f1decc7d"/></dir><dir name="en"><file name="i18n.js" hash="3edf3f2a6de610fe791af94c1b001988"/></dir><file name="i18n.js" hash="990aa79711d83c3338abd0cb99b0982c"/></dir></dir><dir name="zemanta"><file name="README" hash="4bbea2da0a10dd744ed92d23ea9ab24d"/><dir name="css"><file name="zemanta-widget-alohaeditor.css" hash="3fb224fa4502670cb6819a36532b2fa2"/></dir><dir name="img"><file name="zemanta-mini-logo.png" hash="4ba9ab70cfe3c186e0fcdd79e98f2966"/></dir><dir name="lib"><file name="zemanta-plugin.js" hash="6ac75056a22ebcce6d01d1b0f27af823"/></dir><dir name="nls"><file name="i18n.js" hash="0e12820f2627a1d13ea99eae1516bf0e"/></dir></dir></dir></dir></dir><file name="counter.js" hash="608fa7304556810b940c9fdd1ecfa0d9"/><dir name="css"><file name="default.css" hash="43462f50f1b805e3b90768ee235fadf8"/><file name="dropdown.css" hash="4f78db1ab85c81e691b473a6569a743f"/><file name="dropdownx.css" hash="d82e0e673faadd689f28e1247b73806c"/><file name="fonts.css" hash="00b04c27359b281fb52ddee901de12ea"/><file name="login.css" hash="7dd72559eb6dc10f18a697fd46eb9b55"/><file name="styles.css" hash="0f3912a41697368d213df0f573258eb7"/></dir><file name="dropdown.js" hash="75fdd98424a67d977915b48e9b596e51"/><file name="dropdownx.js" hash="ace4d0441d7d622e3cf72589f8c9b7e1"/><file name="editor.htm" hash="2821bdfc04c716841e71f0a08933a832"/><file name="editor.htm.old" hash="b2b877e04666b89199603a27a215727e"/><file name="jquery-ui-1.8.15.custom.min.js" hash="9df7a1a861cc61f4b8c1ac1c390c37fa"/><file name="jquery.js" hash="d1477ad1c080ff5ef8f090d0df2314db"/><file name="jquery.layout.js" hash="f6523f9daae58dbd3397b139550f5553"/><file name="jquery.sparkline.min.js" hash="cc8ec320305350400fbdc8e55fefd8c5"/><file name="messagebox.js" hash="b4773c926a71bcadc7e8fff8b20de49e"/><dir name="raphael"><file name="g.pie.js" hash="f249e49cd2ba852dfa517bef5ef55434"/><file name="g.raphael.js" hash="bae4fc73e97b4b979d8619e1601fe9c4"/><file name="gauge.js" hash="dcaacf3e59fb0fe2f32ccb211d61198e"/><file name="linear.js" hash="12883bea5f0067dbe6c8fdb370c6544d"/><file name="pie.js" hash="da74f7469d37116695c4a9ef47eb345d"/><file name="popup.js" hash="30d0c7ae59e65875785f66979a689b99"/><file name="raphael.js" hash="bb02bf5b8b4d9c0dbf95fa725c75c755"/></dir><file name="world.js" hash="fc8e780b55cd90e25744918e2a817e99"/></dir></dir></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Comfirm_AlphaMail</name>
|
4 |
+
<version>1.5.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Transactional email module for integration with AlphaMail.</summary>
|
10 |
+
<description>The AlphaMail extension is a transactional email extension that makes it easier to manage, send and get reports on the transactional emails in Magento.</description>
|
11 |
+
<notes>- Removed template and project management.
|
12 |
+
+ Added single sign on support.
|
13 |
+
+ Added ability to sign up/sign in and connect the account.
|
14 |
+
* Remade project mapping
|
15 |
+
+ Improved event/send log.</notes>
|
16 |
+
<authors><author><name>comfirm</name><user>comfirm</user><email>robin.orheden@amail.io</email></author></authors>
|
17 |
+
<date>2013-02-21</date>
|
18 |
+
<time>17:05:03</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Comfirm"><dir name="AlphaMail"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="eaec18520548469707ebfa084500b54a"/><dir name="System"><dir name="Config"><file name="Wrapper.php" hash="c415b3e97e07cece6fa340bc5f929e06"/></dir></dir><dir name="Test"><file name="Authentication.php" hash="7686ab33c59f030b27b79e1276cac5b8"/><file name="Diagnostic.php" hash="3e375f1cbda77c55c296c40c4881345b"/><file name="Send.php" hash="f11c197f6c4b856161e016817c7e3b51"/></dir></dir><file name="Connect.php" hash="fea51cae61ecc1ca6b75fc8debc9227c"/><dir name="EventLog"><file name="Grid.php" hash="da1091bc5a364705377eefca546a6fa4"/><file name="View.php" hash="757aeed648f73af9a298db3017233413"/></dir><file name="EventLog.php" hash="49c29cbb6ebeb0b570f12e1cfbb4fa4e"/><file name="ProjectMapping.php" hash="4c28a21c88b2023ea5540c6f67aa23cd"/><dir name="SendLog"><file name="Grid.php" hash="41a99ef22551ebc240305727598b0905"/><file name="View.php" hash="849e622d3a665396a26dfe9ebc710610"/></dir><file name="SendLog.php" hash="f5bec3abe1520bd08fdec7f392cb775d"/><file name="SingleSignOn.php" hash="a08b174c4c2f5d9b1fa047d2bd739bae"/></dir><dir name="Controller"><file name="Abstract.php" hash="d4dfd8fb0addd5dd170f87c0108ae2c7"/></dir><dir name="Helper"><file name="Connection.php" hash="69c8e3bed181d1ce74817006225bdb3b"/><file name="Data.php" hash="cef1cde75e104483ae933a3292fe2444"/><file name="Diagnostic.php" hash="eb298663980805eae8afb854bf372823"/><file name="Message.php" hash="de8e6045441eff7f5098997b2156b076"/></dir><dir name="Message"><dir name="Customer"><dir name="Email"><file name="Confirmation.php" hash="dccbf4512ecf82b6c7d480845b293cfb"/></dir><dir name="Password"><file name="Renewal.php" hash="032b8969aed2ad37d1b94ef22e27c252"/></dir><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Update.php" hash="e9815267f403dec845c3d313a33d7eae"/></dir><file name="Invoice.php" hash="c452bd6b15666708cf6ec85e9a33f7e5"/><file name="Update.php" hash="be9a17636f526ff45fed3a3ddd02aa58"/></dir><file name="Order.php" hash="9ad01367fcdf10677eeb234b28c26e09"/></dir><file name="Welcome.php" hash="f712e596b45b679e65519615f85cea70"/></dir></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="1b5cf584e1874db9f281ebbf196c906b"/></dir><dir name="Event"><file name="Log.php" hash="8403425f64d04f2bb1439e6a3834b59f"/></dir><dir name="Mysql4"><dir name="Event"><dir name="Log"><file name="Collection.php" hash="46e23089ef49b668fb97ff43da6b48c9"/></dir><file name="Log.php" hash="fd0200706ad7966bbd5fdf9353e45f23"/></dir><dir name="Project"><dir name="Map"><file name="Collection.php" hash="803ab517739a8f08d5957703f8ba9a48"/></dir><file name="Map.php" hash="34b973bf31a675a38967f7958cf2605e"/></dir><dir name="Send"><dir name="Log"><file name="Collection.php" hash="56fc46a4771f5aee35ff65873638a501"/></dir><file name="Log.php" hash="464c694d0daf7cb8577ab2f8937394d4"/></dir><file name="Setup.php" hash="aada6ed95c86cfd9f370113da07bc5d2"/></dir><dir name="Project"><file name="Map.php" hash="1f5a87e55237c6670eecc772379e166c"/></dir><dir name="Send"><file name="Log.php" hash="0d1c8e64ac8ff890bb9e1922e7251993"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="General"><file name="EnabledDisabled.php" hash="9ffec22ca17202547c9433145f25a05b"/><file name="Fallback.php" hash="f291cc7a363a88611f3c5c747ac502fa"/><file name="NumberOfRetries.php" hash="a89384039313ce9b803f3db8c307250e"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="ConnectController.php" hash="14824fd663c7c2b0bf6bec096f75ff2e"/><file name="EventLogController.php" hash="d1258619ca3cb38aa7e6cf17aa97784b"/><file name="ProjectMappingController.php" hash="54991e1d1e912051986acdbf04afb200"/><file name="SendLogController.php" hash="b112c68d6145b868313f44883efebd24"/><file name="SingleSignOnController.php" hash="3f6d28d6e29c0af3de83f61a0153fbfd"/><file name="TestController.php" hash="f4adc512f507137962c0f9bf7b9d0ede"/></dir><dir name="data"><dir name="integration_defaults"><file name="email_confirmation.htm" hash="0af80701addd67f08b7a65eed53b4853"/><file name="email_confirmation.txt" hash="1fd7862262ee58a52d4a8a30bf61dd9d"/><file name="new_order_confirmation.htm" hash="a8cf51d585b363d8d553bb8ce0ff5f64"/><file name="new_order_confirmation.txt" hash="4b56b0d2c85f5643818d79f423ac5488"/><file name="order_update.htm" hash="4e157ce58a5bccaa26ba36e842806233"/><file name="order_update.txt" hash="7de48e9852b6289df406576a0ccc9653"/><file name="reset_password.htm" hash="ed0211256b7440fbbca8b7d16376d49d"/><file name="reset_password.txt" hash="6773028cea907880444a8787f2afd832"/><file name="welcome.htm" hash="6ccad54654ca9ca8912b3df87cdf25df"/><file name="welcome.txt" hash="e3646d12b18c1d23d6f2ce12cc125c04"/></dir><dir name="queue"><file name="4981757f-c28d-7eab-8077-11f1b435a8af.msg" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="templates"><dir name="confirm-email"><file name="data.json" hash="b2c1f23a74a5d45048a79810ac34d793"/><file name="template.htm" hash="679b6fe1cfa539a96f11deab2793ce58"/><file name="template.txt" hash="45bc1a150cc8127d9817616269063ecf"/></dir><dir name="order-confirmation"><file name="data.json" hash="5afc62bdddd2288eb696a4bda47f7142"/><file name="template.htm" hash="d414ea4bbb02b097b5e6bbfb05dcdb75"/><file name="template.txt" hash="b36ce7f5e1e84430624182d355691930"/></dir><dir name="order-update"><file name="data.json" hash="c5b7dab7c2fe07b5e5b5002cd16d33bc"/><file name="template.htm" hash="7def6b5399a64d702a3771c33ee6e115"/><file name="template.txt" hash="19ad7bd063edb90531c894232e0ad89f"/></dir><dir name="reset-password"><file name="data.json" hash="b4fd944f24cdbacd14a2649d05c279a5"/><file name="template.htm" hash="3c12431c254fc09285394abdd8345c8b"/><file name="template.txt" hash="ab364988a3671130725ffd82a4df8499"/></dir><dir name="welcome"><file name="data.json" hash="f022638f409c6e2bcb5968dd8e4d2ad0"/><file name="template.htm" hash="34aac6cf1d039842b2f6c5fcda7cd1ea"/><file name="template.txt" hash="6083f8b255b619c73b71576110d5295b"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="301233a83ca35d6e814e02f3e728ef94"/><file name="system.xml" hash="dab3871a5e35ed6a4d0014a71211cd7a"/></dir><dir name="libraries"><dir name="comfirm.alphamail.client"><file name="accountservice.class.php" hash="915af5027b206f3bc73d34cd1c20d4a9"/><file name="accountservice.interface.php" hash="4f86f32bc47ad7ef0e07e8d886519c83"/><file name="captchaservice.class.php" hash="409a5b97dd47a0c07f35e0c1146f7967"/><file name="captchaservice.interface.php" hash="48bd3a0c953099d0e33f7429a209cc20"/><file name="emailservice.class.php" hash="1376bfe3d519e4882fed14d8e7884194"/><file name="emailservice.interface.php" hash="a89a39c6b1ad0385dbade68c59a95d7f"/><dir name="entities"><file name="account.class.php" hash="2ef0ce88d66f1216c196baab563f2959"/><file name="captcha.class.php" hash="4f9133fffa745421086944de92a80eb1"/><file name="emailcontact.class.php" hash="912f82fac1e6dad67dd9fe120d74f527"/><file name="emailmessagepayload.class.php" hash="32f9ad93d54ca65fb3b0408de29f9694"/><file name="idempotentemailmessagepayload.class.php" hash="ee1944cf5a2a637483bc5902e53dce41"/><file name="integration.class.php" hash="3af352b91ab0e6410555678c570b4c08"/><file name="project.class.php" hash="056cc2d219fd9e007f9d34388ec86122"/><file name="serviceresponse.class.php" hash="10cbc9761e304c877b0c28cd18fc0c8c"/><file name="signature.class.php" hash="951dc5667a0e492640b26aae33a61765"/><file name="template.class.php" hash="13cc09cb93fe9abc0c0c37a765c5f895"/><file name="token.class.php" hash="c73ce6ee4b9e0be1b8bf58b52643d6a0"/><file name="userticket.class.php" hash="ad2b87e6830d64a0fde60d3b7edaafbc"/></dir><dir name="exceptions"><file name="alphamailauthorizationexception.class.php" hash="f023fee677c1e3b39b56023d6ec37bfa"/><file name="alphamailinternalexception.class.php" hash="f904c1ca0b6f7fb67226863355f527ee"/><file name="alphamailserviceexception.class.php" hash="504a6296576fed58d195fb6628e52b6a"/><file name="alphamailvalidationexception.class.php" hash="ca0274cf5ef8b1dabe2a44fab1c9f5e7"/></dir><file name="integrationservice.class.php" hash="c3d70049e69e7133d1dfdf67d77a3b30"/><file name="integrationservice.interface.php" hash="7dc480f988eebb500f324be4a8102042"/><file name="projectservice.class.php" hash="f47d84c22ec50bcae9518674edead89f"/><file name="projectservice.interface.php" hash="4a54c7cfbf959d01b6946216a8613366"/><file name="signatureservice.class.php" hash="20c7d060b5f3808f978168fc93feaec4"/><file name="signatureservice.interface.php" hash="9a9b90a695aead0844b50df6f0823f8f"/><file name="templateservice.class.php" hash="7d85d6e6f9e8c634f5dcd51510818ada"/><file name="templateservice.interface.php" hash="245ad486b7d8568e0016db036575c1ea"/><file name="tokenservice.class.php" hash="fa6b3d9009a71a8a3c36a11bfd9a9b72"/><file name="tokenservice.interface.php" hash="bf4cb7d022c3ab2539fd027e7f599b4e"/><file name="userticketservice.class.php" hash="9dfe7c29e9620ee6287bdcf2be6b87f6"/></dir><dir name="comfirm.services.client.rest"><dir name="httprequest"><dir name="filters"><file name="basicauthenticationfilterchainitem.class.php" hash="c5c8fdeae1ac8b04cc4d58e322c2f126"/><file name="httpchunkfilterchainitem.class.php" hash="69ff142a4c492956f341a16121be8327"/><file name="httpgzipfilterchainitem.class.php" hash="83df3eef9cb52298f0df1ad49a5ce9cb"/><file name="jsondeserializerchainitem.class.php" hash="a84baba1208ab0fec635a176490539b0"/></dir><file name="httpfilter.class.php" hash="d5e7dcd6771185e092ee08ce38933c57"/><file name="httpheadercollection.class.php" hash="3f1040d7f4ce7911695615dc1bab256a"/><file name="httppacketcompiler.class.php" hash="931ea0ee1b5e2ca207ed470b7bc2de29"/><file name="httppacketparser.class.php" hash="6d0e70960a462551ae008e7b5b5e4f5c"/><file name="httprequest.class.php" hash="98d6fa9909046f0b58f69ba9e1680a61"/><file name="httpsocket.class.php" hash="7d4f62d933507f8a940b415d4d63d57b"/><file name="httptypes.class.php" hash="47e6c7485835c530d94df9195d080739"/></dir><file name="restful.class.php" hash="e22d47632131e9dd3fc33d8c1ad14ce3"/></dir><file name="license.txt" hash="ea21b75a1e26825c31ae29f29a870a34"/></dir><dir name="sql"><dir name="alphamail_setup"><file name="mysql4-install-1.5.0.php" hash="8bae2124b862b235db9155d16ccd6e94"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="alphamail"><dir name="connect"><file name="completed.phtml" hash="aaa54932787c39495413c6ad675a1881"/><file name="login.phtml" hash="6b922150d646680ee8636f61beb2e5d5"/><file name="registration.phtml" hash="641d6c644878576c01b42e9cc4e2bcb2"/></dir><dir name="logging"><file name="event_view.phtml" hash="5e960e8a8477436c71638e50f725b724"/><file name="send_view.phtml" hash="570f75397afd2598b9b792bd1f3bc524"/></dir><dir name="projectmapping"><file name="index.phtml" hash="497f72fcf7abc8df4ae4a0cd80836993"/></dir><dir name="singlesignon"><file name="index.phtml" hash="096d2d23d4cac87961efe7ccd6ed1eac"/></dir><dir name="system"><file name="config.phtml" hash="27364c24a9a5c37e8d78654dfb1e6ab6"/></dir></dir></dir><dir name="layout"><file name="alphamail.xml" hash="f60d0e401c37c475c7a38e7b595cc419"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Comfirm_AlphaMail.xml" hash="41e608f730e29ee308a440eef9e4a6d7"/></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (C) 2011 by Marijn Haverbeke <marijnh@gmail.com>
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/README.md
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
# CodeMirror 2
|
2 |
-
|
3 |
-
CodeMirror 2 is a rewrite of [CodeMirror
|
4 |
-
1](http://github.com/marijnh/CodeMirror). The docs live
|
5 |
-
[here](http://codemirror.net/manual.html), and the project page is
|
6 |
-
[http://codemirror.net/](http://codemirror.net/).
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/compress.html
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror: Compression Helper</title>
|
5 |
-
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
|
6 |
-
<link rel="stylesheet" type="text/css" href="css/docs.css"/>
|
7 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
8 |
-
</head>
|
9 |
-
<body>
|
10 |
-
|
11 |
-
<h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
|
12 |
-
|
13 |
-
<pre class="grey">
|
14 |
-
<img src="css/baboon.png" class="logo" alt="logo"/>/* Script compression
|
15 |
-
helper */
|
16 |
-
</pre>
|
17 |
-
|
18 |
-
<p>To optimize loading CodeMirror, especially when including a
|
19 |
-
bunch of different modes, it is recommended that you combine and
|
20 |
-
minify (and preferably also gzip) the scripts. This page makes
|
21 |
-
those first two steps very easy. Simply select the version and
|
22 |
-
scripts you need in the form below, and
|
23 |
-
click <strong>Compress</strong> to download the minified script
|
24 |
-
file.</p>
|
25 |
-
|
26 |
-
<form id="form" action="http://marijnhaverbeke.nl/uglifyjs" method="post">
|
27 |
-
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
|
28 |
-
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px">
|
29 |
-
<option value="http://codemirror.net/">HEAD</option>
|
30 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.18;f=">2.18</option>
|
31 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.16;f=">2.16</option>
|
32 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.15;f=">2.15</option>
|
33 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.13;f=">2.13</option>
|
34 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.12;f=">2.12</option>
|
35 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.11;f=">2.11</option>
|
36 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.1;f=">2.1</option>
|
37 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.02;f=">2.02</option>
|
38 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.01;f=">2.01</option>
|
39 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.0;f=">2.0</option>
|
40 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta2;f=">beta2</option>
|
41 |
-
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta1;f=">beta1</option>
|
42 |
-
</select></p>
|
43 |
-
|
44 |
-
<select multiple="multiple" name="code_url" style="width: 40em;" class="field" id="files">
|
45 |
-
<optgroup label="CodeMirror Library">
|
46 |
-
<option value="http://codemirror.net/lib/codemirror.js" selected>codemirror.js</option>
|
47 |
-
<option value="http://codemirror.net/lib/util/overlay.js">overlay.js</option>
|
48 |
-
<option value="http://codemirror.net/lib/util/runmode.js">runmode.js</option>
|
49 |
-
<option value="http://codemirror.net/lib/util/simple-hint.js">simple-hint.js</option>
|
50 |
-
<option value="http://codemirror.net/lib/util/javascript-hint.js">javascript-hint.js</option>
|
51 |
-
<option value="http://codemirror.net/lib/util/codefold.js">codefold.js</option>
|
52 |
-
</optgroup>
|
53 |
-
<optgroup label="Modes">
|
54 |
-
<option value="http://codemirror.net/mode/clike/clike.js">clike.js</option>
|
55 |
-
<option value="http://codemirror.net/mode/clojure/clojure.js">clojure.js</option>
|
56 |
-
<option value="http://codemirror.net/mode/coffeescript/coffeescript.js">coffeescript.js</option>
|
57 |
-
<option value="http://codemirror.net/mode/css/css.js">css.js</option>
|
58 |
-
<option value="http://codemirror.net/mode/diff/diff.js">diff.js</option>
|
59 |
-
<option value="http://codemirror.net/mode/gfm/gfm.js">gfm.js</option>
|
60 |
-
<option value="http://codemirror.net/mode/groovy/groovy.js">groovy.js</option>
|
61 |
-
<option value="http://codemirror.net/mode/haskell/haskell.js">haskell.js</option>
|
62 |
-
<option value="http://codemirror.net/mode/htmlmixed/htmlmixed.js">htmlmixed.js</option>
|
63 |
-
<option value="http://codemirror.net/mode/javascript/javascript.js">javascript.js</option>
|
64 |
-
<option value="http://codemirror.net/mode/jinja2/jinja2.js">jinja2.js</option>
|
65 |
-
<option value="http://codemirror.net/mode/lua/lua.js">lua.js</option>
|
66 |
-
<option value="http://codemirror.net/mode/markdown/markdown.js">markdown.js</option>
|
67 |
-
<option value="http://codemirror.net/mode/ntriples/ntriples.js">ntriples.js</option>
|
68 |
-
<option value="http://codemirror.net/mode/pascal/pascal.js">pascal.js</option>
|
69 |
-
<option value="http://codemirror.net/mode/perl/perl.js">perl.js</option>
|
70 |
-
<option value="http://codemirror.net/mode/php/php.js">php.js</option>
|
71 |
-
<option value="http://codemirror.net/mode/plsql/plsql.js">plsql.js</option>
|
72 |
-
<option value="http://codemirror.net/mode/python/python.js">python.js</option>
|
73 |
-
<option value="http://codemirror.net/mode/r/r.js">r.js</option>
|
74 |
-
<option value="http://codemirror.net/mode/rpm/changes/changes.js">rpm/changes.js</option>
|
75 |
-
<option value="http://codemirror.net/mode/rpm/spec/spec.js">rpm/spec.js</option>
|
76 |
-
<option value="http://codemirror.net/mode/rst/rst.js">rst.js</option>
|
77 |
-
<option value="http://codemirror.net/mode/ruby/ruby.js">ruby.js</option>
|
78 |
-
<option value="http://codemirror.net/mode/rust/rust.js">rust.js</option>
|
79 |
-
<option value="http://codemirror.net/mode/scheme/scheme.js">scheme.js</option>
|
80 |
-
<option value="http://codemirror.net/mode/smalltalk/smalltalk.js">smalltalk.js</option>
|
81 |
-
<option value="http://codemirror.net/mode/sparql/sparql.js">sparql.js</option>
|
82 |
-
<option value="http://codemirror.net/mode/stex/stex.js">stex.js</option>
|
83 |
-
<option value="http://codemirror.net/mode/tiddlywiki/tiddlywiki.js">tiddlywiki.js</option>
|
84 |
-
<option value="http://codemirror.net/mode/velocity/velocity.js">velocity.js</option>
|
85 |
-
<option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
|
86 |
-
<option value="http://codemirror.net/mode/yaml/yaml.js">yaml.js</option>
|
87 |
-
</optgroup>
|
88 |
-
</select></p>
|
89 |
-
|
90 |
-
<p>
|
91 |
-
<button type="submit">Compress</button> with <a href="http://github.com/mishoo/UglifyJS/">UglifyJS</a>
|
92 |
-
</p>
|
93 |
-
|
94 |
-
<p>Custom code to add to the compressed file:<textarea name="js_code" style="width: 100%; height: 15em;" class="field"></textarea></p>
|
95 |
-
</form>
|
96 |
-
|
97 |
-
<script type="text/javascript">
|
98 |
-
function setVersion(ver) {
|
99 |
-
var urlprefix = ver.options[ver.selectedIndex].value;
|
100 |
-
var select = document.getElementById("files"), m;
|
101 |
-
for (var optgr = select.firstChild; optgr; optgr = optgr.nextSibling)
|
102 |
-
for (var opt = optgr.firstChild; opt; opt = opt.nextSibling) {
|
103 |
-
if (opt.nodeName != "OPTION")
|
104 |
-
continue;
|
105 |
-
else if (m = opt.value.match(/^http:\/\/codemirror.net\/2\/(.*)$/))
|
106 |
-
opt.value = urlprefix + m[1];
|
107 |
-
else if (m = opt.value.match(/http:\/\/marijnhaverbeke.nl\/git\/codemirror\?a=blob_plain;hb=[^;]+;f=(.*)$/))
|
108 |
-
opt.value = urlprefix + m[1];
|
109 |
-
}
|
110 |
-
}
|
111 |
-
</script>
|
112 |
-
|
113 |
-
</body>
|
114 |
-
</html>
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/css/baboon.png
DELETED
Binary file
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/css/baboon_vector.svg
DELETED
@@ -1,153 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
-
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3 |
-
|
4 |
-
<svg
|
5 |
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6 |
-
xmlns:cc="http://creativecommons.org/ns#"
|
7 |
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
8 |
-
xmlns:svg="http://www.w3.org/2000/svg"
|
9 |
-
xmlns="http://www.w3.org/2000/svg"
|
10 |
-
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
11 |
-
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12 |
-
id="svg3181"
|
13 |
-
version="1.1"
|
14 |
-
inkscape:version="0.48.0 r9654"
|
15 |
-
width="1750"
|
16 |
-
height="960"
|
17 |
-
xml:space="preserve"
|
18 |
-
sodipodi:docname="baboon_vector.svg"><metadata
|
19 |
-
id="metadata3187"><rdf:RDF><cc:Work
|
20 |
-
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
21 |
-
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
22 |
-
id="defs3185"><clipPath
|
23 |
-
clipPathUnits="userSpaceOnUse"
|
24 |
-
id="clipPath3195"><path
|
25 |
-
d="M 0,768 1400,768 1400,0 0,0 0,768 z"
|
26 |
-
id="path3197" /></clipPath><clipPath
|
27 |
-
clipPathUnits="userSpaceOnUse"
|
28 |
-
id="clipPath3215"><path
|
29 |
-
d="M 0,768 1400,768 1400,0 0,0 0,768 z"
|
30 |
-
id="path3217" /></clipPath></defs><sodipodi:namedview
|
31 |
-
pagecolor="#ffffff"
|
32 |
-
bordercolor="#666666"
|
33 |
-
borderopacity="1"
|
34 |
-
objecttolerance="10"
|
35 |
-
gridtolerance="10"
|
36 |
-
guidetolerance="10"
|
37 |
-
inkscape:pageopacity="0"
|
38 |
-
inkscape:pageshadow="2"
|
39 |
-
inkscape:window-width="1440"
|
40 |
-
inkscape:window-height="851"
|
41 |
-
id="namedview3183"
|
42 |
-
showgrid="false"
|
43 |
-
inkscape:zoom="0.20550291"
|
44 |
-
inkscape:cx="1534.1667"
|
45 |
-
inkscape:cy="795.78156"
|
46 |
-
inkscape:window-x="0"
|
47 |
-
inkscape:window-y="0"
|
48 |
-
inkscape:window-maximized="1"
|
49 |
-
inkscape:current-layer="g3189" /><g
|
50 |
-
id="g3189"
|
51 |
-
inkscape:groupmode="layer"
|
52 |
-
inkscape:label="baboon_vector"
|
53 |
-
transform="matrix(1.25,0,0,-1.25,0,960)"><g
|
54 |
-
id="g3191"><g
|
55 |
-
id="g3193"
|
56 |
-
clip-path="url(#clipPath3195)"><g
|
57 |
-
id="g3199"
|
58 |
-
transform="translate(458.9561,569.9678)"><path
|
59 |
-
d="m 0,0 59.835,69.355 87.034,26.518 133.949,-7.479 c 0,0 74.116,-32.639 74.795,-34.678 0.68,-2.04 84.314,-59.155 84.314,-59.155 l 12.238,-74.795 5.439,-97.912 -13.598,-25.159 -4.76,-40.797 -18.358,-23.118 24.39,-5.561 0.501,-5.192 -14.012,-60.641 16.477,-93.368 7.223,-49.972 -208.295,-51.754 -18.552,4.005 -37.468,8.325 -10.036,4.036 -66.885,10.101 c 0,0 -14.959,74.793 -16.999,73.433 -2.039,-1.359 -42.836,56.437 -42.836,56.437 l -19.719,65.274 12.48,74.571 -7.961,9.643 -26.479,16.187 -12.716,38.309 4.08,48.277 8.769,38.985 L 6.608,-74.308 0,0 z"
|
60 |
-
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
61 |
-
id="path3201" /></g><g
|
62 |
-
id="g3203"
|
63 |
-
transform="translate(78.8657,682.1582)"><path
|
64 |
-
d="M 0,0 142.789,40.797 259.74,52.355 313.457,-232.543 204.665,-291.698 78.194,-293.738 0,0 z"
|
65 |
-
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
66 |
-
id="path3205" /></g><g
|
67 |
-
id="g3207"
|
68 |
-
transform="translate(269.5122,345.2344)"><path
|
69 |
-
d="M 0,0 18.801,-74.425 40.728,-85.408 59.539,-59.541 40.259,13.503 36.821,15.669 0,0 z"
|
70 |
-
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
71 |
-
id="path3209" /></g></g></g><g
|
72 |
-
id="g3223"
|
73 |
-
transform="translate(741.918,109.0332)"><path
|
74 |
-
d="m 0,0 -17.236,-9.401 -16.452,-22.721 -0.783,12.537 6.268,17.234 13.317,6.268 L 0,7.833 14.884,3.917 0,0 z m 172.622,-21.824 c -0.031,0.271 -0.081,0.535 -0.117,0.804 -20.85,7.653 -49.59,7.327 -66.874,10.927 -13.849,2.886 -23.047,9.119 -27.032,12.298 -9.863,-8.494 -12.025,-14.377 -12.025,-14.377 0,0 -9.816,15.309 -30.17,25.76 -7.05,3.621 -17.767,5.691 -29.341,5.691 -24.297,0 -52.384,-9.155 -58.339,-32.223 -10.458,-40.511 9.697,-76.594 49.814,-77.623 1.325,-0.034 2.623,-0.12 3.894,-0.12 36.131,0 48.855,8.572 58.323,15.478 0.027,0.021 0.104,0 0.104,0 0,0 25.126,-11.506 53.529,-11.506 4.419,0 9.156,0.415 14.249,1.063 31.641,4.018 47.989,28.124 43.985,63.828"
|
75 |
-
style="fill:#df0019;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
76 |
-
id="path3225"
|
77 |
-
inkscape:connector-curvature="0" /></g><g
|
78 |
-
id="g3227"
|
79 |
-
transform="translate(300.8481,270.0254)"><path
|
80 |
-
d="m 0,0 c -3.063,-0.691 -12.535,0.784 -12.535,0.784 l 6.267,-25.853 43.481,13.319 -9.01,27.418 C 28.203,15.668 7.867,1.777 0,0"
|
81 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
82 |
-
id="path3229"
|
83 |
-
inkscape:connector-curvature="0" /></g><g
|
84 |
-
id="g3231"
|
85 |
-
transform="translate(211.66052,615.85984)"><path
|
86 |
-
d="m 0,0 -16.243,-2.871 -15.462,-9.4 4.323,-10.938 14.568,9.89 L 2.75,-8.771 0,0 z"
|
87 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
88 |
-
id="path3233"
|
89 |
-
inkscape:connector-curvature="0" /></g><g
|
90 |
-
id="g3235"
|
91 |
-
transform="translate(274.15732,626.4084)"><path
|
92 |
-
d="m 0,0 -15.64,0.407 -14.279,-3.608 2.008,-9.747 14.756,4.208 L 1.111,-8.215 0,0 z"
|
93 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
94 |
-
id="path3237"
|
95 |
-
inkscape:connector-curvature="0" /></g><path
|
96 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
97 |
-
d="M 436.65625 22.28125 C 436.65625 22.28125 338.18375 25.385 251 42.8125 C 163.24875 60.35375 70.40625 99.65625 70.40625 99.65625 L 175.1875 495.28125 L 327.96875 492.34375 L 337.75 527.59375 C 337.75 527.59375 365.095 523.25875 373 518.78125 C 376.31375 516.90375 383.78125 508 383.78125 508 L 377.75 484.65625 L 504.21875 407.15625 L 436.65625 22.28125 z M 410.53125 55.1875 L 465.6875 393.3125 L 346.59375 456.625 L 202.75 466.46875 L 112 114.40625 L 263 79.1875 L 410.53125 55.1875 z "
|
98 |
-
transform="matrix(0.8,0,0,-0.8,0,768)"
|
99 |
-
id="path3253" /><g
|
100 |
-
id="g3247"
|
101 |
-
transform="matrix(1.199238,-0.02879331,0.02673084,1.0520756,172.41935,498.37339)"><path
|
102 |
-
d="m 0,0 c 0,0 -1.861,1.481 -9.143,-1.457 9.712,18.867 9.439,39.989 9.439,39.989 0,0 -3.106,-2.465 -11.311,-8.47 9.241,23.044 5.338,72.525 5.338,72.525 0,0 -17.493,40.746 -13.657,45.799 8.841,11.65 23.834,23.968 44.295,25.594 17.935,1.424 44.606,-4.953 55.865,-15.284 4.536,-4.161 23.367,-47.493 23.367,-47.493 0,0 6.104,-35.271 11.619,-54.108 5.513,-18.839 11.054,-26.674 21.284,-34.825 17.831,-14.207 27.076,-29.938 27.076,-29.938 L 143.399,3.945 c 3.655,-17.356 14.875,-34.28 27.39,-47.672 -12.863,1.507 -19.61,8.783 -19.61,8.783 0,0 2.151,-12.664 9.109,-26.554 l 28.712,15.264 -1.762,10.805 c -5.128,9.304 -9.336,15.534 -9.336,15.534 0,0 2.089,0.956 7.385,-3.572 l -2.005,12.296 c -4.814,9.391 -11.773,16.752 -25.115,31.113 5.944,-6.087 15.438,-5.379 20.751,-4.356 l -0.572,3.512 c -2.231,1.278 -5.494,3.171 -10.241,5.957 -12.43,7.299 -22.326,21.049 -22.326,21.049 0,0 12.85,1.815 20.513,11.022 -7.316,-2.641 -18.585,0.799 -18.585,0.799 -17.086,6.772 -15.022,30.217 -17.687,50.587 -2.667,20.37 -9.299,34.125 -9.299,34.125 0,0 -0.243,2.149 11.91,-5.906 -7.744,33.215 -35.545,44.94 -35.545,44.94 0,0 2.223,2.79 22.843,0.044 -16.469,15.817 -32.303,16.896 -32.303,16.896 0,0 10.077,2.25 23.611,0.24 0,0 -3.327,3.508 -7.549,6.453 L 35.985,194.291 -77.543,167.815 -8.211,-101.17 17.481,-99.413 C 8.602,-85.114 -0.371,-63.837 -2.15,-40.857 -4.911,-5.208 0,0 0,0"
|
103 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
104 |
-
id="path3249"
|
105 |
-
inkscape:connector-curvature="0" /></g><g
|
106 |
-
id="g3255"
|
107 |
-
transform="translate(204.22134,580.88353)"><path
|
108 |
-
d="m 0,0 c 0,-1.418 0.43,-2.736 1.168,-3.83 1.523,0.677 3.551,1.094 5.786,1.094 2.164,0 4.133,-0.39 5.639,-1.029 0.711,1.081 1.129,2.374 1.129,3.765 0,3.79 -3.072,6.861 -6.861,6.861 C 3.071,6.861 0,3.79 0,0"
|
109 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
110 |
-
id="path3257"
|
111 |
-
inkscape:connector-curvature="0" /></g><g
|
112 |
-
id="g3259"
|
113 |
-
transform="translate(256.3311,595.31646)"><path
|
114 |
-
d="m 0,0 c 0,-1.418 0.43,-2.736 1.168,-3.83 1.524,0.677 3.552,1.094 5.787,1.094 2.163,0 4.132,-0.39 5.638,-1.029 0.712,1.081 1.129,2.373 1.129,3.765 0,3.79 -3.072,6.861 -6.861,6.861 C 3.071,6.861 0,3.79 0,0"
|
115 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
116 |
-
id="path3261"
|
117 |
-
inkscape:connector-curvature="0" /></g><g
|
118 |
-
id="g4174"
|
119 |
-
transform="matrix(0.99694509,0.07810563,-0.07810563,0.99694509,47.348748,-15.348299)"><g
|
120 |
-
transform="translate(222.5098,610.1558)"
|
121 |
-
id="g3219"><path
|
122 |
-
inkscape:connector-curvature="0"
|
123 |
-
id="path3221"
|
124 |
-
style="fill:#df0019;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
125 |
-
d="m 0,0 4.45,2.752 5.34,3.785 7.05,-8.226 7.093,-33.359 17.801,-51.259 13.86,-30.215 26.261,-1.55 -6.685,-35.653 c 0,0 -49.98,-21.871 -49.545,-21.911 -42.657,4.001 -12.553,43.066 -8.631,47.301 L 3.666,-47.869 0,0 z" /></g><g
|
126 |
-
transform="translate(247.626,467.3545)"
|
127 |
-
id="g3239"><path
|
128 |
-
inkscape:connector-curvature="0"
|
129 |
-
id="path3241"
|
130 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
131 |
-
d="M 0,0 C -3.044,-0.345 -5.232,-3.092 -4.888,-6.136 -4.543,-9.18 1.576,-2.254 13.308,-4.961 13.971,-1.97 3.044,0.344 0,0" /></g><g
|
132 |
-
transform="translate(279.4419,476.5762)"
|
133 |
-
id="g3243"><path
|
134 |
-
inkscape:connector-curvature="0"
|
135 |
-
id="path3245"
|
136 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
137 |
-
d="M 0,0 C 3.271,1.08 6.798,-0.697 7.88,-3.969 8.96,-7.24 -0.55,-3.044 -11.258,-11.329 -13.345,-8.586 -3.272,-1.081 0,0" /></g><g
|
138 |
-
transform="translate(284.1929,525.9082)"
|
139 |
-
id="g3263"><path
|
140 |
-
inkscape:connector-curvature="0"
|
141 |
-
id="path3265"
|
142 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
143 |
-
d="M 0,0 C 0,0 -6.972,28.671 -6.972,29.355 L 1.585,2.864 9.999,-10.564 13.634,-32.697 7.922,-11.098 0,0 z M -0.633,-15.036 -9.19,-4.86 -16.478,25.776 c -0.202,0.684 9.106,-28.811 9.106,-28.811 l 8.64,-11.642 2.469,-17.336 -4.37,16.977 z m -6.339,-6.085 -10.457,16.826 -5.444,28.646 6.614,-27.842 11.311,-18.026 1.413,-9.583 -3.437,9.979 z m -53.462,-13.246 -1.437,24.944 -2.682,28.754 5.106,-29.895 1.212,-21.677 4.139,-18.236 -6.338,16.11 z m -4.265,-19.55 -6.665,15.516 0.404,29.205 -0.882,28.169 3.104,-28.396 0.808,-26.697 4.242,-15.972 2.423,-6.617 -3.434,4.792 z m -9.695,-2.967 -7.117,16.885 1.318,32.01 0,25.223 2.115,-25.061 -0.581,-31.259 5.869,-16.429 5.056,-8.671 -6.66,7.302 z m 103.144,-7.97 -6.676,20.38 2.141,11.54 L 16.499,-9.376 4.557,13.104 -5.879,53.97 c 0,0 -8.325,-7.41 -16.781,-8.08 -8.455,-0.671 -15.09,4.018 -15.09,4.018 0,0 3.592,-17.761 8.659,-37.597 5.069,-19.836 17.528,-44.866 17.528,-44.866 0,0 21.578,-8.197 24.302,-16.587 2.724,-8.391 -3.508,-22.911 -14.102,-26.551 -10.593,-3.64 -32.284,-8.262 -32.284,-8.262 0,0 -19,1.512 -20.438,14.26 0,0 4.131,16.406 10.418,19.225 6.285,2.819 21.362,11.174 21.362,11.174 l -8.254,1.332 -7.664,-1.332 c 0,0 -4.784,11.295 -10.973,35.086 -6.19,23.79 -8.967,42.485 -8.967,42.485 0,0 -3.912,-4.391 -14.199,-4.885 -10.286,-0.494 -16.031,7.988 -16.031,7.988 l 1.027,-30.185 -1.049,-25.83 -0.15,-29.22 5.102,-15.99 19.818,-30.448 c 0,0 14.102,-9.293 31.728,-9.293 16.453,1.328 51.131,18.047 51.131,18.047 l 9.536,16.687 z" /></g></g><g
|
144 |
-
id="g3267"
|
145 |
-
transform="translate(847.2637,321.5059)"><path
|
146 |
-
d="m 0,0 c 2.252,3.516 6.693,15.3 6.693,15.3 0,0 3.778,-13.306 1.912,-17.213 -3.056,-6.404 -23.905,-15.3 -23.905,-15.3 0,0 12.196,12.364 15.3,17.213 m -33.514,23.16 -0.757,56.352 c 0,0 11.136,-14.028 11.843,-19.739 1.176,-9.491 -11.086,-36.613 -11.086,-36.613 m -17.575,236.921 c 0,0 12.453,-15.338 14.854,-21.39 1.424,-3.591 2.286,-15.287 2.286,-15.287 l -17.14,36.677 z M -98.574,-86.136 c -9.757,-0.906 -29.836,1.016 -38.912,4.708 -7.499,3.05 -25.734,19.656 -25.734,19.656 l 24.187,-10.86 -4.701,17.627 15.272,-22.009 41.813,-5.356 c 0,0 -8.812,-3.477 -11.925,-3.766 m -74.428,157.941 c -4.518,10.057 -1.763,44.065 -1.763,44.065 0,0 7.544,-31.093 12.338,-40.541 6.978,-13.754 37.015,-49.352 37.015,-49.352 0,0 -40.824,30.759 -47.59,45.828 m -17.833,-149.47 -40.407,24.724 1.636,-17.575 0.026,-0.035 -5.178,-29.811 -2.056,-10.701 0.383,-33.34 -4.982,36.406 6.41,41.45 -11.063,8.338 -17.532,43.159 23.502,-38.779 2.351,14.101 40.634,-25.695 11.924,-5.651 13.809,-28.871 -19.457,22.28 z m -85.522,138.863 17.212,-34.424 c 0,0 -12.972,11.185 -15.299,16.257 -1.905,4.152 -1.913,18.167 -1.913,18.167 m -2.367,66.042 c 0,0 -6.206,15.581 -6.323,21.082 -0.168,7.817 4.568,23.148 7.695,30.315 0.755,1.73 4.103,6.341 4.103,6.341 0,0 -4.654,-24.542 -5.347,-32.829 -0.518,-6.205 -0.128,-24.909 -0.128,-24.909 m -7.195,-114.809 c -0.334,3.363 1.912,13.387 1.912,13.387 l 3.825,-29.643 c 0,0 -5.313,11.967 -5.737,16.256 m -20.082,53.549 c -1.394,3.571 -0.956,15.301 -0.956,15.301 l 13.388,-30.6 c 0,0 -10.639,10.71 -12.432,15.299 m -6.03,106.795 c 0,0 -0.315,35.831 4.637,46.379 4.531,9.647 29.936,30.356 29.936,30.356 0,0 -17.824,-22.47 -21.503,-31.2 -5.089,-12.077 -10.119,-51.437 -10.119,-51.437 l -2.951,5.902 z M 50.121,205.01 c 3.335,-9.155 1.168,-38.956 1.168,-38.956 0,0 -5.451,29.987 -9.221,39.366 -4.214,10.487 -23.014,38.907 -23.014,38.907 0,0 26.78,-27.546 31.067,-39.317 M 54.506,95.624 c 0,0 6.884,-18.586 5.738,-24.861 -0.773,-4.241 -9.562,-14.345 -9.562,-14.345 0,0 2.414,12.874 2.868,17.212 0.573,5.474 0.956,21.994 0.956,21.994 M 19.125,-13.389 c 0,0 9.656,22.183 11.062,30.068 1.235,6.941 0,28.203 0,28.203 0,0 8.477,-22.819 7.106,-30.538 C 35.845,6.183 19.125,-13.389 19.125,-13.389 m 441.487,-40.965 c -3.249,8.935 -6.587,17.23 -10.01,24.928 l -1.862,28.873 -8.857,-4.876 -25.862,49.457 -4.828,-10.34 c -32.69,31.48 -70.457,34.284 -111.982,31.646 -65.568,-4.163 -91.587,-41.63 -79.098,-57.241 12.49,-15.613 18.733,-5.205 40.589,5.203 21.858,10.407 74.937,26.017 110.323,-2.082 35.386,-28.1 86.383,-109.281 50.997,-169.646 -35.386,-60.365 -105.626,-105.385 -182.135,-88.465 -86.422,19.112 -126.078,60.082 -177.675,74.811 -8.311,1.334 -18.347,2.789 -24.791,3.191 -12.671,0.792 -21.6,14.727 -21.6,14.727 l 17.181,-9.327 25.763,-2.36 c 2.331,14 9.395,49.054 9.395,49.054 l -8.688,87.29 -18.668,-27.06 -7.246,10.184 -21.349,-22.915 -15.473,-1.959 14.67,6.596 21.38,29.409 6.7,-13.754 19.485,24.691 0.004,-0.011 16.47,9.525 -3.123,68.69 10.407,-10.407 -4.163,40.59 22.173,71.502 -34.662,91.899 16.652,-4.162 -19.773,35.386 -40.591,38.509 9.368,17.693 -93.671,9.368 -20.229,-7.165 -18.437,38.292 13.22,8.813 -69.039,14.69 2.938,19.095 -80.791,-23.303 -26.147,-19.191 -116.339,0 8.814,-10.188 -42.501,-40.641 -8.911,-78.491 7.344,-1.494 8.814,-45.548 23.502,-24.978 19.096,45.533 -14.689,-4.409 41.13,48.474 30.848,26.44 -14.69,-1.469 19.096,16.158 105.763,2.938 72.917,15.799 -41.623,-14.742 -30.181,-7.285 -104.079,-1.043 1.04,-11.449 -64.526,-61.403 14.571,2.081 -27.844,-63.28 c -15.017,-13.719 -28.06,-55.016 -36.687,-75.145 -9.367,-21.856 -20.816,-39.55 -20.816,-39.55 0,0 -30.182,-6.244 -61.405,-18.734 -31.224,-12.489 -43.713,4.163 -43.713,4.163 l -3.122,-8.326 c 0,0 -18.28,-9.057 -39.303,-11.825 -16.43,-2.162 -9.967,-20.946 -9.613,-26.684 0.405,-6.57 4.294,-19.774 8.325,-24.978 3.227,-4.165 12.525,-10.425 17.694,-11.448 12.039,-2.385 28.101,5.204 45.794,17.693 74.936,-6.245 103.241,-10.321 126.974,8.326 14.572,11.448 29.142,22.897 41.631,40.59 l -15.611,42.671 -8.327,-14.569 -5.807,44.931 1.841,17.863 5.547,-51.234 7.789,9.257 35.387,-70.772 11.448,4.164 c 0,0 13.515,-18.583 23.057,-32.881 l -26.02,25.006 -10.224,-5.964 -11.076,22.152 c 0,0 -13.383,-2.353 -24.727,-18.027 -15.862,-21.915 -23.503,-24.678 -17.627,-78.735 5.876,-54.055 16.452,-54.055 64.632,-121.039 11.752,-16.452 14.601,-18.465 14.601,-18.465 l -51.03,-27.365 -22.327,-5.876 -21.384,-11.28 c 0,0 4.744,-8.174 7.495,-9.369 4.739,-2.062 20.613,1.56 20.613,1.56 0,0 15.603,-6.763 36.756,-6.763 21.152,0 32.903,8.225 47.005,8.225 14.101,0 38.78,-8.225 57.582,-5.876 18.802,2.351 22.328,12.927 22.328,12.927 l -51.706,54.057 -4.675,47.096 -56.605,75.769 -3.038,9.437 65.791,-82.24 5.107,-46.75 55.161,-61.405 37.468,-8.325 c 0,0 -0.257,1.226 -0.625,3.114 -6.146,15.664 -6.986,34.894 -1.999,54.214 6.975,27.012 38.85,36.596 64.029,36.596 12.506,0 24.179,-2.312 32.025,-6.341 12.912,-6.63 21.851,-15.076 27.029,-20.917 3.673,4.516 7.133,7.194 11.833,11.11 0,0 12.143,-11.751 45.047,-14.101 27.14,-1.939 45.048,-8.226 70.901,-19.585 53.676,-23.584 102.5,-61.785 207.618,-45.132 105.119,16.651 206.073,113.444 164.442,227.929"
|
147 |
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
148 |
-
id="path3269"
|
149 |
-
inkscape:connector-curvature="0" /></g><path
|
150 |
-
inkscape:connector-curvature="0"
|
151 |
-
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
152 |
-
d="m 329.26398,723.3082 -118.025,-19.2 -120.800003,-28.175 72.600003,-281.65 115.075,7.875 95.275,50.65 -44.125,270.5 z m -6.55,-10.575 40.675,-252.4 -87.85,-47.275 -106.125,-7.325 -66.95,262.8 111.4,26.275 108.85,17.925 z"
|
153 |
-
id="path3253-3" /></g></svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/css/docs.css
DELETED
@@ -1,154 +0,0 @@
|
|
1 |
-
body {
|
2 |
-
font-family: Droid Sans, Arial, sans-serif;
|
3 |
-
line-height: 1.5;
|
4 |
-
max-width: 64.3em;
|
5 |
-
margin: 3em auto;
|
6 |
-
padding: 0 1em;
|
7 |
-
}
|
8 |
-
|
9 |
-
h1 {
|
10 |
-
letter-spacing: -3px;
|
11 |
-
font-size: 3.23em;
|
12 |
-
font-weight: bold;
|
13 |
-
margin: 0;
|
14 |
-
}
|
15 |
-
|
16 |
-
h2 {
|
17 |
-
font-size: 1.23em;
|
18 |
-
font-weight: bold;
|
19 |
-
margin: .5em 0;
|
20 |
-
letter-spacing: -1px;
|
21 |
-
}
|
22 |
-
|
23 |
-
h3 {
|
24 |
-
font-size: 1em;
|
25 |
-
font-weight: bold;
|
26 |
-
margin: .4em 0;
|
27 |
-
}
|
28 |
-
|
29 |
-
pre {
|
30 |
-
background-color: #eee;
|
31 |
-
-moz-border-radius: 6px;
|
32 |
-
-webkit-border-radius: 6px;
|
33 |
-
border-radius: 6px;
|
34 |
-
padding: 1em;
|
35 |
-
}
|
36 |
-
|
37 |
-
pre.code {
|
38 |
-
margin: 0 1em;
|
39 |
-
}
|
40 |
-
|
41 |
-
.grey {
|
42 |
-
font-size: 2.2em;
|
43 |
-
padding: .5em 1em;
|
44 |
-
line-height: 1.2em;
|
45 |
-
margin-top: .5em;
|
46 |
-
position: relative;
|
47 |
-
}
|
48 |
-
|
49 |
-
img.logo {
|
50 |
-
position: absolute;
|
51 |
-
right: -25px;
|
52 |
-
bottom: 4px;
|
53 |
-
}
|
54 |
-
|
55 |
-
a:link, a:visited, .quasilink {
|
56 |
-
color: #df0019;
|
57 |
-
cursor: pointer;
|
58 |
-
text-decoration: none;
|
59 |
-
}
|
60 |
-
|
61 |
-
a:hover, .quasilink:hover {
|
62 |
-
color: #800004;
|
63 |
-
}
|
64 |
-
|
65 |
-
h1 a:link, h1 a:visited, h1 a:hover {
|
66 |
-
color: black;
|
67 |
-
}
|
68 |
-
|
69 |
-
ul {
|
70 |
-
margin: 0;
|
71 |
-
padding-left: 1.2em;
|
72 |
-
}
|
73 |
-
|
74 |
-
a.download {
|
75 |
-
color: white;
|
76 |
-
background-color: #df0019;
|
77 |
-
width: 100%;
|
78 |
-
display: block;
|
79 |
-
text-align: center;
|
80 |
-
font-size: 1.23em;
|
81 |
-
font-weight: bold;
|
82 |
-
text-decoration: none;
|
83 |
-
-moz-border-radius: 6px;
|
84 |
-
-webkit-border-radius: 6px;
|
85 |
-
border-radius: 6px;
|
86 |
-
padding: .5em 0;
|
87 |
-
margin-bottom: 1em;
|
88 |
-
}
|
89 |
-
|
90 |
-
a.download:hover {
|
91 |
-
background-color: #bb0010;
|
92 |
-
}
|
93 |
-
|
94 |
-
.rel {
|
95 |
-
margin-bottom: 0;
|
96 |
-
}
|
97 |
-
|
98 |
-
.rel-note {
|
99 |
-
color: #777;
|
100 |
-
font-size: .9em;
|
101 |
-
margin-top: .1em;
|
102 |
-
}
|
103 |
-
|
104 |
-
.logo-braces {
|
105 |
-
color: #df0019;
|
106 |
-
position: relative;
|
107 |
-
top: -4px;
|
108 |
-
}
|
109 |
-
|
110 |
-
.blk {
|
111 |
-
float: left;
|
112 |
-
}
|
113 |
-
|
114 |
-
.left {
|
115 |
-
width: 37em;
|
116 |
-
padding-right: 6.53em;
|
117 |
-
padding-bottom: 1em;
|
118 |
-
}
|
119 |
-
|
120 |
-
.left1 {
|
121 |
-
width: 15.24em;
|
122 |
-
padding-right: 6.45em;
|
123 |
-
}
|
124 |
-
|
125 |
-
.left2 {
|
126 |
-
width: 15.24em;
|
127 |
-
}
|
128 |
-
|
129 |
-
.right {
|
130 |
-
width: 20.68em;
|
131 |
-
}
|
132 |
-
|
133 |
-
.leftbig {
|
134 |
-
width: 42.44em;
|
135 |
-
padding-right: 6.53em;
|
136 |
-
}
|
137 |
-
|
138 |
-
.rightsmall {
|
139 |
-
width: 15.24em;
|
140 |
-
}
|
141 |
-
|
142 |
-
.clear:after {
|
143 |
-
visibility: hidden;
|
144 |
-
display: block;
|
145 |
-
font-size: 0;
|
146 |
-
content: " ";
|
147 |
-
clear: both;
|
148 |
-
height: 0;
|
149 |
-
}
|
150 |
-
.clear { display: inline-block; }
|
151 |
-
/* start commented backslash hack \*/
|
152 |
-
* html .clear { height: 1%; }
|
153 |
-
.clear { display: block; }
|
154 |
-
/* close commented backslash hack */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/activeline.html
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Active Line Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<script src="../mode/xml/xml.js"></script>
|
9 |
-
<link rel="stylesheet" href="../css/docs.css">
|
10 |
-
|
11 |
-
<style type="text/css">
|
12 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
13 |
-
.activeline {background: #f0fcff !important;}
|
14 |
-
</style>
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: Active Line Demo</h1>
|
18 |
-
|
19 |
-
<form><textarea id="code" name="code">
|
20 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
21 |
-
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
|
22 |
-
xmlns:georss="http://www.georss.org/georss"
|
23 |
-
xmlns:twitter="http://api.twitter.com">
|
24 |
-
<channel>
|
25 |
-
<title>Twitter / codemirror</title>
|
26 |
-
<link>http://twitter.com/codemirror</link>
|
27 |
-
<atom:link type="application/rss+xml"
|
28 |
-
href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/>
|
29 |
-
<description>Twitter updates from CodeMirror / codemirror.</description>
|
30 |
-
<language>en-us</language>
|
31 |
-
<ttl>40</ttl>
|
32 |
-
<item>
|
33 |
-
<title>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This one
|
34 |
-
uses CodeMirror as its editor.</title>
|
35 |
-
<description>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This
|
36 |
-
one uses CodeMirror as its editor.</description>
|
37 |
-
<pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate>
|
38 |
-
<guid>http://twitter.com/codemirror/statuses/48527733722058752</guid>
|
39 |
-
<link>http://twitter.com/codemirror/statuses/48527733722058752</link>
|
40 |
-
<twitter:source>web</twitter:source>
|
41 |
-
<twitter:place/>
|
42 |
-
</item>
|
43 |
-
<item>
|
44 |
-
<title>codemirror: Posted a description of the CodeMirror 2 internals at
|
45 |
-
http://codemirror.net/2/internals.html</title>
|
46 |
-
<description>codemirror: Posted a description of the CodeMirror 2 internals at
|
47 |
-
http://codemirror.net/2/internals.html</description>
|
48 |
-
<pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate>
|
49 |
-
<guid>http://twitter.com/codemirror/statuses/42920879788789760</guid>
|
50 |
-
<link>http://twitter.com/codemirror/statuses/42920879788789760</link>
|
51 |
-
<twitter:source>web</twitter:source>
|
52 |
-
<twitter:place/>
|
53 |
-
</item>
|
54 |
-
</channel>
|
55 |
-
</rss></textarea></form>
|
56 |
-
|
57 |
-
<script>
|
58 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
59 |
-
mode: "application/xml",
|
60 |
-
lineNumbers: true,
|
61 |
-
onCursorActivity: function() {
|
62 |
-
editor.setLineClass(hlLine, null);
|
63 |
-
hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
|
64 |
-
}
|
65 |
-
});
|
66 |
-
var hlLine = editor.setLineClass(0, "activeline");
|
67 |
-
</script>
|
68 |
-
|
69 |
-
<p>Styling the current cursor line.</p>
|
70 |
-
|
71 |
-
</body>
|
72 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/changemode.html
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Mode-Changing Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<script src="../mode/javascript/javascript.js"></script>
|
9 |
-
<script src="../mode/scheme/scheme.js"></script>
|
10 |
-
<link rel="stylesheet" href="../css/docs.css">
|
11 |
-
|
12 |
-
<style type="text/css">
|
13 |
-
.CodeMirror {border: 1px solid black;}
|
14 |
-
</style>
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: Mode-Changing demo</h1>
|
18 |
-
|
19 |
-
<form><textarea id="code" name="code">
|
20 |
-
;; If there is Scheme code in here, the editor will be in Scheme mode.
|
21 |
-
;; If you put in JS instead, it'll switch to JS mode.
|
22 |
-
|
23 |
-
(define (double x)
|
24 |
-
(* x x))
|
25 |
-
</textarea></form>
|
26 |
-
|
27 |
-
<p>On changes to the content of the above editor, a (crude) script
|
28 |
-
tries to auto-detect the language used, and switches the editor to
|
29 |
-
either JavaScript or Scheme mode based on that.</p>
|
30 |
-
|
31 |
-
<script>
|
32 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
33 |
-
mode: "scheme",
|
34 |
-
lineNumbers: true,
|
35 |
-
matchBrackets: true,
|
36 |
-
tabMode: "indent",
|
37 |
-
onChange: function() {
|
38 |
-
clearTimeout(pending);
|
39 |
-
setTimeout(update, 400);
|
40 |
-
}
|
41 |
-
});
|
42 |
-
var pending;
|
43 |
-
function looksLikeScheme(code) {
|
44 |
-
return !/^\s*\(\s*function\b/.test(code) && /^\s*[;\(]/.test(code);
|
45 |
-
}
|
46 |
-
function update() {
|
47 |
-
editor.setOption("mode", looksLikeScheme(editor.getValue()) ? "scheme" : "javascript");
|
48 |
-
}
|
49 |
-
</script>
|
50 |
-
</body>
|
51 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/complete.html
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Autocomplete Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<script src="../lib/util/simple-hint.js"></script>
|
8 |
-
<link rel="stylesheet" href="../lib/util/simple-hint.css">
|
9 |
-
<script src="../lib/util/javascript-hint.js"></script>
|
10 |
-
<link rel="stylesheet" href="../theme/night.css">
|
11 |
-
<script src="../mode/javascript/javascript.js"></script>
|
12 |
-
<link rel="stylesheet" href="../css/docs.css">
|
13 |
-
<style type="text/css">.CodeMirror {border: 1px solid #eee;}</style>
|
14 |
-
</head>
|
15 |
-
<body>
|
16 |
-
<h1>CodeMirror 2: Autocomplete demo</h1>
|
17 |
-
|
18 |
-
<form><textarea id="code" name="code">
|
19 |
-
function getCompletions(token, context) {
|
20 |
-
var found = [], start = token.string;
|
21 |
-
function maybeAdd(str) {
|
22 |
-
if (str.indexOf(start) == 0) found.push(str);
|
23 |
-
}
|
24 |
-
function gatherCompletions(obj) {
|
25 |
-
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
26 |
-
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
27 |
-
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
28 |
-
for (var name in obj) maybeAdd(name);
|
29 |
-
}
|
30 |
-
|
31 |
-
if (context) {
|
32 |
-
// If this is a property, see if it belongs to some object we can
|
33 |
-
// find in the current environment.
|
34 |
-
var obj = context.pop(), base;
|
35 |
-
if (obj.className == "js-variable")
|
36 |
-
base = window[obj.string];
|
37 |
-
else if (obj.className == "js-string")
|
38 |
-
base = "";
|
39 |
-
else if (obj.className == "js-atom")
|
40 |
-
base = 1;
|
41 |
-
while (base != null && context.length)
|
42 |
-
base = base[context.pop().string];
|
43 |
-
if (base != null) gatherCompletions(base);
|
44 |
-
}
|
45 |
-
else {
|
46 |
-
// If not, just look in the window object and any local scope
|
47 |
-
// (reading into JS mode internals to get at the local variables)
|
48 |
-
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
49 |
-
gatherCompletions(window);
|
50 |
-
forEach(keywords, maybeAdd);
|
51 |
-
}
|
52 |
-
return found;
|
53 |
-
}
|
54 |
-
</textarea></form>
|
55 |
-
|
56 |
-
<p>Press <strong>ctrl-space</strong> to activate autocompletion. See
|
57 |
-
the code (<a href="../lib/util/simple-hint.js">here</a>
|
58 |
-
and <a href="../lib/util/javascript-hint.js">here</a>) to figure out
|
59 |
-
how it works.</p>
|
60 |
-
|
61 |
-
<script>
|
62 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
63 |
-
lineNumbers: true,
|
64 |
-
theme: "night",
|
65 |
-
onKeyEvent: function(cm, e) {
|
66 |
-
// Hook into ctrl-space
|
67 |
-
if (e.keyCode == 32 && (e.ctrlKey || e.metaKey) && !e.altKey) {
|
68 |
-
e.stop();
|
69 |
-
return CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
});
|
73 |
-
</script>
|
74 |
-
</body>
|
75 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/folding.html
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Code Folding Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<script src="../lib/util/foldcode.js"></script>
|
8 |
-
<link rel="stylesheet" href="../theme/default.css">
|
9 |
-
<script src="../mode/javascript/javascript.js"></script>
|
10 |
-
<link rel="stylesheet" href="../css/docs.css">
|
11 |
-
|
12 |
-
<style type="text/css">
|
13 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
14 |
-
.CodeMirror-gutter {min-width: 3em; cursor: pointer;}
|
15 |
-
</style>
|
16 |
-
</head>
|
17 |
-
<body>
|
18 |
-
<h1>CodeMirror 2: Code Folding Demo</h1>
|
19 |
-
|
20 |
-
<form><div style="max-width: 50em"><textarea id="code" name="code"></textarea></div></form>
|
21 |
-
|
22 |
-
<script id="script">
|
23 |
-
window.onload = function() {
|
24 |
-
var te = document.getElementById("code");
|
25 |
-
var sc = document.getElementById("script");
|
26 |
-
te.value = (sc.textContent || sc.innerText || sc.innerHTML).replace(/^\s*/, "");
|
27 |
-
|
28 |
-
var foldFunc = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder);
|
29 |
-
function keyEvent(cm, e) {
|
30 |
-
if (e.keyCode == 81 && e.ctrlKey) {
|
31 |
-
if (e.type == "keydown") {
|
32 |
-
e.stop();
|
33 |
-
setTimeout(function() {foldFunc(cm, cm.getCursor().line);}, 50);
|
34 |
-
}
|
35 |
-
return true;
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
window.editor = CodeMirror.fromTextArea(te, {
|
40 |
-
mode: "javascript",
|
41 |
-
lineNumbers: true,
|
42 |
-
lineWrapping: true,
|
43 |
-
onGutterClick: foldFunc,
|
44 |
-
onKeyEvent: keyEvent
|
45 |
-
});
|
46 |
-
|
47 |
-
foldFunc(editor, 6);
|
48 |
-
foldFunc(editor, 16);
|
49 |
-
};
|
50 |
-
</script>
|
51 |
-
|
52 |
-
<p>Demonstration of code folding using the code
|
53 |
-
in <a href="../lib/util/foldcode.js"><code>foldcode.js</code></a>.
|
54 |
-
Press ctrl-q or click on the gutter to fold a block, again
|
55 |
-
to unfold.</p>
|
56 |
-
</body>
|
57 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/fullscreen.html
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Full Screen Editing</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<link rel="stylesheet" href="../theme/night.css">
|
9 |
-
<script src="../mode/xml/xml.js"></script>
|
10 |
-
<link rel="stylesheet" href="../css/docs.css">
|
11 |
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
|
12 |
-
|
13 |
-
<style type="text/css">
|
14 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
15 |
-
.fullscreen {
|
16 |
-
display: block;
|
17 |
-
position: absolute;
|
18 |
-
top: 0;
|
19 |
-
left: 0;
|
20 |
-
width: 100%;
|
21 |
-
height: 100%;
|
22 |
-
z-index: 9999;
|
23 |
-
margin: 0;
|
24 |
-
padding: 0;
|
25 |
-
border: 0px solid #BBBBBB;
|
26 |
-
opacity: 1;
|
27 |
-
}
|
28 |
-
</style>
|
29 |
-
</head>
|
30 |
-
<body>
|
31 |
-
<h1>CodeMirror 2: Full Screen Editing</h1>
|
32 |
-
|
33 |
-
<form><textarea id="code" name="code" rows="5">
|
34 |
-
<dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
|
35 |
-
<dd>Whether, when indenting, the first N*8 spaces should be
|
36 |
-
replaced by N tabs. Default is false.</dd>
|
37 |
-
|
38 |
-
<dt id="option_tabMode"><code>tabMode (string)</code></dt>
|
39 |
-
<dd>Determines what happens when the user presses the tab key.
|
40 |
-
Must be one of the following:
|
41 |
-
<dl>
|
42 |
-
<dt><code>"classic" (the default)</code></dt>
|
43 |
-
<dd>When nothing is selected, insert a tab. Otherwise,
|
44 |
-
behave like the <code>"shift"</code> mode. (When shift is
|
45 |
-
held, this behaves like the <code>"indent"</code> mode.)</dd>
|
46 |
-
<dt><code>"shift"</code></dt>
|
47 |
-
<dd>Indent all selected lines by
|
48 |
-
one <a href="#option_indentUnit"><code>indentUnit</code></a>.
|
49 |
-
If shift was held while pressing tab, un-indent all selected
|
50 |
-
lines one unit.</dd>
|
51 |
-
<dt><code>"indent"</code></dt>
|
52 |
-
<dd>Indent the line the 'correctly', based on its syntactic
|
53 |
-
context. Only works if the
|
54 |
-
mode <a href="#indent">supports</a> it.</dd>
|
55 |
-
<dt><code>"default"</code></dt>
|
56 |
-
<dd>Do not capture tab presses, let the browser apply its
|
57 |
-
default behaviour (which usually means it skips to the next
|
58 |
-
control).</dd>
|
59 |
-
</dl></dd>
|
60 |
-
|
61 |
-
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
|
62 |
-
<dd>Determines whether and how new lines are indented when the
|
63 |
-
enter key is pressed. The following modes are supported:
|
64 |
-
<dl>
|
65 |
-
<dt><code>"indent" (the default)</code></dt>
|
66 |
-
<dd>Use the mode's indentation rules to give the new line
|
67 |
-
the correct indentation.</dd>
|
68 |
-
<dt><code>"keep"</code></dt>
|
69 |
-
<dd>Indent the line the same as the previous line.</dd>
|
70 |
-
<dt><code>"flat"</code></dt>
|
71 |
-
<dd>Do not indent the new line.</dd>
|
72 |
-
</dl></dd>
|
73 |
-
|
74 |
-
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
|
75 |
-
<dd>Determines whether and how new lines are indented when the
|
76 |
-
enter key is pressed. The following modes are supported:
|
77 |
-
<dl>
|
78 |
-
<dt><code>"indent" (the default)</code></dt>
|
79 |
-
<dd>Use the mode's indentation rules to give the new line
|
80 |
-
the correct indentation.</dd>
|
81 |
-
<dt><code>"keep"</code></dt>
|
82 |
-
<dd>Indent the line the same as the previous line.</dd>
|
83 |
-
<dt><code>"flat"</code></dt>
|
84 |
-
<dd>Do not indent the new line.</dd>
|
85 |
-
</dl></dd>
|
86 |
-
|
87 |
-
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
|
88 |
-
<dd>Determines whether and how new lines are indented when the
|
89 |
-
enter key is pressed. The following modes are supported:
|
90 |
-
<dl>
|
91 |
-
<dt><code>"indent" (the default)</code></dt>
|
92 |
-
<dd>Use the mode's indentation rules to give the new line
|
93 |
-
the correct indentation.</dd>
|
94 |
-
<dt><code>"keep"</code></dt>
|
95 |
-
<dd>Indent the line the same as the previous line.</dd>
|
96 |
-
<dt><code>"flat"</code></dt>
|
97 |
-
<dd>Do not indent the new line.</dd>
|
98 |
-
</dl></dd>
|
99 |
-
|
100 |
-
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
|
101 |
-
<dd>Determines whether and how new lines are indented when the
|
102 |
-
enter key is pressed. The following modes are supported:
|
103 |
-
<dl>
|
104 |
-
<dt><code>"indent" (the default)</code></dt>
|
105 |
-
<dd>Use the mode's indentation rules to give the new line
|
106 |
-
the correct indentation.</dd>
|
107 |
-
<dt><code>"keep"</code></dt>
|
108 |
-
<dd>Indent the line the same as the previous line.</dd>
|
109 |
-
<dt><code>"flat"</code></dt>
|
110 |
-
<dd>Do not indent the new line.</dd>
|
111 |
-
</dl></dd>
|
112 |
-
|
113 |
-
</textarea></form>
|
114 |
-
<script>
|
115 |
-
|
116 |
-
(function () {
|
117 |
-
|
118 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
119 |
-
lineNumbers: true,
|
120 |
-
theme: "night",
|
121 |
-
onKeyEvent: function(i, e) {
|
122 |
-
// Hook into F11
|
123 |
-
if ((e.keyCode == 122 || e.keyCode == 27) && e.type == 'keydown') {
|
124 |
-
e.stop();
|
125 |
-
return toggleFullscreenEditing();
|
126 |
-
}
|
127 |
-
}
|
128 |
-
});
|
129 |
-
|
130 |
-
function toggleFullscreenEditing()
|
131 |
-
{
|
132 |
-
var editorDiv = $('.CodeMirror-scroll');
|
133 |
-
if (!editorDiv.hasClass('fullscreen')) {
|
134 |
-
toggleFullscreenEditing.beforeFullscreen = { height: editorDiv.height(), width: editorDiv.width() }
|
135 |
-
editorDiv.addClass('fullscreen');
|
136 |
-
editorDiv.height('100%');
|
137 |
-
editorDiv.width('100%');
|
138 |
-
editor.refresh();
|
139 |
-
}
|
140 |
-
else {
|
141 |
-
editorDiv.removeClass('fullscreen');
|
142 |
-
editorDiv.height(toggleFullscreenEditing.beforeFullscreen.height);
|
143 |
-
editorDiv.width(toggleFullscreenEditing.beforeFullscreen.width);
|
144 |
-
editor.refresh();
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
})();
|
149 |
-
</script>
|
150 |
-
|
151 |
-
<p>Press <strong>F11</strong> (or <strong>ESC</strong> in Safari on Mac OS X) when cursor is in the editor to toggle full screen editing.</p>
|
152 |
-
|
153 |
-
<p><strong>Note:</strong> Does not currently work correctly in IE
|
154 |
-
6 and 7, where setting the height of something
|
155 |
-
to <code>100%</code> doesn't make it full-screen.</p>
|
156 |
-
|
157 |
-
</body>
|
158 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/marker.html
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Breakpoint Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<script src="../mode/javascript/javascript.js"></script>
|
9 |
-
<link rel="stylesheet" href="../css/docs.css">
|
10 |
-
|
11 |
-
<style type="text/css">
|
12 |
-
.CodeMirror-gutter {
|
13 |
-
width: 3em;
|
14 |
-
background: white;
|
15 |
-
}
|
16 |
-
.CodeMirror {
|
17 |
-
border: 1px solid #aaa;
|
18 |
-
}
|
19 |
-
</style>
|
20 |
-
</head>
|
21 |
-
<body>
|
22 |
-
<h1>CodeMirror 2: Breakpoint demo</h1>
|
23 |
-
|
24 |
-
<form><textarea id="code" name="code">
|
25 |
-
CodeMirror.fromTextArea(document.getElementById("code"), {
|
26 |
-
lineNumbers: true,
|
27 |
-
onGutterClick: function(cm, n) {
|
28 |
-
var info = cm.lineInfo(n);
|
29 |
-
if (info.markerText)
|
30 |
-
cm.clearMarker(n);
|
31 |
-
else
|
32 |
-
cm.setMarker(n, "<span style=\"color: #900\">●</span> %N%");
|
33 |
-
}
|
34 |
-
});
|
35 |
-
</textarea></form>
|
36 |
-
|
37 |
-
<p>Click the line-number gutter to add or remove 'breakpoints'.</p>
|
38 |
-
|
39 |
-
<script>
|
40 |
-
CodeMirror.fromTextArea(document.getElementById("code"), {
|
41 |
-
lineNumbers: true,
|
42 |
-
onGutterClick: function(cm, n) {
|
43 |
-
var info = cm.lineInfo(n);
|
44 |
-
if (info.markerText)
|
45 |
-
cm.clearMarker(n);
|
46 |
-
else
|
47 |
-
cm.setMarker(n, "<span style=\"color: #900\">●</span> %N%");
|
48 |
-
}
|
49 |
-
});
|
50 |
-
</script>
|
51 |
-
|
52 |
-
</body>
|
53 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/mustache.html
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Overlay Parser Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<script src="../lib/util/overlay.js"></script>
|
8 |
-
<link rel="stylesheet" href="../theme/default.css">
|
9 |
-
<script src="../mode/xml/xml.js"></script>
|
10 |
-
<link rel="stylesheet" href="../css/docs.css">
|
11 |
-
|
12 |
-
<style type="text/css">
|
13 |
-
.CodeMirror {border: 1px solid black;}
|
14 |
-
.cm-mustache {color: #0ca;}
|
15 |
-
</style>
|
16 |
-
</head>
|
17 |
-
<body>
|
18 |
-
<h1>CodeMirror 2: Overlay Parser Demo</h1>
|
19 |
-
|
20 |
-
<form><textarea id="code" name="code">
|
21 |
-
<html>
|
22 |
-
<body>
|
23 |
-
<h1>{{title}}</h1>
|
24 |
-
<p>These are links to {{things}}:</p>
|
25 |
-
<ul>{{#links}}
|
26 |
-
<li><a href="{{url}}">{{text}}</a></li>
|
27 |
-
{{/links}}</ul>
|
28 |
-
</body>
|
29 |
-
</html>
|
30 |
-
</textarea></form>
|
31 |
-
|
32 |
-
<script>
|
33 |
-
CodeMirror.defineMode("mustache", function(config, parserConfig) {
|
34 |
-
var mustacheOverlay = {
|
35 |
-
token: function(stream, state) {
|
36 |
-
if (stream.match("{{")) {
|
37 |
-
while ((ch = stream.next()) != null)
|
38 |
-
if (ch == "}" && stream.next() == "}") break;
|
39 |
-
return "mustache";
|
40 |
-
}
|
41 |
-
while (stream.next() != null && !stream.match("{{", false)) {}
|
42 |
-
return null;
|
43 |
-
}
|
44 |
-
};
|
45 |
-
return CodeMirror.overlayParser(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
|
46 |
-
});
|
47 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "mustache"});
|
48 |
-
</script>
|
49 |
-
|
50 |
-
<p>Demonstration of a mode that parses HTML, highlighting
|
51 |
-
the <a href="http://mustache.github.com/">Mustache</a> templating
|
52 |
-
directives inside of it by using the code
|
53 |
-
in <a href="../lib/util/overlay.js"><code>overlay.js</code></a>. View
|
54 |
-
source to see the 15 lines of code needed to accomplish this.</p>
|
55 |
-
|
56 |
-
</body>
|
57 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/preview.html
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: HTML5 preview</title>
|
5 |
-
<meta charset=utf-8>
|
6 |
-
<script src=../lib/codemirror.js></script>
|
7 |
-
<script src=../mode/xml/xml.js></script>
|
8 |
-
<script src=../mode/javascript/javascript.js></script>
|
9 |
-
<script src=../mode/css/css.js></script>
|
10 |
-
<script src=../mode/htmlmixed/htmlmixed.js></script>
|
11 |
-
<link rel=stylesheet href=../lib/codemirror.css>
|
12 |
-
<link rel=stylesheet href=../theme/default.css>
|
13 |
-
<link rel=stylesheet href=../css/docs.css>
|
14 |
-
<style type=text/css>
|
15 |
-
.CodeMirror {
|
16 |
-
float: left;
|
17 |
-
width: 50%;
|
18 |
-
border: 1px solid black;
|
19 |
-
}
|
20 |
-
iframe {
|
21 |
-
width: 49%;
|
22 |
-
float: left;
|
23 |
-
height: 300px;
|
24 |
-
border: 1px solid black;
|
25 |
-
border-left: 0px;
|
26 |
-
}
|
27 |
-
</style>
|
28 |
-
</head>
|
29 |
-
<body>
|
30 |
-
<h1>CodeMirror 2: HTML5 preview</h1>
|
31 |
-
<textarea id=code name=code>
|
32 |
-
<!doctype html>
|
33 |
-
<html>
|
34 |
-
<head>
|
35 |
-
<meta charset=utf-8>
|
36 |
-
<title>HTML5 canvas demo</title>
|
37 |
-
<style>p {font-family: monospace;}</style>
|
38 |
-
</head>
|
39 |
-
<body>
|
40 |
-
<p>Canvas pane goes here:</p>
|
41 |
-
<canvas id=pane width=300 height=200></canvas>
|
42 |
-
<script>
|
43 |
-
var canvas = document.getElementById('pane');
|
44 |
-
var context = canvas.getContext('2d');
|
45 |
-
|
46 |
-
context.fillStyle = 'rgb(250,0,0)';
|
47 |
-
context.fillRect(10, 10, 55, 50);
|
48 |
-
|
49 |
-
context.fillStyle = 'rgba(0, 0, 250, 0.5)';
|
50 |
-
context.fillRect(30, 30, 55, 50);
|
51 |
-
</script>
|
52 |
-
</body>
|
53 |
-
</html></textarea>
|
54 |
-
<iframe id=preview></iframe>
|
55 |
-
<script>
|
56 |
-
var delay;
|
57 |
-
// Initialize CodeMirror editor with a nice html5 canvas demo.
|
58 |
-
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
59 |
-
mode: 'text/html',
|
60 |
-
tabMode: 'indent',
|
61 |
-
onChange: function() {
|
62 |
-
clearTimeout(delay);
|
63 |
-
delay = setTimeout(updatePreview, 300);
|
64 |
-
}
|
65 |
-
});
|
66 |
-
|
67 |
-
function updatePreview() {
|
68 |
-
var previewFrame = document.getElementById('preview');
|
69 |
-
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;
|
70 |
-
preview.open();
|
71 |
-
preview.write(editor.getValue());
|
72 |
-
preview.close();
|
73 |
-
}
|
74 |
-
setTimeout(updatePreview, 300);
|
75 |
-
</script>
|
76 |
-
</body>
|
77 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/resize.html
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Autoresize Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<script src="../mode/css/css.js"></script>
|
9 |
-
<link rel="stylesheet" href="../css/docs.css">
|
10 |
-
|
11 |
-
<style type="text/css">
|
12 |
-
.CodeMirror {
|
13 |
-
border: 1px solid #eee;
|
14 |
-
}
|
15 |
-
.CodeMirror-scroll {
|
16 |
-
height: auto;
|
17 |
-
overflow-y: hidden;
|
18 |
-
overflow-x: auto;
|
19 |
-
width: 100%;
|
20 |
-
}
|
21 |
-
</style>
|
22 |
-
</head>
|
23 |
-
<body>
|
24 |
-
<h1>CodeMirror 2: Autoresize demo</h1>
|
25 |
-
|
26 |
-
<form><textarea id="code" name="code">
|
27 |
-
.CodeMirror-scroll {
|
28 |
-
height: auto;
|
29 |
-
overflow-y: hidden;
|
30 |
-
overflow-x: auto;
|
31 |
-
width: 100%
|
32 |
-
}</textarea></form>
|
33 |
-
|
34 |
-
<p>By setting a few CSS properties, CodeMirror can be made to
|
35 |
-
automatically resize to fit its content.</p>
|
36 |
-
|
37 |
-
<script>
|
38 |
-
CodeMirror.fromTextArea(document.getElementById("code"), {
|
39 |
-
lineNumbers: true
|
40 |
-
});
|
41 |
-
</script>
|
42 |
-
|
43 |
-
</body>
|
44 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/runmode.html
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Mode Runner Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<script src="../lib/util/runmode.js"></script>
|
8 |
-
<link rel="stylesheet" href="../theme/default.css">
|
9 |
-
<script src="../mode/xml/xml.js"></script>
|
10 |
-
<link rel="stylesheet" href="../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Mode Runner Demo</h1>
|
14 |
-
|
15 |
-
<textarea id="code" style="width: 90%; height: 7em; border: 1px solid black; padding: .2em .4em;">
|
16 |
-
<foobar>
|
17 |
-
<blah>Enter your xml here and press the button below to display
|
18 |
-
it as highlighted by the CodeMirror XML mode</blah>
|
19 |
-
<tag2 foo="2" bar="&quot;bar&quot;"/>
|
20 |
-
</foobar></textarea><br>
|
21 |
-
<button onclick="doHighlight();">Highlight!</button>
|
22 |
-
<pre id="output" class="cm-s-default"></pre>
|
23 |
-
|
24 |
-
<script>
|
25 |
-
function doHighlight() {
|
26 |
-
CodeMirror.runMode(document.getElementById("code").value, "application/xml",
|
27 |
-
document.getElementById("output"));
|
28 |
-
}
|
29 |
-
</script>
|
30 |
-
|
31 |
-
<p>Running a CodeMirror mode outside of the editor.
|
32 |
-
The <code>CodeMirror.runMode</code> function, defined
|
33 |
-
in <code><a href="../lib/util/runmode.js">lib/runmode.js</a></code> takes the following arguments:</p>
|
34 |
-
|
35 |
-
<dl>
|
36 |
-
<dt><code>text (string)</code></dt>
|
37 |
-
<dd>The document to run through the highlighter.</dd>
|
38 |
-
<dt><code>mode (<a href="../manual.html#option_mode">mode spec</a>)</code></dt>
|
39 |
-
<dd>The mode to use (must be loaded as normal).</dd>
|
40 |
-
<dt><code>output (function or DOM node)</code></dt>
|
41 |
-
<dd>If this is a function, it will be called for each token with
|
42 |
-
two arguments, the token's text and the token's style class (may
|
43 |
-
be <code>null</code> for unstyled tokens). If it is a DOM node,
|
44 |
-
the tokens will be converted to <code>span</code> elements as in
|
45 |
-
an editor, and inserted into the node
|
46 |
-
(through <code>innerHTML</code>).</dd>
|
47 |
-
</dl>
|
48 |
-
|
49 |
-
</body>
|
50 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/search.html
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Search/Replace Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<script src="../mode/xml/xml.js"></script>
|
9 |
-
<link rel="stylesheet" href="../css/docs.css">
|
10 |
-
|
11 |
-
<style type="text/css">
|
12 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
13 |
-
.searched {background: yellow;}
|
14 |
-
</style>
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: Search/Replace Demo</h1>
|
18 |
-
|
19 |
-
<form><textarea id="code" name="code">
|
20 |
-
<dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
|
21 |
-
<dd>Whether, when indenting, the first N*8 spaces should be
|
22 |
-
replaced by N tabs. Default is false.</dd>
|
23 |
-
|
24 |
-
<dt id="option_tabMode"><code>tabMode (string)</code></dt>
|
25 |
-
<dd>Determines what happens when the user presses the tab key.
|
26 |
-
Must be one of the following:
|
27 |
-
<dl>
|
28 |
-
<dt><code>"classic" (the default)</code></dt>
|
29 |
-
<dd>When nothing is selected, insert a tab. Otherwise,
|
30 |
-
behave like the <code>"shift"</code> mode. (When shift is
|
31 |
-
held, this behaves like the <code>"indent"</code> mode.)</dd>
|
32 |
-
<dt><code>"shift"</code></dt>
|
33 |
-
<dd>Indent all selected lines by
|
34 |
-
one <a href="#option_indentUnit"><code>indentUnit</code></a>.
|
35 |
-
If shift was held while pressing tab, un-indent all selected
|
36 |
-
lines one unit.</dd>
|
37 |
-
<dt><code>"indent"</code></dt>
|
38 |
-
<dd>Indent the line the 'correctly', based on its syntactic
|
39 |
-
context. Only works if the
|
40 |
-
mode <a href="#indent">supports</a> it.</dd>
|
41 |
-
<dt><code>"default"</code></dt>
|
42 |
-
<dd>Do not capture tab presses, let the browser apply its
|
43 |
-
default behaviour (which usually means it skips to the next
|
44 |
-
control).</dd>
|
45 |
-
</dl></dd>
|
46 |
-
|
47 |
-
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
|
48 |
-
<dd>Determines whether and how new lines are indented when the
|
49 |
-
enter key is pressed. The following modes are supported:
|
50 |
-
<dl>
|
51 |
-
<dt><code>"indent" (the default)</code></dt>
|
52 |
-
<dd>Use the mode's indentation rules to give the new line
|
53 |
-
the correct indentation.</dd>
|
54 |
-
<dt><code>"keep"</code></dt>
|
55 |
-
<dd>Indent the line the same as the previous line.</dd>
|
56 |
-
<dt><code>"flat"</code></dt>
|
57 |
-
<dd>Do not indent the new line.</dd>
|
58 |
-
</dl></dd>
|
59 |
-
</textarea></form>
|
60 |
-
<button type=button onclick="search()">Search</button>
|
61 |
-
<input type=text style="width: 5em" id=query value=indent> or
|
62 |
-
<button type=button onclick="replace()">replace</button> it by
|
63 |
-
<input type=text style="width: 5em" id=replace>
|
64 |
-
|
65 |
-
<script>
|
66 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", lineNumbers: true});
|
67 |
-
|
68 |
-
var lastPos = null, lastQuery = null, marked = [];
|
69 |
-
|
70 |
-
function unmark() {
|
71 |
-
for (var i = 0; i < marked.length; ++i) marked[i].clear();
|
72 |
-
marked.length = 0;
|
73 |
-
}
|
74 |
-
|
75 |
-
function search() {
|
76 |
-
unmark();
|
77 |
-
var text = document.getElementById("query").value;
|
78 |
-
if (!text) return;
|
79 |
-
for (var cursor = editor.getSearchCursor(text); cursor.findNext();)
|
80 |
-
marked.push(editor.markText(cursor.from(), cursor.to(), "searched"));
|
81 |
-
|
82 |
-
if (lastQuery != text) lastPos = null;
|
83 |
-
var cursor = editor.getSearchCursor(text, lastPos || editor.getCursor());
|
84 |
-
if (!cursor.findNext()) {
|
85 |
-
cursor = editor.getSearchCursor(text);
|
86 |
-
if (!cursor.findNext()) return;
|
87 |
-
}
|
88 |
-
editor.setSelection(cursor.from(), cursor.to());
|
89 |
-
lastQuery = text; lastPos = cursor.to();
|
90 |
-
}
|
91 |
-
|
92 |
-
function replace() {
|
93 |
-
unmark();
|
94 |
-
var text = document.getElementById("query").value,
|
95 |
-
replace = document.getElementById("replace").value;
|
96 |
-
if (!text) return;
|
97 |
-
for (var cursor = editor.getSearchCursor(text); cursor.findNext();)
|
98 |
-
cursor.replace(replace);
|
99 |
-
}
|
100 |
-
</script>
|
101 |
-
|
102 |
-
<p>Demonstration of search/replace functionality and marking
|
103 |
-
text.</p>
|
104 |
-
|
105 |
-
</body>
|
106 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/demo/theme.html
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Theme Demo</title>
|
5 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
6 |
-
<script src="../lib/codemirror.js"></script>
|
7 |
-
<link rel="stylesheet" href="../theme/default.css">
|
8 |
-
<link rel="stylesheet" href="../theme/neat.css">
|
9 |
-
<link rel="stylesheet" href="../theme/elegant.css">
|
10 |
-
<link rel="stylesheet" href="../theme/night.css">
|
11 |
-
<link rel="stylesheet" href="../theme/monokai.css">
|
12 |
-
<link rel="stylesheet" href="../theme/cobalt.css">
|
13 |
-
<link rel="stylesheet" href="../theme/eclipse.css">
|
14 |
-
<link rel="stylesheet" href="../theme/rubyblue.css">
|
15 |
-
<script src="../mode/javascript/javascript.js"></script>
|
16 |
-
<link rel="stylesheet" href="../css/docs.css">
|
17 |
-
|
18 |
-
<style type="text/css">
|
19 |
-
.CodeMirror {border: 1px solid black;}
|
20 |
-
</style>
|
21 |
-
</head>
|
22 |
-
<body>
|
23 |
-
<h1>CodeMirror 2: Theme demo</h1>
|
24 |
-
|
25 |
-
<form><textarea id="code" name="code">
|
26 |
-
function findSequence(goal) {
|
27 |
-
function find(start, history) {
|
28 |
-
if (start == goal)
|
29 |
-
return history;
|
30 |
-
else if (start > goal)
|
31 |
-
return null;
|
32 |
-
else
|
33 |
-
return find(start + 5, "(" + history + " + 5)") ||
|
34 |
-
find(start * 3, "(" + history + " * 3)");
|
35 |
-
}
|
36 |
-
return find(1, "1");
|
37 |
-
}</textarea></form>
|
38 |
-
|
39 |
-
<p>Select a theme: <select onchange="selectTheme(this)">
|
40 |
-
<option selected>default</option>
|
41 |
-
<option>night</option>
|
42 |
-
<option>monokai</option>
|
43 |
-
<option>neat</option>
|
44 |
-
<option>elegant</option>
|
45 |
-
<option>cobalt</option>
|
46 |
-
<option>eclipse</option>
|
47 |
-
<option>rubyblue</option>
|
48 |
-
</select>
|
49 |
-
</p>
|
50 |
-
|
51 |
-
<script>
|
52 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
53 |
-
lineNumbers: true
|
54 |
-
});
|
55 |
-
function selectTheme(node) {
|
56 |
-
var theme = node.options[node.selectedIndex].innerHTML;
|
57 |
-
editor.setOption("theme", theme);
|
58 |
-
}
|
59 |
-
</script>
|
60 |
-
</body>
|
61 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/index.html
DELETED
@@ -1,295 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror</title>
|
5 |
-
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
|
6 |
-
<link rel="stylesheet" type="text/css" href="css/docs.css"/>
|
7 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
8 |
-
<link rel="alternate" href="http://twitter.com/statuses/user_timeline/242283288.rss" type="application/rss+xml"/>
|
9 |
-
</head>
|
10 |
-
<body>
|
11 |
-
|
12 |
-
<h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
|
13 |
-
|
14 |
-
<pre class="grey">
|
15 |
-
<img src="css/baboon.png" class="logo" alt="logo"/>/* In-browser code editing
|
16 |
-
made bearable */
|
17 |
-
</pre>
|
18 |
-
|
19 |
-
<div class="clear"><div class="left blk">
|
20 |
-
|
21 |
-
<p style="margin-top: 0">CodeMirror is a JavaScript library that can
|
22 |
-
be used to create a relatively pleasant editor interface for
|
23 |
-
code-like content ― computer programs, HTML markup, and
|
24 |
-
similar. If a mode has been written for the language you are
|
25 |
-
editing, the code will be coloured, and the editor will optionally
|
26 |
-
help you with indentation.</p>
|
27 |
-
|
28 |
-
<p>This is the project page for CodeMirror 2, the currently more
|
29 |
-
actively developed, and recommended
|
30 |
-
version. <a href="1/index.html">CodeMirror 1</a> is still available
|
31 |
-
from here.</p>
|
32 |
-
|
33 |
-
<div class="clear"><div class="left1 blk">
|
34 |
-
|
35 |
-
<h2 style="margin-top: 0">Supported modes:</h2>
|
36 |
-
|
37 |
-
<ul>
|
38 |
-
<li><a href="mode/clike/index.html">C, Java, C#, and similar</a></li>
|
39 |
-
<li><a href="mode/clojure/index.html">Clojure</a></li>
|
40 |
-
<li><a href="mode/coffeescript/index.html">CoffeeScript</a></li>
|
41 |
-
<li><a href="mode/css/index.html">CSS</a></li>
|
42 |
-
<li><a href="mode/diff/index.html">diff</a></li>
|
43 |
-
<li><a href="mode/groovy/index.html">Groovy</a></li>
|
44 |
-
<li><a href="mode/haskell/index.html">Haskell</a></li>
|
45 |
-
<li><a href="mode/htmlmixed/index.html">HTML mixed-mode</a></li>
|
46 |
-
<li><a href="mode/javascript/index.html">JavaScript</a></li>
|
47 |
-
<li><a href="mode/jinja2/index.html">Jinja2</a></li>
|
48 |
-
<li><a href="mode/lua/index.html">Lua</a></li>
|
49 |
-
<li><a href="mode/markdown/index.html">Markdown</a> (<a href="mode/gfm/index.html">Github-flavour</a>)</li>
|
50 |
-
<li><a href="mode/ntriples/index.html">NTriples</a></li>
|
51 |
-
<li><a href="mode/pascal/index.html">Pascal</a></li>
|
52 |
-
<li><a href="mode/perl/index.html">Perl</a></li>
|
53 |
-
<li><a href="mode/php/index.html">PHP</a></li>
|
54 |
-
<li><a href="mode/plsql/index.html">PL/SQL</a></li>
|
55 |
-
<li><a href="mode/python/index.html">Python</a></li>
|
56 |
-
<li><a href="mode/r/index.html">R</a></li>
|
57 |
-
<li>RPM <a href="mode/rpm/spec/index.html">spec</a> and <a href="mode/rpm/changes/index.html">changelog</a></li>
|
58 |
-
<li><a href="mode/rst/index.html">reStructuredText</a></li>
|
59 |
-
<li><a href="mode/ruby/index.html">Ruby</a></li>
|
60 |
-
<li><a href="mode/rust/index.html">Rust</a></li>
|
61 |
-
<li><a href="mode/scheme/index.html">Scheme</a></li>
|
62 |
-
<li><a href="mode/smalltalk/index.html">Smalltalk</a></li>
|
63 |
-
<li><a href="mode/sparql/index.html">SPARQL</a></li>
|
64 |
-
<li><a href="mode/stex/index.html">sTeX, LaTeX</a></li>
|
65 |
-
<li><a href="mode/tiddlywiki/index.html">Tiddlywiki</a></li>
|
66 |
-
<li><a href="mode/velocity/index.html">Velocity</a></li>
|
67 |
-
<li><a href="mode/xml/index.html">XML/HTML</a> (<a href="mode/xmlpure/index.html">alternative XML</a>)</li>
|
68 |
-
<li><a href="mode/yaml/index.html">YAML</a></li>
|
69 |
-
</ul>
|
70 |
-
|
71 |
-
</div><div class="left2 blk">
|
72 |
-
|
73 |
-
<h2 style="margin-top: 0">Usage demos:</h2>
|
74 |
-
|
75 |
-
<ul>
|
76 |
-
<li><a href="demo/complete.html">Autocompletion</a></li>
|
77 |
-
<li><a href="demo/mustache.html">Mode overlays</a></li>
|
78 |
-
<li><a href="demo/search.html">Search/replace</a></li>
|
79 |
-
<li><a href="demo/folding.html">Code folding</a></li>
|
80 |
-
<li><a href="demo/preview.html">HTML editor with preview</a></li>
|
81 |
-
<li><a href="demo/resize.html">Auto-resizing editor</a></li>
|
82 |
-
<li><a href="demo/marker.html">Setting breakpoints</a></li>
|
83 |
-
<li><a href="demo/activeline.html">Highlighting the current line</a></li>
|
84 |
-
<li><a href="demo/theme.html">Theming</a></li>
|
85 |
-
<li><a href="demo/runmode.html">Stand-alone highlighting</a></li>
|
86 |
-
<li><a href="demo/fullscreen.html">Full-screen editing</a></li>
|
87 |
-
<li><a href="demo/changemode.html">Mode auto-changing</a></li>
|
88 |
-
</ul>
|
89 |
-
|
90 |
-
</div></div>
|
91 |
-
|
92 |
-
<h2 id="code">Getting the code</h2>
|
93 |
-
|
94 |
-
<p>All of CodeMirror is released under a <a
|
95 |
-
href="LICENSE">MIT-style</a> license. To get it, you can download
|
96 |
-
the <a href="http://codemirror.net/codemirror.zip">latest
|
97 |
-
release</a> or the current <a
|
98 |
-
href="http://codemirror.net/codemirror2-latest.zip">development
|
99 |
-
snapshot</a> as zip files. To create a custom minified script file,
|
100 |
-
you can use the <a href="compress.html">compression API</a>.</p>
|
101 |
-
|
102 |
-
<p>We use <a href="http://git-scm.com/">git</a> for version control.
|
103 |
-
The main repository can be fetched in this way:</p>
|
104 |
-
|
105 |
-
<pre class="code">git clone http://marijnhaverbeke.nl/git/codemirror2</pre>
|
106 |
-
|
107 |
-
<p>CodeMirror can also be found on GitHub at <a
|
108 |
-
href="http://github.com/marijnh/CodeMirror2">marijnh/CodeMirror2</a>.
|
109 |
-
If you plan to hack on the code and contribute patches, the best way
|
110 |
-
to do it is to create a GitHub fork, and send pull requests.</p>
|
111 |
-
|
112 |
-
<h2 id="documention">Documentation</h2>
|
113 |
-
|
114 |
-
<p>The <a href="manual.html">manual</a> is your first stop for
|
115 |
-
learning how to use this library. It starts with a quick explanation
|
116 |
-
of how to use the editor, and then describes all of the (many)
|
117 |
-
options and methods that CodeMirror exposes.</p>
|
118 |
-
|
119 |
-
<p>For those who want to learn more about the code, there is
|
120 |
-
an <a href="internals.html">overview of the internals</a> available.
|
121 |
-
The <a href="http://github.com/marijnh/CodeMirror2">source code</a>
|
122 |
-
itself is, for the most part, also well commented.</p>
|
123 |
-
|
124 |
-
<h2 id="support">Support and bug reports</h2>
|
125 |
-
|
126 |
-
<p>There is
|
127 |
-
a <a href="http://groups.google.com/group/codemirror">Google
|
128 |
-
group</a> (a sort of mailing list/newsgroup thing) for discussion
|
129 |
-
and news related to CodeMirror. Reporting bugs is best done
|
130 |
-
on <a href="http://github.com/marijnh/CodeMirror2/issues">github</a>.
|
131 |
-
You can also e-mail me
|
132 |
-
directly: <a href="mailto:marijnh@gmail.com">Marijn
|
133 |
-
Haverbeke</a>.</p>
|
134 |
-
|
135 |
-
<h2 id="supported">Supported browsers</h2>
|
136 |
-
|
137 |
-
<p>The following browsers are able to run CodeMirror:</p>
|
138 |
-
|
139 |
-
<ul>
|
140 |
-
<li>Firefox 2 or higher</li>
|
141 |
-
<li>Chrome, any version</li>
|
142 |
-
<li>Safari 3 or higher</li>
|
143 |
-
<li>Internet Explorer 6 or higher</li>
|
144 |
-
<li>Opera 9 or higher (with some key-handling problems on OS X)</li>
|
145 |
-
</ul>
|
146 |
-
|
147 |
-
<p>I am not actively testing against every new browser release, and
|
148 |
-
vendors have a habit of introducing bugs all the time, so I am
|
149 |
-
relying on the community to tell me when something breaks.
|
150 |
-
See <a href="#support">here</a> for information on how to contact
|
151 |
-
me.</p>
|
152 |
-
|
153 |
-
</div>
|
154 |
-
|
155 |
-
<div class="right blk">
|
156 |
-
|
157 |
-
<a href="http://codemirror.net/codemirror.zip" class="download">Download the latest release</a>
|
158 |
-
|
159 |
-
<h2>Make a donation</h2>
|
160 |
-
|
161 |
-
<ul>
|
162 |
-
<li><span onclick="document.getElementById('paypal').submit();" class="quasilink">Paypal</span></li>
|
163 |
-
<li><span onclick="document.getElementById('bankinfo').style.display = 'block';" class="quasilink">Bank</span></li>
|
164 |
-
</ul>
|
165 |
-
|
166 |
-
<p id="bankinfo" style="display: none;">
|
167 |
-
Bank: <i>Rabobank</i><br/>
|
168 |
-
Country: <i>Netherlands</i><br/>
|
169 |
-
SWIFT: <i>RABONL2U</i><br/>
|
170 |
-
Account: <i>147850770</i><br/>
|
171 |
-
Name: <i>Marijn Haverbeke</i><br/>
|
172 |
-
IBAN: <i>NL26 RABO 0147 8507 70</i>
|
173 |
-
</p>
|
174 |
-
|
175 |
-
<h2>Releases:</h2>
|
176 |
-
|
177 |
-
<p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.18.zip">Version 2.18</a>:</p>
|
178 |
-
<p class="rel-note">Fixes <code>TextMarker.clear</code>, which is broken in 2.17.</p>
|
179 |
-
|
180 |
-
<p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.17.zip">Version 2.17</a>:</p>
|
181 |
-
<ul class="rel-note">
|
182 |
-
<li>Add support for <a href="manual.html#option_lineWrapping">line
|
183 |
-
wrapping</a> and <a href="manual.html#hideLine">code
|
184 |
-
folding</a>.</li>
|
185 |
-
<li>Add <a href="mode/gfm/index.html">Github-style Markdown</a> mode.</li>
|
186 |
-
<li>Add <a href="theme/monokai.css">Monokai</a>
|
187 |
-
and <a href="theme/rubyblue.css">Rubyblue</a> themes.</li>
|
188 |
-
<li>Add <a href="manual.html#setBookmark"><code>setBookmark</code></a> method.</li>
|
189 |
-
<li>Move some of the demo code into reusable components
|
190 |
-
under <a href="lib/util/"><code>lib/util</code></a>.</li>
|
191 |
-
<li>Make screen-coord-finding code faster and more reliable.</li>
|
192 |
-
<li>Fix drag-and-drop in Firefox.</li>
|
193 |
-
<li>Improve support for IME.</li>
|
194 |
-
<li>Speed up content rendering.</li>
|
195 |
-
<li>Fix browser's built-in search in Webkit.</li>
|
196 |
-
<li>Make double- and triple-click work in IE.</li>
|
197 |
-
<li>Various fixes to modes.</li>
|
198 |
-
</ul>
|
199 |
-
|
200 |
-
<p class="rel">27-10-2011: <a href="http://codemirror.net/codemirror-2.16.zip">Version 2.16</a>:</p>
|
201 |
-
<ul class="rel-note">
|
202 |
-
<li>Add <a href="mode/perl/index.html">Perl</a>, <a href="mode/rust/index.html">Rust</a>, <a href="mode/tiddlywiki/index.html">TiddlyWiki</a>, and <a href="mode/groovy/index.html">Groovy</a> modes.</li>
|
203 |
-
<li>Dragging text inside the editor now moves, rather than copies.</li>
|
204 |
-
<li>Add a <a href="manual.html#coordsFromIndex"><code>coordsFromIndex</code></a> method.</li>
|
205 |
-
<li><strong>API change</strong>: <code>setValue</code> now no longer clears history. Use <a href="manual.html#clearHistory"><code>clearHistory</code></a> for that.</li>
|
206 |
-
<li><strong>API change</strong>: <a href="manual.html#markText"><code>markText</code></a> now
|
207 |
-
returns an object with <code>clear</code> and <code>find</code>
|
208 |
-
methods. Marked text is now more robust when edited.</li>
|
209 |
-
<li>Fix editing code with tabs in Internet Explorer.</li>
|
210 |
-
</ul>
|
211 |
-
|
212 |
-
<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.15.zip">Version 2.15</a>:</p>
|
213 |
-
<p class="rel-note">Fix bug that snuck into 2.14: Clicking the
|
214 |
-
character that currently has the cursor didn't re-focus the
|
215 |
-
editor.</p>
|
216 |
-
|
217 |
-
<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.14.zip">Version 2.14</a>:</p>
|
218 |
-
<ul class="rel-note">
|
219 |
-
<li>Add <a href="mode/clojure/index.html">Clojure</a>, <a href="mode/pascal/index.html">Pascal</a>, <a href="mode/ntriples/index.html">NTriples</a>, <a href="mode/jinja2/index.html">Jinja2</a>, and <a href="mode/markdown/index.html">Markdown</a> modes.</li>
|
220 |
-
<li>Add <a href="theme/cobalt.css">Cobalt</a> and <a href="theme/eclipse.css">Eclipse</a> themes.</li>
|
221 |
-
<li>Add a <a href="manual.html#option_fixedGutter"><code>fixedGutter</code></a> option.</li>
|
222 |
-
<li>Fix bug with <code>setValue</code> breaking cursor movement.</li>
|
223 |
-
<li>Make gutter updates much more efficient.</li>
|
224 |
-
<li>Allow dragging of text out of the editor (on modern browsers).</li>
|
225 |
-
</ul>
|
226 |
-
|
227 |
-
<p class="rel">23-08-2011: <a href="http://codemirror.net/codemirror-2.13.zip">Version 2.13</a>:</p>
|
228 |
-
<ul class="rel-note">
|
229 |
-
<li>Add <a href="mode/ruby/index.html">Ruby</a>, <a href="mode/r/index.html">R</a>, <a href="mode/coffeescript/index.html">CoffeeScript</a>, and <a href="mode/velocity/index.html">Velocity</a> modes.</li>
|
230 |
-
<li>Add <a href="manual.html#getGutterElement"><code>getGutterElement</code></a> to API.</li>
|
231 |
-
<li>Several fixes to scrolling and positioning.</li>
|
232 |
-
<li>Add <a href="manual.html#option_smartHome"><code>smartHome</code></a> option.</li>
|
233 |
-
<li>Add an experimental <a href="mode/xmlpure/index.html">pure XML</a> mode.</li>
|
234 |
-
</ul>
|
235 |
-
|
236 |
-
<p class="rel">25-07-2011: <a href="http://codemirror.net/codemirror-2.12.zip">Version 2.12</a>:</p>
|
237 |
-
<ul class="rel-note">
|
238 |
-
<li>Add a <a href="mode/sparql/index.html">SPARQL</a> mode.</li>
|
239 |
-
<li>Fix bug with cursor jumping around in an unfocused editor in IE.</li>
|
240 |
-
<li>Allow key and mouse events to bubble out of the editor. Ignore widget clicks.</li>
|
241 |
-
<li>Solve cursor flakiness after undo/redo.</li>
|
242 |
-
<li>Fix block-reindent ignoring the last few lines.</li>
|
243 |
-
<li>Fix parsing of multi-line attrs in XML mode.</li>
|
244 |
-
<li>Use <code>innerHTML</code> for HTML-escaping.</li>
|
245 |
-
<li>Some fixes to indentation in C-like mode.</li>
|
246 |
-
<li>Shrink horiz scrollbars when long lines removed.</li>
|
247 |
-
<li>Fix width feedback loop bug that caused the width of an inner DIV to shrink.</li>
|
248 |
-
</ul>
|
249 |
-
|
250 |
-
<p class="rel">04-07-2011: <a href="http://codemirror.net/codemirror-2.11.zip">Version 2.11</a>:</p>
|
251 |
-
<ul class="rel-note">
|
252 |
-
<li>Add a <a href="mode/scheme/index.html">Scheme mode</a>.</li>
|
253 |
-
<li>Add a <code>replace</code> method to search cursors, for cursor-preserving replacements.</li>
|
254 |
-
<li>Make the <a href="mode/clike/index.html">C-like mode</a> mode more customizeable.</li>
|
255 |
-
<li>Update XML mode to spot mismatched tags.</li>
|
256 |
-
<li>Add <code>getStateAfter</code> API and <code>compareState</code> mode API methods for finer-grained mode magic.</li>
|
257 |
-
<li>Add a <code>getScrollerElement</code> API method to manipulate the scrolling DIV.</li>
|
258 |
-
<li>Fix drag-and-drop for Firefox.</li>
|
259 |
-
<li>Add a C# configuration for the <a href="mode/clike/index.html">C-like mode</a>.</li>
|
260 |
-
<li>Add <a href="demo/fullscreen.html">full-screen editing</a> and <a href="demo/changemode.html">mode-changing</a> demos.</li>
|
261 |
-
</ul>
|
262 |
-
|
263 |
-
<p class="rel">07-06-2011: <a href="http://codemirror.net/codemirror-2.1.zip">Version 2.1</a>:</p>
|
264 |
-
<p class="rel-note">Add
|
265 |
-
a <a href="manual.html#option_theme">theme</a> system
|
266 |
-
(<a href="demo/theme.html">demo</a>). Note that this is not
|
267 |
-
backwards-compatible—you'll have to update your styles and
|
268 |
-
modes!</p>
|
269 |
-
|
270 |
-
<p class="rel">07-06-2011: <a href="http://codemirror.net/codemirror-2.02.zip">Version 2.02</a>:</p>
|
271 |
-
<ul class="rel-note">
|
272 |
-
<li>Add a <a href="mode/lua/index.html">Lua mode</a>.</li>
|
273 |
-
<li>Fix reverse-searching for a regexp.</li>
|
274 |
-
<li>Empty lines can no longer break highlighting.</li>
|
275 |
-
<li>Rework scrolling model (the outer wrapper no longer does the scrolling).</li>
|
276 |
-
<li>Solve horizontal jittering on long lines.</li>
|
277 |
-
<li>Add <a href="demo/runmode.html">runmode.js</a>.</li>
|
278 |
-
<li>Immediately re-highlight text when typing.</li>
|
279 |
-
<li>Fix problem with 'sticking' horizontal scrollbar.</li>
|
280 |
-
</ul>
|
281 |
-
|
282 |
-
<p><a href="oldrelease.html">Older releases...</a></p>
|
283 |
-
|
284 |
-
</div></div>
|
285 |
-
|
286 |
-
<div style="height: 2em"> </div>
|
287 |
-
|
288 |
-
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal">
|
289 |
-
<input type="hidden" name="cmd" value="_s-xclick"/>
|
290 |
-
<input type="hidden" name="hosted_button_id" value="3FVHS5FGUY7CC"/>
|
291 |
-
</form>
|
292 |
-
|
293 |
-
</body>
|
294 |
-
</html>
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/internals.html
DELETED
@@ -1,383 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror: Internals</title>
|
5 |
-
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
|
6 |
-
<link rel="stylesheet" type="text/css" href="css/docs.css"/>
|
7 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
8 |
-
<style>dl dl {margin: 0;}</style>
|
9 |
-
</head>
|
10 |
-
<body>
|
11 |
-
|
12 |
-
<h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
|
13 |
-
|
14 |
-
<pre class="grey">
|
15 |
-
<img src="css/baboon.png" class="logo" alt="logo"/>/* (Re-) Implementing A Syntax-
|
16 |
-
Highlighting Editor in JavaScript */
|
17 |
-
</pre>
|
18 |
-
|
19 |
-
<div class="clear"><div class="leftbig blk">
|
20 |
-
|
21 |
-
<p style="font-size: 85%" id="intro">
|
22 |
-
<strong>Topic:</strong> JavaScript, code editor implementation<br>
|
23 |
-
<strong>Author:</strong> Marijn Haverbeke<br>
|
24 |
-
<strong>Date:</strong> March 2nd 2011
|
25 |
-
</p>
|
26 |
-
|
27 |
-
<p>This is a followup to
|
28 |
-
my <a href="http://codemirror.net/story.html">Brutal Odyssey to the
|
29 |
-
Dark Side of the DOM Tree</a> story. That one describes the
|
30 |
-
mind-bending process of implementing (what would become) CodeMirror 1.
|
31 |
-
This one describes the internals of CodeMirror 2, a complete rewrite
|
32 |
-
and rethink of the old code base. I wanted to give this piece another
|
33 |
-
Hunter Thompson copycat subtitle, but somehow that would be out of
|
34 |
-
place—the process this time around was one of straightforward
|
35 |
-
engineering, requiring no serious mind-bending whatsoever.</p>
|
36 |
-
|
37 |
-
<p>So, what is wrong with CodeMirror 1? I'd estimate, by mailing list
|
38 |
-
activity and general search-engine presence, that it has been
|
39 |
-
integrated into about a thousand systems by now. The most prominent
|
40 |
-
one, since a few weeks,
|
41 |
-
being <a href="http://googlecode.blogspot.com/2011/01/make-quick-fixes-quicker-on-google.html">Google
|
42 |
-
code's project hosting</a>. It works, and it's being used widely.</a>
|
43 |
-
|
44 |
-
<p>Still, I did not start replacing it because I was bored. CodeMirror
|
45 |
-
1 was heavily reliant on <code>designMode</code>
|
46 |
-
or <code>contentEditable</code> (depending on the browser). Neither of
|
47 |
-
these are well specified (HTML5 tries
|
48 |
-
to <a href="http://www.w3.org/TR/html5/editing.html#contenteditable">specify</a>
|
49 |
-
their basics), and, more importantly, they tend to be one of the more
|
50 |
-
obscure and buggy areas of browser functionality—CodeMirror, by using
|
51 |
-
this functionality in a non-typical way, was constantly running up
|
52 |
-
against browser bugs. WebKit wouldn't show an empty line at the end of
|
53 |
-
the document, and in some releases would suddenly get unbearably slow.
|
54 |
-
Firefox would show the cursor in the wrong place. Internet Explorer
|
55 |
-
would insist on linkifying everything that looked like a URL or email
|
56 |
-
address, a behaviour that can't be turned off. Some bugs I managed to
|
57 |
-
work around (which was often a frustrating, painful process), others,
|
58 |
-
such as the Firefox cursor placement, I gave up on, and had to tell
|
59 |
-
user after user that they were known problems, but not something I
|
60 |
-
could help.</p>
|
61 |
-
|
62 |
-
<p>Also, there is the fact that <code>designMode</code> (which seemed
|
63 |
-
to be less buggy than <code>contentEditable</code> in Webkit and
|
64 |
-
Firefox, and was thus used by CodeMirror 1 in those browsers) requires
|
65 |
-
a frame. Frames are another tricky area. It takes some effort to
|
66 |
-
prevent getting tripped up by domain restrictions, they don't
|
67 |
-
initialize synchronously, behave strangely in response to the back
|
68 |
-
button, and, on several browsers, can't be moved around the DOM
|
69 |
-
without having them re-initialize. They did provide a very nice way to
|
70 |
-
namespace the library, though—CodeMirror 1 could freely pollute the
|
71 |
-
namespace inside the frame.</p>
|
72 |
-
|
73 |
-
<p>Finally, working with an editable document means working with
|
74 |
-
selection in arbitrary DOM structures. Internet Explorer (8 and
|
75 |
-
before) has an utterly different (and awkward) selection API than all
|
76 |
-
of the other browsers, and even among the different implementations of
|
77 |
-
<code>document.selection</code>, details about how exactly a selection
|
78 |
-
is represented vary quite a bit. Add to that the fact that Opera's
|
79 |
-
selection support tended to be very buggy until recently, and you can
|
80 |
-
imagine why CodeMirror 1 contains 700 lines of selection-handling
|
81 |
-
code.</p>
|
82 |
-
|
83 |
-
<p>And that brings us to the main issue with the CodeMirror 1
|
84 |
-
code base: The proportion of browser-bug-workarounds to real
|
85 |
-
application code was getting dangerously high. By building on top of a
|
86 |
-
few dodgy features, I put the system in a vulnerable position—any
|
87 |
-
incompatibility and bugginess in these features, I had to paper over
|
88 |
-
with my own code. Not only did I have to do some serious stunt-work to
|
89 |
-
get it to work on older browsers (as detailed in the
|
90 |
-
previous <a href="http://codemirror.net/story.html">story</a>), things
|
91 |
-
also kept breaking in newly released versions, requiring me to come up
|
92 |
-
with <em>new</em> scary hacks in order to keep up. This was starting
|
93 |
-
to lose its appeal.</p>
|
94 |
-
|
95 |
-
<h2 id="approach">General Approach</h2>
|
96 |
-
|
97 |
-
<p>What CodeMirror 2 does is try to sidestep most of the hairy hacks
|
98 |
-
that came up in version 1. I owe a lot to the
|
99 |
-
<a href="http://ace.ajax.org">ACE</a> editor for inspiration on how to
|
100 |
-
approach this.</p>
|
101 |
-
|
102 |
-
<p>I absolutely did not want to be completely reliant on key events to
|
103 |
-
generate my input. Every JavaScript programmer knows that key event
|
104 |
-
information is horrible and incomplete. Some people (most awesomely
|
105 |
-
Mihai Bazon with <a href="http://ymacs.org">Ymacs</a>) have been able
|
106 |
-
to build more or less functioning editors by directly reading key
|
107 |
-
events, but it takes a lot of work (the kind of never-ending, fragile
|
108 |
-
work I described earlier), and will never be able to properly support
|
109 |
-
things like multi-keystoke international character input.</p>
|
110 |
-
|
111 |
-
<p>So what I do is focus a hidden textarea, and let the browser
|
112 |
-
believe that the user is typing into that. What we show to the user is
|
113 |
-
a DOM structure we built to represent his document. If this is updated
|
114 |
-
quickly enough, and shows some kind of believable cursor, it feels
|
115 |
-
like a real text-input control.</p>
|
116 |
-
|
117 |
-
<p>Another big win is that this DOM representation does not have to
|
118 |
-
span the whole document. Some CodeMirror 1 users insisted that they
|
119 |
-
needed to put a 30 thousand line XML document into CodeMirror. Putting
|
120 |
-
all that into the DOM takes a while, especially since, for some
|
121 |
-
reason, an editable DOM tree is slower than a normal one on most
|
122 |
-
browsers. If we have full control over what we show, we must only
|
123 |
-
ensure that the visible part of the document has been added, and can
|
124 |
-
do the rest only when needed. (Fortunately, the <code>onscroll</code>
|
125 |
-
event works almost the same on all browsers, and lends itself well to
|
126 |
-
displaying things only as they are scrolled into view.)</p>
|
127 |
-
|
128 |
-
<h2 id="input">Input</h2>
|
129 |
-
|
130 |
-
<p>ACE uses its hidden textarea only as a text input shim, and does
|
131 |
-
all cursor movement and things like text deletion itself by directly
|
132 |
-
handling key events. CodeMirror's way is to let the browser do its
|
133 |
-
thing as much as possible, and not, for example, define its own set of
|
134 |
-
key bindings. One way to do this would have been to have the whole
|
135 |
-
document inside the hidden textarea, and after each key event update
|
136 |
-
the display DOM to reflect what's in that textarea.</p>
|
137 |
-
|
138 |
-
<p>That'd be simple, but it is not realistic. For even medium-sized
|
139 |
-
document the editor would be constantly munging huge strings, and get
|
140 |
-
terribly slow. What CodeMirror 2 does is put the current selection,
|
141 |
-
along with an extra line on the top and on the bottom, into the
|
142 |
-
textarea.</p>
|
143 |
-
|
144 |
-
<p>This means that the arrow keys (and their ctrl-variations), home,
|
145 |
-
end, etcetera, do not have to be handled specially. We just read the
|
146 |
-
cursor position in the textarea, and update our cursor to match it.
|
147 |
-
Also, copy and paste work pretty much for free, and people get their
|
148 |
-
native key bindings, without any special work on my part. For example,
|
149 |
-
I have emacs key bindings configured for Chrome and Firefox. There is
|
150 |
-
no way for a script to detect this.</p>
|
151 |
-
|
152 |
-
<p>Of course, since only a small part of the document sits in the
|
153 |
-
textarea, keys like page up and ctrl-end won't do the right thing.
|
154 |
-
CodeMirror is catching those events and handling them itself.</p>
|
155 |
-
|
156 |
-
<h2 id="selection">Selection</h2>
|
157 |
-
|
158 |
-
<p>Getting and setting the selection range of a textarea in modern
|
159 |
-
browsers is trivial—you just use the <code>selectionStart</code>
|
160 |
-
and <code>selectionEnd</code> properties. On IE you have to do some
|
161 |
-
insane stuff with temporary ranges and compensating for the fact that
|
162 |
-
moving the selection by a 'character' will treat \r\n as a single
|
163 |
-
character, but even there it is possible to build functions that
|
164 |
-
reliably set and get the selection range.</p>
|
165 |
-
|
166 |
-
<p>But consider this typical case: When I'm somewhere in my document,
|
167 |
-
press shift, and press the up arrow, something gets selected. Then, if
|
168 |
-
I, still holding shift, press the up arrow again, the top of my
|
169 |
-
selection is adjusted. The selection remembers where its <em>head</em>
|
170 |
-
and its <em>anchor</em> are, and moves the head when we shift-move.
|
171 |
-
This is a generally accepted property of selections, and done right by
|
172 |
-
every editing component built in the past twenty years.</p>
|
173 |
-
|
174 |
-
<p>But not something that the browser selection APIs expose.</p>
|
175 |
-
|
176 |
-
<p>Great. So when someone creates an 'upside-down' selection, the next
|
177 |
-
time CodeMirror has to update the textarea, it'll re-create the
|
178 |
-
selection as an 'upside-up' selection, with the anchor at the top, and
|
179 |
-
the next cursor motion will behave in an unexpected way—our second
|
180 |
-
up-arrow press in the example above will not do anything, since it is
|
181 |
-
interpreted in exactly the same way as the first.</p>
|
182 |
-
|
183 |
-
<p>No problem. We'll just, ehm, detect that the selection is
|
184 |
-
upside-down (you can tell by the way it was created), and then, when
|
185 |
-
an upside-down selection is present, and a cursor-moving key is
|
186 |
-
pressed in combination with shift, we quickly collapse the selection
|
187 |
-
in the textarea to its start, allow the key to take effect, and then
|
188 |
-
combine its new head with its old anchor to get the <em>real</em>
|
189 |
-
selection.</p>
|
190 |
-
|
191 |
-
<p>In short, scary hacks could not be avoided entirely in CodeMirror
|
192 |
-
2.</p>
|
193 |
-
|
194 |
-
<p>And, the observant reader might ask, how do you even know that a
|
195 |
-
key combo is a cursor-moving combo, if you claim you support any
|
196 |
-
native key bindings? Well, we don't, but we can learn. The editor
|
197 |
-
keeps a set known cursor-movement combos (initialized to the
|
198 |
-
predictable defaults), and updates this set when it observes that
|
199 |
-
pressing a certain key had (only) the effect of moving the cursor.
|
200 |
-
This, of course, doesn't work if the first time the key is used was
|
201 |
-
for extending an inverted selection, but it works most of the
|
202 |
-
time.</p>
|
203 |
-
|
204 |
-
<h2 id="update">Intelligent Updating</h2>
|
205 |
-
|
206 |
-
<p>One thing that always comes up when you have a complicated internal
|
207 |
-
state that's reflected in some user-visible external representation
|
208 |
-
(in this case, the displayed code and the textarea's content) is
|
209 |
-
keeping the two in sync. The naive way is to just update the display
|
210 |
-
every time you change your state, but this is not only error prone
|
211 |
-
(you'll forget), it also easily leads to duplicate work on big,
|
212 |
-
composite operations. Then you start passing around flags indicating
|
213 |
-
whether the display should be updated in an attempt to be efficient
|
214 |
-
again and, well, at that point you might as well give up completely.</p>
|
215 |
-
|
216 |
-
<p>I did go down that road, but then switched to a much simpler model:
|
217 |
-
simply keep track of all the things that have been changed during an
|
218 |
-
action, and then, only at the end, use this information to update the
|
219 |
-
user-visible display.</p>
|
220 |
-
|
221 |
-
<p>CodeMirror uses a concept of <em>operations</em>, which start by
|
222 |
-
calling a specific set-up function that clears the state and end by
|
223 |
-
calling another function that reads this state and does the required
|
224 |
-
updating. Most event handlers, and all the user-visible methods that
|
225 |
-
change state are wrapped like this. There's a method
|
226 |
-
called <code>operation</code> that accepts a function, and returns
|
227 |
-
another function that wraps the given function as an operation.</p>
|
228 |
-
|
229 |
-
<p>It's trivial to extend this (as CodeMirror does) to detect nesting,
|
230 |
-
and, when an operation is started inside an operation, simply
|
231 |
-
increment the nesting count, and only do the updating when this count
|
232 |
-
reaches zero again.</p>
|
233 |
-
|
234 |
-
<p>If we have a set of changed ranges and know the currently shown
|
235 |
-
range, we can (with some awkward code to deal with the fact that
|
236 |
-
changes can add and remove lines, so we're dealing with a changing
|
237 |
-
coordinate system) construct a map of the ranges that were left
|
238 |
-
intact. We can then compare this map with the part of the document
|
239 |
-
that's currently visible (based on scroll offset and editor height) to
|
240 |
-
determine whether something needs to be updated.</p>
|
241 |
-
|
242 |
-
<p>CodeMirror uses two update algorithms—a full refresh, where it just
|
243 |
-
discards the whole part of the DOM that contains the edited text and
|
244 |
-
rebuilds it, and a patch algorithm, where it uses the information
|
245 |
-
about changed and intact ranges to update only the out-of-date parts
|
246 |
-
of the DOM. When more than 30 percent (which is the current heuristic,
|
247 |
-
might change) of the lines need to be updated, the full refresh is
|
248 |
-
chosen (since it's faster to do than painstakingly finding and
|
249 |
-
updating all the changed lines), in the other case it does the
|
250 |
-
patching (so that, if you scroll a line or select another character,
|
251 |
-
the whole screen doesn't have to be re-rendered).</p>
|
252 |
-
|
253 |
-
<p>All updating uses <code>innerHTML</code> rather than direct DOM
|
254 |
-
manipulation, since that still seems to be by far the fastest way to
|
255 |
-
build documents. There's a per-line function that combines the
|
256 |
-
highlighting, <a href="manual.html#markText">marking</a>, and
|
257 |
-
selection info for that line into a snippet of HTML. The patch updater
|
258 |
-
uses this to reset individual lines, the refresh updater builds an
|
259 |
-
HTML chunk for the whole visible document at once, and then uses a
|
260 |
-
single <code>innerHTML</code> update to do the refresh.</p>
|
261 |
-
|
262 |
-
<h2 id="parse">Parsers can be Simple</h2>
|
263 |
-
|
264 |
-
<p>When I wrote CodeMirror 1, I
|
265 |
-
thought <a href="http://codemirror.net/story.html#parser">interruptable
|
266 |
-
parsers</a> were a hugely scary and complicated thing, and I used a
|
267 |
-
bunch of heavyweight abstractions to keep this supposed complexity
|
268 |
-
under control: parsers
|
269 |
-
were <a href="http://bob.pythonmac.org/archives/2005/07/06/iteration-in-javascript/">iterators</a>
|
270 |
-
that consumed input from another iterator, and used funny
|
271 |
-
closure-resetting tricks to copy and resume themselves.</p>
|
272 |
-
|
273 |
-
<p>This made for a rather nice system, in that parsers formed strictly
|
274 |
-
separate modules, and could be composed in predictable ways.
|
275 |
-
Unfortunately, it was quite slow (stacking three or four iterators on
|
276 |
-
top of each other), and extremely intimidating to people not used to a
|
277 |
-
functional programming style.</p>
|
278 |
-
|
279 |
-
<p>With a few small changes, however, we can keep all those
|
280 |
-
advantages, but simplify the API and make the whole thing less
|
281 |
-
indirect and inefficient. CodeMirror
|
282 |
-
2's <a href="manual.html#modeapi">mode API</a> uses explicit state
|
283 |
-
objects, and makes the parser/tokenizer a function that simply takes a
|
284 |
-
state and a character stream abstraction, advances the stream one
|
285 |
-
token, and returns the way the token should be styled. This state may
|
286 |
-
be copied, optionally in a mode-defined way, in order to be able to
|
287 |
-
continue a parse at a given point. Even someone who's never touched a
|
288 |
-
lambda in his life can understand this approach. Additionally, far
|
289 |
-
fewer objects are allocated in the course of parsing now.</p>
|
290 |
-
|
291 |
-
<p>The biggest speedup comes from the fact that the parsing no longer
|
292 |
-
has to touch the DOM though. In CodeMirror 1, on an older browser, you
|
293 |
-
could <em>see</em> the parser work its way through the document,
|
294 |
-
managing some twenty lines in each 50-millisecond time slice it got. It
|
295 |
-
was reading its input from the DOM, and updating the DOM as it went
|
296 |
-
along, which any experienced JavaScript programmer will immediately
|
297 |
-
spot as a recipe for slowness. In CodeMirror 2, the parser usually
|
298 |
-
finishes the whole document in a single 100-millisecond time slice—it
|
299 |
-
manages some 1500 lines during that time on Chrome. All it has to do
|
300 |
-
is munge strings, so there is no real reason for it to be slow
|
301 |
-
anymore.</p>
|
302 |
-
|
303 |
-
<h2 id="summary">What Gives?</h2>
|
304 |
-
|
305 |
-
<p>Given all this, what can you expect from CodeMirror 2? First, the
|
306 |
-
good:</p>
|
307 |
-
|
308 |
-
<ul>
|
309 |
-
|
310 |
-
<li><strong>Small.</strong> the base library is some 32k when minified
|
311 |
-
now, 12k when gzipped. It's smaller than its own logo.</li>
|
312 |
-
|
313 |
-
<li><strong>Lightweight.</strong> CodeMirror 2 initializes very
|
314 |
-
quickly, and does almost no work when it is not focused. This means
|
315 |
-
you can treat it almost like a textarea, have multiple instances on a
|
316 |
-
page without trouble.</li>
|
317 |
-
|
318 |
-
<li><strong>Huge document support.</strong> Since highlighting is
|
319 |
-
really fast, and no DOM structure is being built for non-visible
|
320 |
-
content, you don't have to worry about locking up your browser when a
|
321 |
-
user enters a megabyte-sized document.</li>
|
322 |
-
|
323 |
-
<li><strong>Extended API.</strong> Some things kept coming up in the
|
324 |
-
mailing list, such as marking pieces of text or lines, which were
|
325 |
-
extremely hard to do with CodeMirror 1. The new version has proper
|
326 |
-
support for these built in.</li>
|
327 |
-
|
328 |
-
<li><strong>Tab support.</strong> Tabs inside editable documents were,
|
329 |
-
for some reason, a no-go. At least six different people announced they
|
330 |
-
were going to add tab support to CodeMirror 1, none survived (I mean,
|
331 |
-
none delivered a working version). CodeMirror 2 no longer removes tabs
|
332 |
-
from your document.</li>
|
333 |
-
|
334 |
-
<li><strong>Sane styling.</strong> <code>iframe</code> nodes aren't
|
335 |
-
really known for respecting document flow. Now that an editor instance
|
336 |
-
is a plain <code>div</code> element, it is much easier to size it to
|
337 |
-
fit the surrounding elements. You don't even have to make it scroll if
|
338 |
-
you do not <a href="demo/resize.html">want to</a>.</li>
|
339 |
-
|
340 |
-
</ul>
|
341 |
-
|
342 |
-
<p>Then, the bad:</p>
|
343 |
-
|
344 |
-
<ul>
|
345 |
-
|
346 |
-
<li><strong>Some cursor flakiness.</strong> The textarea hack does not
|
347 |
-
really do justice to the complexity of cursor handling—a selection is
|
348 |
-
typically more than just an offset into a string. For example, if you
|
349 |
-
use the up and down arrow keys to move to a shorter line and then
|
350 |
-
back, you'll end up in your old position in most editor controls, but
|
351 |
-
CodeMirror 2 currently doesn't remember the 'real' cursor column in
|
352 |
-
this case. These can be worked around on a case-by-case basis, but
|
353 |
-
I haven't put much energy into that yet.</li>
|
354 |
-
|
355 |
-
<li><strong>Limited interaction with the editable panel.</strong>
|
356 |
-
Since the element you're looking at is not a real editable panel,
|
357 |
-
native browser behaviour for editable controls doesn't work
|
358 |
-
automatically. Through a lot of event glue code, I've managed to make
|
359 |
-
drag and drop work pretty well, have context menus work on most
|
360 |
-
browsers (except Opera). Middle-click paste on Firefox in Linux is
|
361 |
-
broken until someone finds a way to intercept it.</li>
|
362 |
-
|
363 |
-
</ul>
|
364 |
-
|
365 |
-
</div><div class="rightsmall blk">
|
366 |
-
|
367 |
-
<h2>Contents</h2>
|
368 |
-
|
369 |
-
<ul>
|
370 |
-
<li><a href="#intro">Introduction</a></li>
|
371 |
-
<li><a href="#approach">General Approach</a></li>
|
372 |
-
<li><a href="#input">Input</a></li>
|
373 |
-
<li><a href="#selection">Selection</a></li>
|
374 |
-
<li><a href="#update">Intelligent Updating</a></li>
|
375 |
-
<li><a href="#parse">Parsing</a></li>
|
376 |
-
<li><a href="#summary">What Gives?</a></li>
|
377 |
-
</ul>
|
378 |
-
|
379 |
-
</div></div>
|
380 |
-
|
381 |
-
<div style="height: 2em"> </div>
|
382 |
-
|
383 |
-
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/codemirror.css
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
.CodeMirror {
|
2 |
-
line-height: 1em;
|
3 |
-
font-family: monospace;
|
4 |
-
}
|
5 |
-
|
6 |
-
.CodeMirror-scroll {
|
7 |
-
overflow: auto;
|
8 |
-
height: 410px;
|
9 |
-
/* This is needed to prevent an IE[67] bug where the scrolled content
|
10 |
-
is visible outside of the scrolling box. */
|
11 |
-
position: relative;
|
12 |
-
}
|
13 |
-
|
14 |
-
.CodeMirror-gutter {
|
15 |
-
position: absolute; left: 0; top: 0;
|
16 |
-
z-index: 10;
|
17 |
-
background-color: #f7f7f7;
|
18 |
-
border-right: 1px solid #eee;
|
19 |
-
min-width: 2em;
|
20 |
-
height: 100%;
|
21 |
-
}
|
22 |
-
.CodeMirror-gutter-text {
|
23 |
-
color: #aaa;
|
24 |
-
text-align: right;
|
25 |
-
padding: .4em .2em .4em .4em;
|
26 |
-
white-space: pre !important;
|
27 |
-
}
|
28 |
-
.CodeMirror-lines {
|
29 |
-
padding: .4em;
|
30 |
-
}
|
31 |
-
|
32 |
-
.CodeMirror pre {
|
33 |
-
-moz-border-radius: 0;
|
34 |
-
-webkit-border-radius: 0;
|
35 |
-
-o-border-radius: 0;
|
36 |
-
border-radius: 0;
|
37 |
-
border-width: 0; margin: 0; padding: 0; background: transparent;
|
38 |
-
font-family: inherit;
|
39 |
-
font-size: inherit;
|
40 |
-
padding: 0; margin: 0;
|
41 |
-
white-space: pre;
|
42 |
-
word-wrap: normal;
|
43 |
-
}
|
44 |
-
|
45 |
-
.CodeMirror-wrap pre {
|
46 |
-
word-wrap: break-word;
|
47 |
-
white-space: pre-wrap;
|
48 |
-
}
|
49 |
-
.CodeMirror-wrap .CodeMirror-scroll {
|
50 |
-
overflow-x: hidden;
|
51 |
-
}
|
52 |
-
|
53 |
-
.CodeMirror textarea {
|
54 |
-
font-family: inherit !important;
|
55 |
-
font-size: inherit !important;
|
56 |
-
}
|
57 |
-
|
58 |
-
.CodeMirror-cursor {
|
59 |
-
z-index: 10;
|
60 |
-
position: absolute;
|
61 |
-
visibility: hidden;
|
62 |
-
border-left: 1px solid black !important;
|
63 |
-
}
|
64 |
-
.CodeMirror-focused .CodeMirror-cursor {
|
65 |
-
visibility: visible;
|
66 |
-
}
|
67 |
-
|
68 |
-
span.CodeMirror-selected {
|
69 |
-
background: #ccc !important;
|
70 |
-
color: HighlightText !important;
|
71 |
-
}
|
72 |
-
.CodeMirror-focused span.CodeMirror-selected {
|
73 |
-
background: Highlight !important;
|
74 |
-
}
|
75 |
-
|
76 |
-
.CodeMirror-matchingbracket {color: #0f0 !important;}
|
77 |
-
.CodeMirror-nonmatchingbracket {color: #f22 !important;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/codemirror.js
DELETED
@@ -1,2785 +0,0 @@
|
|
1 |
-
// CodeMirror v2.18
|
2 |
-
|
3 |
-
// All functions that need access to the editor's state live inside
|
4 |
-
// the CodeMirror function. Below that, at the bottom of the file,
|
5 |
-
// some utilities are defined.
|
6 |
-
|
7 |
-
// CodeMirror is the only global var we claim
|
8 |
-
var CodeMirror = (function() {
|
9 |
-
// This is the function that produces an editor instance. It's
|
10 |
-
// closure is used to store the editor state.
|
11 |
-
function CodeMirror(place, givenOptions) {
|
12 |
-
// Determine effective options based on given values and defaults.
|
13 |
-
var options = {}, defaults = CodeMirror.defaults;
|
14 |
-
for (var opt in defaults)
|
15 |
-
if (defaults.hasOwnProperty(opt))
|
16 |
-
options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
|
17 |
-
|
18 |
-
var targetDocument = options["document"];
|
19 |
-
// The element in which the editor lives.
|
20 |
-
var wrapper = targetDocument.createElement("div");
|
21 |
-
wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");
|
22 |
-
// This mess creates the base DOM structure for the editor.
|
23 |
-
wrapper.innerHTML =
|
24 |
-
'<div style="overflow: hidden; position: relative; width: 1px; height: 0px;">' + // Wraps and hides input textarea
|
25 |
-
'<textarea style="position: absolute; width: 10000px;" wrap="off" ' +
|
26 |
-
'autocorrect="off" autocapitalize="off"></textarea></div>' +
|
27 |
-
'<div class="CodeMirror-scroll cm-s-' + options.theme + '">' +
|
28 |
-
'<div style="position: relative">' + // Set to the height of the text, causes scrolling
|
29 |
-
'<div style="position: relative">' + // Moved around its parent to cover visible view
|
30 |
-
'<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
|
31 |
-
// Provides positioning relative to (visible) text origin
|
32 |
-
'<div class="CodeMirror-lines"><div style="position: relative">' +
|
33 |
-
'<div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden"></div>' +
|
34 |
-
'<pre class="CodeMirror-cursor"> </pre>' + // Absolutely positioned blinky cursor
|
35 |
-
'<div></div>' + // This DIV contains the actual code
|
36 |
-
'</div></div></div></div></div>';
|
37 |
-
if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
|
38 |
-
// I've never seen more elegant code in my life.
|
39 |
-
var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
|
40 |
-
scroller = wrapper.lastChild, code = scroller.firstChild,
|
41 |
-
mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,
|
42 |
-
lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,
|
43 |
-
cursor = measure.nextSibling, lineDiv = cursor.nextSibling;
|
44 |
-
if (!webkit) lineSpace.draggable = true;
|
45 |
-
if (options.tabindex != null) input.tabindex = options.tabindex;
|
46 |
-
if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
|
47 |
-
|
48 |
-
// Check for problem with IE innerHTML not working when we have a
|
49 |
-
// P (or similar) parent node.
|
50 |
-
try { stringWidth("x"); }
|
51 |
-
catch (e) {
|
52 |
-
if (e.message.match(/unknown runtime/i))
|
53 |
-
e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
|
54 |
-
throw e;
|
55 |
-
}
|
56 |
-
|
57 |
-
// Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
|
58 |
-
var poll = new Delayed(), highlight = new Delayed(), blinker;
|
59 |
-
|
60 |
-
// mode holds a mode API object. doc is the tree of Line objects,
|
61 |
-
// work an array of lines that should be parsed, and history the
|
62 |
-
// undo history (instance of History constructor).
|
63 |
-
var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused;
|
64 |
-
loadMode();
|
65 |
-
// The selection. These are always maintained to point at valid
|
66 |
-
// positions. Inverted is used to remember that the user is
|
67 |
-
// selecting bottom-to-top.
|
68 |
-
var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
|
69 |
-
// Selection-related flags. shiftSelecting obviously tracks
|
70 |
-
// whether the user is holding shift. reducedSelection is a hack
|
71 |
-
// to get around the fact that we can't create inverted
|
72 |
-
// selections. See below.
|
73 |
-
var shiftSelecting, reducedSelection, lastClick, lastDoubleClick, draggingText;
|
74 |
-
// Variables used by startOperation/endOperation to track what
|
75 |
-
// happened during the operation.
|
76 |
-
var updateInput, changes, textChanged, selectionChanged, leaveInputAlone, gutterDirty;
|
77 |
-
// Current visible range (may be bigger than the view window).
|
78 |
-
var displayOffset = 0, showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;
|
79 |
-
// editing will hold an object describing the things we put in the
|
80 |
-
// textarea, to help figure out whether something changed.
|
81 |
-
// bracketHighlighted is used to remember that a backet has been
|
82 |
-
// marked.
|
83 |
-
var editing, bracketHighlighted;
|
84 |
-
// Tracks the maximum line length so that the horizontal scrollbar
|
85 |
-
// can be kept static when scrolling.
|
86 |
-
var maxLine = "", maxWidth;
|
87 |
-
|
88 |
-
// Initialize the content.
|
89 |
-
operation(function(){setValue(options.value || ""); updateInput = false;})();
|
90 |
-
var history = new History();
|
91 |
-
|
92 |
-
var slowPollInterval = 2000;
|
93 |
-
// Gecko and Opera Linux do not reliably fire any event when starting an IME compose
|
94 |
-
var alwaysPollForIME = (!win && !mac) && (gecko || window.opera);
|
95 |
-
if (options.pollForIME && alwaysPollForIME) slowPollInterval = 50;
|
96 |
-
function keyMightStartIME(keyCode) {
|
97 |
-
return (win && ((gecko && keyCode == 229) || (window.opera && keyCode == 197))) || (mac && gecko);
|
98 |
-
}
|
99 |
-
|
100 |
-
// Register our event handlers.
|
101 |
-
connect(scroller, "mousedown", operation(onMouseDown));
|
102 |
-
connect(scroller, "dblclick", operation(onDoubleClick));
|
103 |
-
connect(lineSpace, "dragstart", onDragStart);
|
104 |
-
connect(lineSpace, "selectstart", e_preventDefault);
|
105 |
-
// Gecko browsers fire contextmenu *after* opening the menu, at
|
106 |
-
// which point we can't mess with it anymore. Context menu is
|
107 |
-
// handled in onMouseDown for Gecko.
|
108 |
-
if (!gecko) connect(scroller, "contextmenu", onContextMenu);
|
109 |
-
connect(scroller, "scroll", function() {
|
110 |
-
updateDisplay([]);
|
111 |
-
if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";
|
112 |
-
if (options.onScroll) options.onScroll(instance);
|
113 |
-
});
|
114 |
-
connect(window, "resize", function() {updateDisplay(true);});
|
115 |
-
connect(input, "keyup", operation(onKeyUp));
|
116 |
-
connect(input, "input", function() {fastPoll(curKeyId);});
|
117 |
-
connect(input, "keydown", operation(onKeyDown));
|
118 |
-
connect(input, "keypress", operation(onKeyPress));
|
119 |
-
connect(input, "focus", onFocus);
|
120 |
-
connect(input, "blur", onBlur);
|
121 |
-
|
122 |
-
connect(scroller, "dragenter", e_stop);
|
123 |
-
connect(scroller, "dragover", e_stop);
|
124 |
-
connect(scroller, "drop", operation(onDrop));
|
125 |
-
connect(scroller, "paste", function(){focusInput(); fastPoll();});
|
126 |
-
connect(input, "paste", function(){fastPoll();});
|
127 |
-
connect(input, "cut", function(){fastPoll();});
|
128 |
-
|
129 |
-
// IE throws unspecified error in certain cases, when
|
130 |
-
// trying to access activeElement before onload
|
131 |
-
var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }
|
132 |
-
if (hasFocus) setTimeout(onFocus, 20);
|
133 |
-
else onBlur();
|
134 |
-
|
135 |
-
function isLine(l) {return l >= 0 && l < doc.size;}
|
136 |
-
// The instance object that we'll return. Mostly calls out to
|
137 |
-
// local functions in the CodeMirror function. Some do some extra
|
138 |
-
// range checking and/or clipping. operation is used to wrap the
|
139 |
-
// call so that changes it makes are tracked, and the display is
|
140 |
-
// updated afterwards.
|
141 |
-
var instance = wrapper.CodeMirror = {
|
142 |
-
getValue: getValue,
|
143 |
-
setValue: operation(setValue),
|
144 |
-
getSelection: getSelection,
|
145 |
-
replaceSelection: operation(replaceSelection),
|
146 |
-
focus: function(){focusInput(); onFocus(); fastPoll();},
|
147 |
-
setOption: function(option, value) {
|
148 |
-
var oldVal = options[option];
|
149 |
-
options[option] = value;
|
150 |
-
if (option == "mode" || option == "indentUnit") loadMode();
|
151 |
-
else if (option == "readOnly" && value == "nocursor") input.blur();
|
152 |
-
else if (option == "theme") scroller.className = scroller.className.replace(/cm-s-\w+/, "cm-s-" + value);
|
153 |
-
else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
|
154 |
-
else if (option == "pollForIME" && alwaysPollForIME) slowPollInterval = value ? 50 : 2000;
|
155 |
-
if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme")
|
156 |
-
operation(gutterChanged)();
|
157 |
-
},
|
158 |
-
getOption: function(option) {return options[option];},
|
159 |
-
undo: operation(undo),
|
160 |
-
redo: operation(redo),
|
161 |
-
indentLine: operation(function(n, dir) {
|
162 |
-
if (isLine(n)) indentLine(n, dir == null ? "smart" : dir ? "add" : "subtract");
|
163 |
-
}),
|
164 |
-
historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
|
165 |
-
clearHistory: function() {history = new History();},
|
166 |
-
matchBrackets: operation(function(){matchBrackets(true);}),
|
167 |
-
getTokenAt: operation(function(pos) {
|
168 |
-
pos = clipPos(pos);
|
169 |
-
return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);
|
170 |
-
}),
|
171 |
-
getStateAfter: function(line) {
|
172 |
-
line = clipLine(line == null ? doc.size - 1: line);
|
173 |
-
return getStateBefore(line + 1);
|
174 |
-
},
|
175 |
-
cursorCoords: function(start){
|
176 |
-
if (start == null) start = sel.inverted;
|
177 |
-
return pageCoords(start ? sel.from : sel.to);
|
178 |
-
},
|
179 |
-
charCoords: function(pos){return pageCoords(clipPos(pos));},
|
180 |
-
coordsChar: function(coords) {
|
181 |
-
var off = eltOffset(lineSpace);
|
182 |
-
return coordsChar(coords.x - off.left, coords.y - off.top);
|
183 |
-
},
|
184 |
-
getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},
|
185 |
-
markText: operation(markText),
|
186 |
-
setBookmark: setBookmark,
|
187 |
-
setMarker: operation(addGutterMarker),
|
188 |
-
clearMarker: operation(removeGutterMarker),
|
189 |
-
setLineClass: operation(setLineClass),
|
190 |
-
hideLine: operation(function(h) {return setLineHidden(h, true);}),
|
191 |
-
showLine: operation(function(h) {return setLineHidden(h, false);}),
|
192 |
-
lineInfo: lineInfo,
|
193 |
-
addWidget: function(pos, node, scroll, vert, horiz) {
|
194 |
-
pos = localCoords(clipPos(pos));
|
195 |
-
var top = pos.yBot, left = pos.x;
|
196 |
-
node.style.position = "absolute";
|
197 |
-
code.appendChild(node);
|
198 |
-
if (vert == "over") top = pos.y;
|
199 |
-
else if (vert == "near") {
|
200 |
-
var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),
|
201 |
-
hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
|
202 |
-
if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
|
203 |
-
top = pos.y - node.offsetHeight;
|
204 |
-
if (left + node.offsetWidth > hspace)
|
205 |
-
left = hspace - node.offsetWidth;
|
206 |
-
}
|
207 |
-
node.style.top = (top + paddingTop()) + "px";
|
208 |
-
node.style.left = node.style.right = "";
|
209 |
-
if (horiz == "right") {
|
210 |
-
left = code.clientWidth - node.offsetWidth;
|
211 |
-
node.style.right = "0px";
|
212 |
-
} else {
|
213 |
-
if (horiz == "left") left = 0;
|
214 |
-
else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;
|
215 |
-
node.style.left = (left + paddingLeft()) + "px";
|
216 |
-
}
|
217 |
-
if (scroll)
|
218 |
-
scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
|
219 |
-
},
|
220 |
-
|
221 |
-
lineCount: function() {return doc.size;},
|
222 |
-
getCursor: function(start) {
|
223 |
-
if (start == null) start = sel.inverted;
|
224 |
-
return copyPos(start ? sel.from : sel.to);
|
225 |
-
},
|
226 |
-
somethingSelected: function() {return !posEq(sel.from, sel.to);},
|
227 |
-
setCursor: operation(function(line, ch) {
|
228 |
-
if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch);
|
229 |
-
else setCursor(line, ch);
|
230 |
-
}),
|
231 |
-
setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),
|
232 |
-
getLine: function(line) {if (isLine(line)) return getLine(line).text;},
|
233 |
-
setLine: operation(function(line, text) {
|
234 |
-
if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});
|
235 |
-
}),
|
236 |
-
removeLine: operation(function(line) {
|
237 |
-
if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
|
238 |
-
}),
|
239 |
-
replaceRange: operation(replaceRange),
|
240 |
-
getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
|
241 |
-
|
242 |
-
coordsFromIndex: function(off) {
|
243 |
-
var lineNo = 0, ch;
|
244 |
-
doc.iter(0, doc.size, function(line) {
|
245 |
-
var sz = line.text.length + 1;
|
246 |
-
if (sz > off) { ch = off; return true; }
|
247 |
-
off -= sz;
|
248 |
-
++lineNo;
|
249 |
-
});
|
250 |
-
return clipPos({line: lineNo, ch: ch});
|
251 |
-
},
|
252 |
-
|
253 |
-
operation: function(f){return operation(f)();},
|
254 |
-
refresh: function(){updateDisplay(true);},
|
255 |
-
getInputField: function(){return input;},
|
256 |
-
getWrapperElement: function(){return wrapper;},
|
257 |
-
getScrollerElement: function(){return scroller;},
|
258 |
-
getGutterElement: function(){return gutter;}
|
259 |
-
};
|
260 |
-
|
261 |
-
function getLine(n) { return getLineAt(doc, n); }
|
262 |
-
function updateLineHeight(line, height) {
|
263 |
-
gutterDirty = true;
|
264 |
-
var diff = height - line.height;
|
265 |
-
for (var n = line; n; n = n.parent) n.height += diff;
|
266 |
-
}
|
267 |
-
|
268 |
-
function setValue(code) {
|
269 |
-
var top = {line: 0, ch: 0};
|
270 |
-
updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},
|
271 |
-
splitLines(code), top, top);
|
272 |
-
updateInput = true;
|
273 |
-
}
|
274 |
-
function getValue(code) {
|
275 |
-
var text = [];
|
276 |
-
doc.iter(0, doc.size, function(line) { text.push(line.text); });
|
277 |
-
return text.join("\n");
|
278 |
-
}
|
279 |
-
|
280 |
-
function onMouseDown(e) {
|
281 |
-
// Check whether this is a click in a widget
|
282 |
-
for (var n = e_target(e); n != wrapper; n = n.parentNode)
|
283 |
-
if (n.parentNode == code && n != mover) return;
|
284 |
-
|
285 |
-
// See if this is a click in the gutter
|
286 |
-
for (var n = e_target(e); n != wrapper; n = n.parentNode)
|
287 |
-
if (n.parentNode == gutterText) {
|
288 |
-
if (options.onGutterClick)
|
289 |
-
options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
|
290 |
-
return e_preventDefault(e);
|
291 |
-
}
|
292 |
-
|
293 |
-
var start = posFromMouse(e);
|
294 |
-
|
295 |
-
switch (e_button(e)) {
|
296 |
-
case 3:
|
297 |
-
if (gecko && !mac) onContextMenu(e);
|
298 |
-
return;
|
299 |
-
case 2:
|
300 |
-
if (start) setCursor(start.line, start.ch, true);
|
301 |
-
return;
|
302 |
-
}
|
303 |
-
// For button 1, if it was clicked inside the editor
|
304 |
-
// (posFromMouse returning non-null), we have to adjust the
|
305 |
-
// selection.
|
306 |
-
if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
|
307 |
-
|
308 |
-
if (!focused) onFocus();
|
309 |
-
|
310 |
-
var now = +new Date;
|
311 |
-
if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
|
312 |
-
e_preventDefault(e);
|
313 |
-
setTimeout(focusInput, 20);
|
314 |
-
return selectLine(start.line);
|
315 |
-
} else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
|
316 |
-
lastDoubleClick = {time: now, pos: start};
|
317 |
-
e_preventDefault(e);
|
318 |
-
return selectWordAt(start);
|
319 |
-
} else { lastClick = {time: now, pos: start}; }
|
320 |
-
|
321 |
-
var last = start, going;
|
322 |
-
if (dragAndDrop && !posEq(sel.from, sel.to) &&
|
323 |
-
!posLess(start, sel.from) && !posLess(sel.to, start)) {
|
324 |
-
// Let the drag handler handle this.
|
325 |
-
if (webkit) lineSpace.draggable = true;
|
326 |
-
var up = connect(targetDocument, "mouseup", operation(function(e2) {
|
327 |
-
if (webkit) lineSpace.draggable = false;
|
328 |
-
draggingText = false;
|
329 |
-
up();
|
330 |
-
if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
|
331 |
-
e_preventDefault(e2);
|
332 |
-
setCursor(start.line, start.ch, true);
|
333 |
-
focusInput();
|
334 |
-
}
|
335 |
-
}), true);
|
336 |
-
draggingText = true;
|
337 |
-
return;
|
338 |
-
}
|
339 |
-
e_preventDefault(e);
|
340 |
-
setCursor(start.line, start.ch, true);
|
341 |
-
|
342 |
-
function extend(e) {
|
343 |
-
var cur = posFromMouse(e, true);
|
344 |
-
if (cur && !posEq(cur, last)) {
|
345 |
-
if (!focused) onFocus();
|
346 |
-
last = cur;
|
347 |
-
setSelectionUser(start, cur);
|
348 |
-
updateInput = false;
|
349 |
-
var visible = visibleLines();
|
350 |
-
if (cur.line >= visible.to || cur.line < visible.from)
|
351 |
-
going = setTimeout(operation(function(){extend(e);}), 150);
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
var move = connect(targetDocument, "mousemove", operation(function(e) {
|
356 |
-
clearTimeout(going);
|
357 |
-
e_preventDefault(e);
|
358 |
-
extend(e);
|
359 |
-
}), true);
|
360 |
-
var up = connect(targetDocument, "mouseup", operation(function(e) {
|
361 |
-
clearTimeout(going);
|
362 |
-
var cur = posFromMouse(e);
|
363 |
-
if (cur) setSelectionUser(start, cur);
|
364 |
-
e_preventDefault(e);
|
365 |
-
focusInput();
|
366 |
-
updateInput = true;
|
367 |
-
move(); up();
|
368 |
-
}), true);
|
369 |
-
}
|
370 |
-
function onDoubleClick(e) {
|
371 |
-
for (var n = e_target(e); n != wrapper; n = n.parentNode)
|
372 |
-
if (n.parentNode == gutterText) return e_preventDefault(e);
|
373 |
-
var start = posFromMouse(e);
|
374 |
-
if (!start) return;
|
375 |
-
lastDoubleClick = {time: +new Date, pos: start};
|
376 |
-
e_preventDefault(e);
|
377 |
-
selectWordAt(start);
|
378 |
-
}
|
379 |
-
function onDrop(e) {
|
380 |
-
e.preventDefault();
|
381 |
-
var pos = posFromMouse(e, true), files = e.dataTransfer.files;
|
382 |
-
if (!pos || options.readOnly) return;
|
383 |
-
if (files && files.length && window.FileReader && window.File) {
|
384 |
-
function loadFile(file, i) {
|
385 |
-
var reader = new FileReader;
|
386 |
-
reader.onload = function() {
|
387 |
-
text[i] = reader.result;
|
388 |
-
if (++read == n) {
|
389 |
-
pos = clipPos(pos);
|
390 |
-
operation(function() {
|
391 |
-
var end = replaceRange(text.join(""), pos, pos);
|
392 |
-
setSelectionUser(pos, end);
|
393 |
-
})();
|
394 |
-
}
|
395 |
-
};
|
396 |
-
reader.readAsText(file);
|
397 |
-
}
|
398 |
-
var n = files.length, text = Array(n), read = 0;
|
399 |
-
for (var i = 0; i < n; ++i) loadFile(files[i], i);
|
400 |
-
}
|
401 |
-
else {
|
402 |
-
try {
|
403 |
-
var text = e.dataTransfer.getData("Text");
|
404 |
-
if (text) {
|
405 |
-
var end = replaceRange(text, pos, pos);
|
406 |
-
var curFrom = sel.from, curTo = sel.to;
|
407 |
-
setSelectionUser(pos, end);
|
408 |
-
if (draggingText) replaceRange("", curFrom, curTo);
|
409 |
-
focusInput();
|
410 |
-
}
|
411 |
-
}
|
412 |
-
catch(e){}
|
413 |
-
}
|
414 |
-
}
|
415 |
-
function onDragStart(e) {
|
416 |
-
var txt = getSelection();
|
417 |
-
// This will reset escapeElement
|
418 |
-
htmlEscape(txt);
|
419 |
-
e.dataTransfer.setDragImage(escapeElement, 0, 0);
|
420 |
-
e.dataTransfer.setData("Text", txt);
|
421 |
-
}
|
422 |
-
function onKeyDown(e) {
|
423 |
-
if (!focused) onFocus();
|
424 |
-
|
425 |
-
var code = e.keyCode;
|
426 |
-
// IE does strange things with escape.
|
427 |
-
if (ie && code == 27) { e.returnValue = false; }
|
428 |
-
// Tries to detect ctrl on non-mac, cmd on mac.
|
429 |
-
var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;
|
430 |
-
if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
|
431 |
-
else shiftSelecting = null;
|
432 |
-
// First give onKeyEvent option a chance to handle this.
|
433 |
-
if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
|
434 |
-
|
435 |
-
if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down
|
436 |
-
if (mod && ((code == 36 || code == 35) || // ctrl-home/end
|
437 |
-
mac && (code == 38 || code == 40))) { // cmd-up/down
|
438 |
-
scrollEnd(code == 36 || code == 38); return e_preventDefault(e);
|
439 |
-
}
|
440 |
-
if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a
|
441 |
-
if (!options.readOnly) {
|
442 |
-
if (!anyMod && code == 13) {return;} // enter
|
443 |
-
if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab
|
444 |
-
if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z
|
445 |
-
if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y
|
446 |
-
}
|
447 |
-
if (code == 36) { if (options.smartHome) { smartHome(); return e_preventDefault(e); } }
|
448 |
-
|
449 |
-
// Key id to use in the movementKeys map. We also pass it to
|
450 |
-
// fastPoll in order to 'self learn'. We need this because
|
451 |
-
// reducedSelection, the hack where we collapse the selection to
|
452 |
-
// its start when it is inverted and a movement key is pressed
|
453 |
-
// (and later restore it again), shouldn't be used for
|
454 |
-
// non-movement keys.
|
455 |
-
curKeyId = (mod ? "c" : "") + (e.altKey ? "a" : "") + code;
|
456 |
-
if (sel.inverted && movementKeys[curKeyId] === true) {
|
457 |
-
var range = selRange(input);
|
458 |
-
if (range) {
|
459 |
-
reducedSelection = {anchor: range.start};
|
460 |
-
setSelRange(input, range.start, range.start);
|
461 |
-
}
|
462 |
-
}
|
463 |
-
// Don't save the key as a movementkey unless it had a modifier
|
464 |
-
if (!mod && !e.altKey) curKeyId = null;
|
465 |
-
fastPoll(curKeyId);
|
466 |
-
|
467 |
-
if (options.pollForIME && keyMightStartIME(code)) slowPollInterval = 50;
|
468 |
-
}
|
469 |
-
function onKeyUp(e) {
|
470 |
-
if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
|
471 |
-
if (reducedSelection) {
|
472 |
-
reducedSelection = null;
|
473 |
-
updateInput = true;
|
474 |
-
}
|
475 |
-
if (e.keyCode == 16) shiftSelecting = null;
|
476 |
-
|
477 |
-
if (slowPollInterval < 2000 && !alwaysPollForIME) slowPollInterval = 2000;
|
478 |
-
}
|
479 |
-
function onKeyPress(e) {
|
480 |
-
if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
|
481 |
-
if (options.electricChars && mode.electricChars) {
|
482 |
-
var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);
|
483 |
-
if (mode.electricChars.indexOf(ch) > -1)
|
484 |
-
setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 50);
|
485 |
-
}
|
486 |
-
var code = e.keyCode;
|
487 |
-
// Re-stop tab and enter. Necessary on some browsers.
|
488 |
-
if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}
|
489 |
-
else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != "default") e_preventDefault(e);
|
490 |
-
else fastPoll(curKeyId);
|
491 |
-
}
|
492 |
-
|
493 |
-
function onFocus() {
|
494 |
-
if (options.readOnly == "nocursor") return;
|
495 |
-
if (!focused) {
|
496 |
-
if (options.onFocus) options.onFocus(instance);
|
497 |
-
focused = true;
|
498 |
-
if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
|
499 |
-
wrapper.className += " CodeMirror-focused";
|
500 |
-
if (!leaveInputAlone) prepareInput();
|
501 |
-
}
|
502 |
-
slowPoll();
|
503 |
-
restartBlink();
|
504 |
-
}
|
505 |
-
function onBlur() {
|
506 |
-
if (focused) {
|
507 |
-
if (options.onBlur) options.onBlur(instance);
|
508 |
-
focused = false;
|
509 |
-
wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
|
510 |
-
}
|
511 |
-
clearInterval(blinker);
|
512 |
-
setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
|
513 |
-
}
|
514 |
-
|
515 |
-
// Replace the range from from to to by the strings in newText.
|
516 |
-
// Afterwards, set the selection to selFrom, selTo.
|
517 |
-
function updateLines(from, to, newText, selFrom, selTo) {
|
518 |
-
if (history) {
|
519 |
-
var old = [];
|
520 |
-
doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });
|
521 |
-
history.addChange(from.line, newText.length, old);
|
522 |
-
while (history.done.length > options.undoDepth) history.done.shift();
|
523 |
-
}
|
524 |
-
updateLinesNoUndo(from, to, newText, selFrom, selTo);
|
525 |
-
}
|
526 |
-
function unredoHelper(from, to) {
|
527 |
-
var change = from.pop();
|
528 |
-
if (change) {
|
529 |
-
var replaced = [], end = change.start + change.added;
|
530 |
-
doc.iter(change.start, end, function(line) { replaced.push(line.text); });
|
531 |
-
to.push({start: change.start, added: change.old.length, old: replaced});
|
532 |
-
var pos = clipPos({line: change.start + change.old.length - 1,
|
533 |
-
ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
|
534 |
-
updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);
|
535 |
-
updateInput = true;
|
536 |
-
}
|
537 |
-
}
|
538 |
-
function undo() {unredoHelper(history.done, history.undone);}
|
539 |
-
function redo() {unredoHelper(history.undone, history.done);}
|
540 |
-
|
541 |
-
function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
|
542 |
-
var recomputeMaxLength = false, maxLineLength = maxLine.length;
|
543 |
-
if (!options.lineWrapping)
|
544 |
-
doc.iter(from.line, to.line, function(line) {
|
545 |
-
if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
|
546 |
-
});
|
547 |
-
|
548 |
-
var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);
|
549 |
-
// First adjust the line structure, taking some care to leave highlighting intact.
|
550 |
-
if (firstLine == lastLine) {
|
551 |
-
if (newText.length == 1)
|
552 |
-
firstLine.replace(from.ch, to.ch, newText[0]);
|
553 |
-
else {
|
554 |
-
lastLine = firstLine.split(to.ch, newText[newText.length-1]);
|
555 |
-
firstLine.replace(from.ch, null, newText[0]);
|
556 |
-
firstLine.fixMarkEnds(lastLine);
|
557 |
-
var added = [];
|
558 |
-
for (var i = 1, e = newText.length - 1; i < e; ++i)
|
559 |
-
added.push(Line.inheritMarks(newText[i], firstLine));
|
560 |
-
added.push(lastLine);
|
561 |
-
doc.insert(from.line + 1, added);
|
562 |
-
}
|
563 |
-
}
|
564 |
-
else if (newText.length == 1) {
|
565 |
-
firstLine.replace(from.ch, null, newText[0]);
|
566 |
-
lastLine.replace(null, to.ch, "");
|
567 |
-
firstLine.append(lastLine);
|
568 |
-
doc.remove(from.line + 1, nlines);
|
569 |
-
}
|
570 |
-
else {
|
571 |
-
var added = [];
|
572 |
-
firstLine.replace(from.ch, null, newText[0]);
|
573 |
-
lastLine.replace(null, to.ch, newText[newText.length-1]);
|
574 |
-
firstLine.fixMarkEnds(lastLine);
|
575 |
-
for (var i = 1, e = newText.length - 1; i < e; ++i)
|
576 |
-
added.push(Line.inheritMarks(newText[i], firstLine));
|
577 |
-
if (nlines > 1) doc.remove(from.line + 1, nlines - 1);
|
578 |
-
doc.insert(from.line + 1, added);
|
579 |
-
}
|
580 |
-
if (options.lineWrapping) {
|
581 |
-
var perLine = scroller.clientWidth / charWidth() - 3;
|
582 |
-
doc.iter(from.line, from.line + newText.length, function(line) {
|
583 |
-
if (line.hidden) return;
|
584 |
-
var guess = Math.ceil(line.text.length / perLine) || 1;
|
585 |
-
if (guess != line.height) updateLineHeight(line, guess);
|
586 |
-
});
|
587 |
-
} else {
|
588 |
-
doc.iter(from.line, i + newText.length, function(line) {
|
589 |
-
var l = line.text;
|
590 |
-
if (l.length > maxLineLength) {
|
591 |
-
maxLine = l; maxLineLength = l.length; maxWidth = null;
|
592 |
-
recomputeMaxLength = false;
|
593 |
-
}
|
594 |
-
});
|
595 |
-
if (recomputeMaxLength) {
|
596 |
-
maxLineLength = 0; maxLine = ""; maxWidth = null;
|
597 |
-
doc.iter(0, doc.size, function(line) {
|
598 |
-
var l = line.text;
|
599 |
-
if (l.length > maxLineLength) {
|
600 |
-
maxLineLength = l.length; maxLine = l;
|
601 |
-
}
|
602 |
-
});
|
603 |
-
}
|
604 |
-
}
|
605 |
-
|
606 |
-
// Add these lines to the work array, so that they will be
|
607 |
-
// highlighted. Adjust work lines if lines were added/removed.
|
608 |
-
var newWork = [], lendiff = newText.length - nlines - 1;
|
609 |
-
for (var i = 0, l = work.length; i < l; ++i) {
|
610 |
-
var task = work[i];
|
611 |
-
if (task < from.line) newWork.push(task);
|
612 |
-
else if (task > to.line) newWork.push(task + lendiff);
|
613 |
-
}
|
614 |
-
var hlEnd = from.line + Math.min(newText.length, 500);
|
615 |
-
highlightLines(from.line, hlEnd);
|
616 |
-
newWork.push(hlEnd);
|
617 |
-
work = newWork;
|
618 |
-
startWorker(100);
|
619 |
-
// Remember that these lines changed, for updating the display
|
620 |
-
changes.push({from: from.line, to: to.line + 1, diff: lendiff});
|
621 |
-
textChanged = {from: from, to: to, text: newText};
|
622 |
-
|
623 |
-
// Update the selection
|
624 |
-
function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
|
625 |
-
setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
|
626 |
-
|
627 |
-
// Make sure the scroll-size div has the correct height.
|
628 |
-
code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + "px";
|
629 |
-
}
|
630 |
-
|
631 |
-
function replaceRange(code, from, to) {
|
632 |
-
from = clipPos(from);
|
633 |
-
if (!to) to = from; else to = clipPos(to);
|
634 |
-
code = splitLines(code);
|
635 |
-
function adjustPos(pos) {
|
636 |
-
if (posLess(pos, from)) return pos;
|
637 |
-
if (!posLess(to, pos)) return end;
|
638 |
-
var line = pos.line + code.length - (to.line - from.line) - 1;
|
639 |
-
var ch = pos.ch;
|
640 |
-
if (pos.line == to.line)
|
641 |
-
ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
|
642 |
-
return {line: line, ch: ch};
|
643 |
-
}
|
644 |
-
var end;
|
645 |
-
replaceRange1(code, from, to, function(end1) {
|
646 |
-
end = end1;
|
647 |
-
return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
|
648 |
-
});
|
649 |
-
return end;
|
650 |
-
}
|
651 |
-
function replaceSelection(code, collapse) {
|
652 |
-
replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
|
653 |
-
if (collapse == "end") return {from: end, to: end};
|
654 |
-
else if (collapse == "start") return {from: sel.from, to: sel.from};
|
655 |
-
else return {from: sel.from, to: end};
|
656 |
-
});
|
657 |
-
}
|
658 |
-
function replaceRange1(code, from, to, computeSel) {
|
659 |
-
var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
|
660 |
-
var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
|
661 |
-
updateLines(from, to, code, newSel.from, newSel.to);
|
662 |
-
}
|
663 |
-
|
664 |
-
function getRange(from, to) {
|
665 |
-
var l1 = from.line, l2 = to.line;
|
666 |
-
if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
|
667 |
-
var code = [getLine(l1).text.slice(from.ch)];
|
668 |
-
doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
|
669 |
-
code.push(getLine(l2).text.slice(0, to.ch));
|
670 |
-
return code.join("\n");
|
671 |
-
}
|
672 |
-
function getSelection() {
|
673 |
-
return getRange(sel.from, sel.to);
|
674 |
-
}
|
675 |
-
|
676 |
-
var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
|
677 |
-
function slowPoll() {
|
678 |
-
if (pollingFast) return;
|
679 |
-
poll.set(slowPollInterval, function() {
|
680 |
-
startOperation();
|
681 |
-
readInput();
|
682 |
-
if (focused) slowPoll();
|
683 |
-
endOperation();
|
684 |
-
});
|
685 |
-
}
|
686 |
-
function fastPoll(keyId) {
|
687 |
-
var missed = false;
|
688 |
-
pollingFast = true;
|
689 |
-
function p() {
|
690 |
-
startOperation();
|
691 |
-
var changed = readInput();
|
692 |
-
if (changed && keyId) {
|
693 |
-
if (changed == "moved" && movementKeys[keyId] == null) movementKeys[keyId] = true;
|
694 |
-
if (changed == "changed") movementKeys[keyId] = false;
|
695 |
-
}
|
696 |
-
if (!changed && !missed) {missed = true; poll.set(80, p);}
|
697 |
-
else {pollingFast = false; slowPoll();}
|
698 |
-
endOperation();
|
699 |
-
}
|
700 |
-
poll.set(20, p);
|
701 |
-
}
|
702 |
-
|
703 |
-
// Inspects the textarea, compares its state (content, selection)
|
704 |
-
// to the data in the editing variable, and updates the editor
|
705 |
-
// content or cursor if something changed.
|
706 |
-
function readInput() {
|
707 |
-
if (leaveInputAlone || !focused) return;
|
708 |
-
var changed = false, text = input.value, sr = selRange(input);
|
709 |
-
if (!sr) return false;
|
710 |
-
var changed = editing.text != text, rs = reducedSelection;
|
711 |
-
var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);
|
712 |
-
if (!moved && !rs) return false;
|
713 |
-
if (changed) {
|
714 |
-
shiftSelecting = reducedSelection = null;
|
715 |
-
if (options.readOnly) {updateInput = true; return "changed";}
|
716 |
-
}
|
717 |
-
|
718 |
-
// Compute selection start and end based on start/end offsets in textarea
|
719 |
-
function computeOffset(n, startLine) {
|
720 |
-
var pos = 0;
|
721 |
-
for (;;) {
|
722 |
-
var found = text.indexOf("\n", pos);
|
723 |
-
if (found == -1 || (text.charAt(found-1) == "\r" ? found - 1 : found) >= n)
|
724 |
-
return {line: startLine, ch: n - pos};
|
725 |
-
++startLine;
|
726 |
-
pos = found + 1;
|
727 |
-
}
|
728 |
-
}
|
729 |
-
var from = computeOffset(sr.start, editing.from),
|
730 |
-
to = computeOffset(sr.end, editing.from);
|
731 |
-
// Here we have to take the reducedSelection hack into account,
|
732 |
-
// so that you can, for example, press shift-up at the start of
|
733 |
-
// your selection and have the right thing happen.
|
734 |
-
if (rs) {
|
735 |
-
var head = sr.start == rs.anchor ? to : from;
|
736 |
-
var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;
|
737 |
-
if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }
|
738 |
-
else { reducedSelection = null; from = tail; to = head; }
|
739 |
-
}
|
740 |
-
|
741 |
-
// In some cases (cursor on same line as before), we don't have
|
742 |
-
// to update the textarea content at all.
|
743 |
-
if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)
|
744 |
-
updateInput = false;
|
745 |
-
|
746 |
-
// Magic mess to extract precise edited range from the changed
|
747 |
-
// string.
|
748 |
-
if (changed) {
|
749 |
-
var start = 0, end = text.length, len = Math.min(end, editing.text.length);
|
750 |
-
var c, line = editing.from, nl = -1;
|
751 |
-
while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {
|
752 |
-
++start;
|
753 |
-
if (c == "\n") {line++; nl = start;}
|
754 |
-
}
|
755 |
-
var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;
|
756 |
-
for (;;) {
|
757 |
-
c = editing.text.charAt(edend);
|
758 |
-
if (text.charAt(end) != c) {++end; ++edend; break;}
|
759 |
-
if (c == "\n") endline--;
|
760 |
-
if (edend <= start || end <= start) break;
|
761 |
-
--end; --edend;
|
762 |
-
}
|
763 |
-
var nl = editing.text.lastIndexOf("\n", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;
|
764 |
-
updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);
|
765 |
-
if (line != endline || from.line != line) updateInput = true;
|
766 |
-
}
|
767 |
-
else setSelection(from, to);
|
768 |
-
|
769 |
-
editing.text = text; editing.start = sr.start; editing.end = sr.end;
|
770 |
-
return changed ? "changed" : moved ? "moved" : false;
|
771 |
-
}
|
772 |
-
|
773 |
-
// Set the textarea content and selection range to match the
|
774 |
-
// editor state.
|
775 |
-
function prepareInput() {
|
776 |
-
var text = [];
|
777 |
-
var from = Math.max(0, sel.from.line - 1), to = Math.min(doc.size, sel.to.line + 2);
|
778 |
-
doc.iter(from, to, function(line) { text.push(line.text); });
|
779 |
-
text = input.value = text.join(lineSep);
|
780 |
-
var startch = sel.from.ch, endch = sel.to.ch;
|
781 |
-
doc.iter(from, sel.from.line, function(line) {
|
782 |
-
startch += lineSep.length + line.text.length;
|
783 |
-
});
|
784 |
-
doc.iter(from, sel.to.line, function(line) {
|
785 |
-
endch += lineSep.length + line.text.length;
|
786 |
-
});
|
787 |
-
editing = {text: text, from: from, to: to, start: startch, end: endch};
|
788 |
-
setSelRange(input, startch, reducedSelection ? startch : endch);
|
789 |
-
}
|
790 |
-
function focusInput() {
|
791 |
-
if (options.readOnly != "nocursor") input.focus();
|
792 |
-
}
|
793 |
-
|
794 |
-
function scrollEditorIntoView() {
|
795 |
-
if (!cursor.getBoundingClientRect) return;
|
796 |
-
var rect = cursor.getBoundingClientRect();
|
797 |
-
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
|
798 |
-
if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
|
799 |
-
}
|
800 |
-
function scrollCursorIntoView() {
|
801 |
-
var cursor = localCoords(sel.inverted ? sel.from : sel.to);
|
802 |
-
var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;
|
803 |
-
return scrollIntoView(x, cursor.y, x, cursor.yBot);
|
804 |
-
}
|
805 |
-
function scrollIntoView(x1, y1, x2, y2) {
|
806 |
-
var pl = paddingLeft(), pt = paddingTop(), lh = textHeight();
|
807 |
-
y1 += pt; y2 += pt; x1 += pl; x2 += pl;
|
808 |
-
var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
|
809 |
-
if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
|
810 |
-
else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}
|
811 |
-
|
812 |
-
var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
|
813 |
-
var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
|
814 |
-
if (x1 < screenleft + gutterw) {
|
815 |
-
if (x1 < 50) x1 = 0;
|
816 |
-
scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);
|
817 |
-
scrolled = true;
|
818 |
-
}
|
819 |
-
else if (x2 > screenw + screenleft) {
|
820 |
-
scroller.scrollLeft = x2 + 10 - screenw;
|
821 |
-
scrolled = true;
|
822 |
-
if (x2 > code.clientWidth) result = false;
|
823 |
-
}
|
824 |
-
if (scrolled && options.onScroll) options.onScroll(instance);
|
825 |
-
return result;
|
826 |
-
}
|
827 |
-
|
828 |
-
function visibleLines() {
|
829 |
-
var lh = textHeight(), top = scroller.scrollTop - paddingTop();
|
830 |
-
var from_height = Math.max(0, Math.floor(top / lh));
|
831 |
-
var to_height = Math.ceil((top + scroller.clientHeight) / lh);
|
832 |
-
return {from: lineAtHeight(doc, from_height),
|
833 |
-
to: lineAtHeight(doc, to_height)};
|
834 |
-
}
|
835 |
-
// Uses a set of changes plus the current scroll position to
|
836 |
-
// determine which DOM updates have to be made, and makes the
|
837 |
-
// updates.
|
838 |
-
function updateDisplay(changes) {
|
839 |
-
if (!scroller.clientWidth) {
|
840 |
-
showingFrom = showingTo = displayOffset = 0;
|
841 |
-
return;
|
842 |
-
}
|
843 |
-
// Compute the new visible window
|
844 |
-
var visible = visibleLines();
|
845 |
-
// Bail out if the visible area is already rendered and nothing changed.
|
846 |
-
if (changes !== true && changes.length == 0 && visible.from >= showingFrom && visible.to <= showingTo) return;
|
847 |
-
var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);
|
848 |
-
if (showingFrom < from && from - showingFrom < 20) from = showingFrom;
|
849 |
-
if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);
|
850 |
-
|
851 |
-
// Create a range of theoretically intact lines, and punch holes
|
852 |
-
// in that using the change info.
|
853 |
-
var intact = changes === true ? [] :
|
854 |
-
computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);
|
855 |
-
// Clip off the parts that won't be visible
|
856 |
-
var intactLines = 0;
|
857 |
-
for (var i = 0; i < intact.length; ++i) {
|
858 |
-
var range = intact[i];
|
859 |
-
if (range.from < from) {range.domStart += (from - range.from); range.from = from;}
|
860 |
-
if (range.to > to) range.to = to;
|
861 |
-
if (range.from >= range.to) intact.splice(i--, 1);
|
862 |
-
else intactLines += range.to - range.from;
|
863 |
-
}
|
864 |
-
if (intactLines == to - from) return;
|
865 |
-
intact.sort(function(a, b) {return a.domStart - b.domStart;});
|
866 |
-
|
867 |
-
var th = textHeight(), gutterDisplay = gutter.style.display;
|
868 |
-
lineDiv.style.display = gutter.style.display = "none";
|
869 |
-
patchDisplay(from, to, intact);
|
870 |
-
lineDiv.style.display = "";
|
871 |
-
|
872 |
-
// Position the mover div to align with the lines it's supposed
|
873 |
-
// to be showing (which will cover the visible display)
|
874 |
-
var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;
|
875 |
-
if (different) lastHeight = scroller.clientHeight;
|
876 |
-
showingFrom = from; showingTo = to;
|
877 |
-
displayOffset = heightAtLine(doc, from);
|
878 |
-
mover.style.top = (displayOffset * th) + "px";
|
879 |
-
code.style.height = (doc.height * th + 2 * paddingTop()) + "px";
|
880 |
-
|
881 |
-
// Since this is all rather error prone, it is honoured with the
|
882 |
-
// only assertion in the whole file.
|
883 |
-
if (lineDiv.childNodes.length != showingTo - showingFrom)
|
884 |
-
throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
|
885 |
-
" nodes=" + lineDiv.childNodes.length);
|
886 |
-
|
887 |
-
if (options.lineWrapping) {
|
888 |
-
maxWidth = scroller.clientWidth;
|
889 |
-
var curNode = lineDiv.firstChild;
|
890 |
-
doc.iter(showingFrom, showingTo, function(line) {
|
891 |
-
if (!line.hidden) {
|
892 |
-
var height = Math.round(curNode.offsetHeight / th) || 1;
|
893 |
-
if (line.height != height) {updateLineHeight(line, height); gutterDirty = true;}
|
894 |
-
}
|
895 |
-
curNode = curNode.nextSibling;
|
896 |
-
});
|
897 |
-
} else {
|
898 |
-
if (maxWidth == null) maxWidth = stringWidth(maxLine);
|
899 |
-
if (maxWidth > scroller.clientWidth) {
|
900 |
-
lineSpace.style.width = maxWidth + "px";
|
901 |
-
// Needed to prevent odd wrapping/hiding of widgets placed in here.
|
902 |
-
code.style.width = "";
|
903 |
-
code.style.width = scroller.scrollWidth + "px";
|
904 |
-
} else {
|
905 |
-
lineSpace.style.width = code.style.width = "";
|
906 |
-
}
|
907 |
-
}
|
908 |
-
gutter.style.display = gutterDisplay;
|
909 |
-
if (different || gutterDirty) updateGutter();
|
910 |
-
updateCursor();
|
911 |
-
}
|
912 |
-
|
913 |
-
function computeIntact(intact, changes) {
|
914 |
-
for (var i = 0, l = changes.length || 0; i < l; ++i) {
|
915 |
-
var change = changes[i], intact2 = [], diff = change.diff || 0;
|
916 |
-
for (var j = 0, l2 = intact.length; j < l2; ++j) {
|
917 |
-
var range = intact[j];
|
918 |
-
if (change.to <= range.from && change.diff)
|
919 |
-
intact2.push({from: range.from + diff, to: range.to + diff,
|
920 |
-
domStart: range.domStart});
|
921 |
-
else if (change.to <= range.from || change.from >= range.to)
|
922 |
-
intact2.push(range);
|
923 |
-
else {
|
924 |
-
if (change.from > range.from)
|
925 |
-
intact2.push({from: range.from, to: change.from, domStart: range.domStart});
|
926 |
-
if (change.to < range.to)
|
927 |
-
intact2.push({from: change.to + diff, to: range.to + diff,
|
928 |
-
domStart: range.domStart + (change.to - range.from)});
|
929 |
-
}
|
930 |
-
}
|
931 |
-
intact = intact2;
|
932 |
-
}
|
933 |
-
return intact;
|
934 |
-
}
|
935 |
-
|
936 |
-
function patchDisplay(from, to, intact) {
|
937 |
-
// The first pass removes the DOM nodes that aren't intact.
|
938 |
-
if (!intact.length) lineDiv.innerHTML = "";
|
939 |
-
else {
|
940 |
-
function killNode(node) {
|
941 |
-
var tmp = node.nextSibling;
|
942 |
-
node.parentNode.removeChild(node);
|
943 |
-
return tmp;
|
944 |
-
}
|
945 |
-
var domPos = 0, curNode = lineDiv.firstChild, n;
|
946 |
-
for (var i = 0; i < intact.length; ++i) {
|
947 |
-
var cur = intact[i];
|
948 |
-
while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}
|
949 |
-
for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}
|
950 |
-
}
|
951 |
-
while (curNode) curNode = killNode(curNode);
|
952 |
-
}
|
953 |
-
// This pass fills in the lines that actually changed.
|
954 |
-
var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;
|
955 |
-
var sfrom = sel.from.line, sto = sel.to.line, inSel = sfrom < from && sto >= from;
|
956 |
-
var scratch = targetDocument.createElement("div"), newElt;
|
957 |
-
doc.iter(from, to, function(line) {
|
958 |
-
var ch1 = null, ch2 = null;
|
959 |
-
if (inSel) {
|
960 |
-
ch1 = 0;
|
961 |
-
if (sto == j) {inSel = false; ch2 = sel.to.ch;}
|
962 |
-
} else if (sfrom == j) {
|
963 |
-
if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
|
964 |
-
else {inSel = true; ch1 = sel.from.ch;}
|
965 |
-
}
|
966 |
-
if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();
|
967 |
-
if (!nextIntact || nextIntact.from > j) {
|
968 |
-
if (line.hidden) scratch.innerHTML = "<pre></pre>";
|
969 |
-
else scratch.innerHTML = line.getHTML(ch1, ch2, true);
|
970 |
-
lineDiv.insertBefore(scratch.firstChild, curNode);
|
971 |
-
} else {
|
972 |
-
curNode = curNode.nextSibling;
|
973 |
-
}
|
974 |
-
++j;
|
975 |
-
});
|
976 |
-
}
|
977 |
-
|
978 |
-
function updateGutter() {
|
979 |
-
if (!options.gutter && !options.lineNumbers) return;
|
980 |
-
var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
|
981 |
-
gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
|
982 |
-
var html = [], i = showingFrom;
|
983 |
-
doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {
|
984 |
-
if (line.hidden) {
|
985 |
-
html.push("<pre></pre>");
|
986 |
-
} else {
|
987 |
-
var marker = line.gutterMarker;
|
988 |
-
var text = options.lineNumbers ? i + options.firstLineNumber : null;
|
989 |
-
if (marker && marker.text)
|
990 |
-
text = marker.text.replace("%N%", text != null ? text : "");
|
991 |
-
else if (text == null)
|
992 |
-
text = "\u00a0";
|
993 |
-
html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text);
|
994 |
-
for (var j = 1; j < line.height; ++j) html.push("<br> ");
|
995 |
-
html.push("</pre>");
|
996 |
-
}
|
997 |
-
++i;
|
998 |
-
});
|
999 |
-
gutter.style.display = "none";
|
1000 |
-
gutterText.innerHTML = html.join("");
|
1001 |
-
var minwidth = String(doc.size).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = "";
|
1002 |
-
while (val.length + pad.length < minwidth) pad += "\u00a0";
|
1003 |
-
if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);
|
1004 |
-
gutter.style.display = "";
|
1005 |
-
lineSpace.style.marginLeft = gutter.offsetWidth + "px";
|
1006 |
-
gutterDirty = false;
|
1007 |
-
}
|
1008 |
-
function updateCursor() {
|
1009 |
-
var head = sel.inverted ? sel.from : sel.to, lh = textHeight();
|
1010 |
-
var pos = localCoords(head, true);
|
1011 |
-
var globalY = pos.y + displayOffset * textHeight();
|
1012 |
-
inputDiv.style.top = Math.max(Math.min(globalY, scroller.offsetHeight), 0) + "px";
|
1013 |
-
inputDiv.style.left = (pos.x - scroller.scrollLeft) + "px";
|
1014 |
-
if (posEq(sel.from, sel.to)) {
|
1015 |
-
cursor.style.top = pos.y + "px";
|
1016 |
-
cursor.style.left = (options.lineWrapping ? Math.min(pos.x, lineSpace.offsetWidth) : pos.x) + "px";
|
1017 |
-
cursor.style.display = "";
|
1018 |
-
}
|
1019 |
-
else cursor.style.display = "none";
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
function setSelectionUser(from, to) {
|
1023 |
-
var sh = shiftSelecting && clipPos(shiftSelecting);
|
1024 |
-
if (sh) {
|
1025 |
-
if (posLess(sh, from)) from = sh;
|
1026 |
-
else if (posLess(to, sh)) to = sh;
|
1027 |
-
}
|
1028 |
-
setSelection(from, to);
|
1029 |
-
}
|
1030 |
-
// Update the selection. Last two args are only used by
|
1031 |
-
// updateLines, since they have to be expressed in the line
|
1032 |
-
// numbers before the update.
|
1033 |
-
function setSelection(from, to, oldFrom, oldTo) {
|
1034 |
-
if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
|
1035 |
-
if (posEq(sel.from, from) && posEq(sel.to, to)) return;
|
1036 |
-
if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
|
1037 |
-
|
1038 |
-
// Skip over hidden lines.
|
1039 |
-
if (from.line != oldFrom) from = skipHidden(from, oldFrom, sel.from.ch);
|
1040 |
-
if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
|
1041 |
-
|
1042 |
-
if (posEq(from, to)) sel.inverted = false;
|
1043 |
-
else if (posEq(from, sel.to)) sel.inverted = false;
|
1044 |
-
else if (posEq(to, sel.from)) sel.inverted = true;
|
1045 |
-
|
1046 |
-
// Some ugly logic used to only mark the lines that actually did
|
1047 |
-
// see a change in selection as changed, rather than the whole
|
1048 |
-
// selected range.
|
1049 |
-
if (posEq(from, to)) {
|
1050 |
-
if (!posEq(sel.from, sel.to))
|
1051 |
-
changes.push({from: oldFrom, to: oldTo + 1});
|
1052 |
-
}
|
1053 |
-
else if (posEq(sel.from, sel.to)) {
|
1054 |
-
changes.push({from: from.line, to: to.line + 1});
|
1055 |
-
}
|
1056 |
-
else {
|
1057 |
-
if (!posEq(from, sel.from)) {
|
1058 |
-
if (from.line < oldFrom)
|
1059 |
-
changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});
|
1060 |
-
else
|
1061 |
-
changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});
|
1062 |
-
}
|
1063 |
-
if (!posEq(to, sel.to)) {
|
1064 |
-
if (to.line < oldTo)
|
1065 |
-
changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});
|
1066 |
-
else
|
1067 |
-
changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});
|
1068 |
-
}
|
1069 |
-
}
|
1070 |
-
sel.from = from; sel.to = to;
|
1071 |
-
selectionChanged = true;
|
1072 |
-
}
|
1073 |
-
function skipHidden(pos, oldLine, oldCh) {
|
1074 |
-
function getNonHidden(dir) {
|
1075 |
-
var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;
|
1076 |
-
while (lNo != end) {
|
1077 |
-
var line = getLine(lNo);
|
1078 |
-
if (!line.hidden) {
|
1079 |
-
var ch = pos.ch;
|
1080 |
-
if (ch > oldCh || ch > line.text.length) ch = line.text.length;
|
1081 |
-
return {line: lNo, ch: ch};
|
1082 |
-
}
|
1083 |
-
lNo += dir;
|
1084 |
-
}
|
1085 |
-
}
|
1086 |
-
var line = getLine(pos.line);
|
1087 |
-
if (!line.hidden) return pos;
|
1088 |
-
if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);
|
1089 |
-
else return getNonHidden(-1) || getNonHidden(1);
|
1090 |
-
}
|
1091 |
-
function setCursor(line, ch, user) {
|
1092 |
-
var pos = clipPos({line: line, ch: ch || 0});
|
1093 |
-
(user ? setSelectionUser : setSelection)(pos, pos);
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}
|
1097 |
-
function clipPos(pos) {
|
1098 |
-
if (pos.line < 0) return {line: 0, ch: 0};
|
1099 |
-
if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};
|
1100 |
-
var ch = pos.ch, linelen = getLine(pos.line).text.length;
|
1101 |
-
if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
|
1102 |
-
else if (ch < 0) return {line: pos.line, ch: 0};
|
1103 |
-
else return pos;
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
function scrollPage(down) {
|
1107 |
-
var linesPerPage = Math.floor(scroller.clientHeight / textHeight()), head = sel.inverted ? sel.from : sel.to;
|
1108 |
-
var target = heightAtLine(doc, head.line) + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1));
|
1109 |
-
setCursor(lineAtHeight(doc, target), head.ch, true);
|
1110 |
-
}
|
1111 |
-
function scrollEnd(top) {
|
1112 |
-
var pos = top ? {line: 0, ch: 0} : {line: doc.size - 1, ch: getLine(doc.size-1).text.length};
|
1113 |
-
setSelectionUser(pos, pos);
|
1114 |
-
}
|
1115 |
-
function selectAll() {
|
1116 |
-
var endLine = doc.size - 1;
|
1117 |
-
setSelection({line: 0, ch: 0}, {line: endLine, ch: getLine(endLine).text.length});
|
1118 |
-
}
|
1119 |
-
function selectWordAt(pos) {
|
1120 |
-
var line = getLine(pos.line).text;
|
1121 |
-
var start = pos.ch, end = pos.ch;
|
1122 |
-
while (start > 0 && /\w/.test(line.charAt(start - 1))) --start;
|
1123 |
-
while (end < line.length && /\w/.test(line.charAt(end))) ++end;
|
1124 |
-
setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
|
1125 |
-
}
|
1126 |
-
function selectLine(line) {
|
1127 |
-
setSelectionUser({line: line, ch: 0}, {line: line, ch: getLine(line).text.length});
|
1128 |
-
}
|
1129 |
-
function handleEnter() {
|
1130 |
-
replaceSelection("\n", "end");
|
1131 |
-
if (options.enterMode != "flat")
|
1132 |
-
indentLine(sel.from.line, options.enterMode == "keep" ? "prev" : "smart");
|
1133 |
-
}
|
1134 |
-
function handleTab(shift) {
|
1135 |
-
function indentSelected(mode) {
|
1136 |
-
if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
|
1137 |
-
var e = sel.to.line - (sel.to.ch ? 0 : 1);
|
1138 |
-
for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
|
1139 |
-
}
|
1140 |
-
shiftSelecting = null;
|
1141 |
-
switch (options.tabMode) {
|
1142 |
-
case "default":
|
1143 |
-
return false;
|
1144 |
-
case "indent":
|
1145 |
-
indentSelected("smart");
|
1146 |
-
break;
|
1147 |
-
case "classic":
|
1148 |
-
if (posEq(sel.from, sel.to)) {
|
1149 |
-
if (shift) indentLine(sel.from.line, "smart");
|
1150 |
-
else replaceSelection("\t", "end");
|
1151 |
-
break;
|
1152 |
-
}
|
1153 |
-
case "shift":
|
1154 |
-
indentSelected(shift ? "subtract" : "add");
|
1155 |
-
break;
|
1156 |
-
}
|
1157 |
-
return true;
|
1158 |
-
}
|
1159 |
-
function smartHome() {
|
1160 |
-
var firstNonWS = Math.max(0, getLine(sel.from.line).text.search(/\S/));
|
1161 |
-
setCursor(sel.from.line, sel.from.ch <= firstNonWS && sel.from.ch ? 0 : firstNonWS, true);
|
1162 |
-
}
|
1163 |
-
|
1164 |
-
function indentLine(n, how) {
|
1165 |
-
if (how == "smart") {
|
1166 |
-
if (!mode.indent) how = "prev";
|
1167 |
-
else var state = getStateBefore(n);
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
var line = getLine(n), curSpace = line.indentation(), curSpaceString = line.text.match(/^\s*/)[0], indentation;
|
1171 |
-
if (how == "prev") {
|
1172 |
-
if (n) indentation = getLine(n-1).indentation();
|
1173 |
-
else indentation = 0;
|
1174 |
-
}
|
1175 |
-
else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length));
|
1176 |
-
else if (how == "add") indentation = curSpace + options.indentUnit;
|
1177 |
-
else if (how == "subtract") indentation = curSpace - options.indentUnit;
|
1178 |
-
indentation = Math.max(0, indentation);
|
1179 |
-
var diff = indentation - curSpace;
|
1180 |
-
|
1181 |
-
if (!diff) {
|
1182 |
-
if (sel.from.line != n && sel.to.line != n) return;
|
1183 |
-
var indentString = curSpaceString;
|
1184 |
-
}
|
1185 |
-
else {
|
1186 |
-
var indentString = "", pos = 0;
|
1187 |
-
if (options.indentWithTabs)
|
1188 |
-
for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
|
1189 |
-
while (pos < indentation) {++pos; indentString += " ";}
|
1190 |
-
}
|
1191 |
-
|
1192 |
-
replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
|
1193 |
-
}
|
1194 |
-
|
1195 |
-
function loadMode() {
|
1196 |
-
mode = CodeMirror.getMode(options, options.mode);
|
1197 |
-
doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
|
1198 |
-
work = [0];
|
1199 |
-
startWorker();
|
1200 |
-
}
|
1201 |
-
function gutterChanged() {
|
1202 |
-
var visible = options.gutter || options.lineNumbers;
|
1203 |
-
gutter.style.display = visible ? "" : "none";
|
1204 |
-
if (visible) gutterDirty = true;
|
1205 |
-
else lineDiv.parentNode.style.marginLeft = 0;
|
1206 |
-
}
|
1207 |
-
function wrappingChanged(from, to) {
|
1208 |
-
if (options.lineWrapping) {
|
1209 |
-
wrapper.className += " CodeMirror-wrap";
|
1210 |
-
var perLine = scroller.clientWidth / charWidth() - 3;
|
1211 |
-
doc.iter(0, doc.size, function(line) {
|
1212 |
-
if (line.hidden) return;
|
1213 |
-
var guess = Math.ceil(line.text.length / perLine) || 1;
|
1214 |
-
if (guess != 1) updateLineHeight(line, guess);
|
1215 |
-
});
|
1216 |
-
lineSpace.style.width = code.style.width = "";
|
1217 |
-
} else {
|
1218 |
-
wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");
|
1219 |
-
maxWidth = null; maxLine = "";
|
1220 |
-
doc.iter(0, doc.size, function(line) {
|
1221 |
-
if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);
|
1222 |
-
if (line.text.length > maxLine.length) maxLine = line.text;
|
1223 |
-
});
|
1224 |
-
}
|
1225 |
-
changes.push({from: 0, to: doc.size});
|
1226 |
-
}
|
1227 |
-
|
1228 |
-
function TextMarker() { this.set = []; }
|
1229 |
-
TextMarker.prototype.clear = operation(function() {
|
1230 |
-
for (var i = 0, e = this.set.length; i < e; ++i) {
|
1231 |
-
var mk = this.set[i].marked;
|
1232 |
-
if (!mk) continue;
|
1233 |
-
for (var j = 0; j < mk.length; ++j)
|
1234 |
-
if (mk[j].set == this.set) mk.splice(j--, 1);
|
1235 |
-
}
|
1236 |
-
// We don't know the exact lines that changed. Refreshing is
|
1237 |
-
// cheaper than finding them.
|
1238 |
-
changes.push({from: 0, to: doc.size});
|
1239 |
-
});
|
1240 |
-
TextMarker.prototype.find = function() {
|
1241 |
-
var from, to;
|
1242 |
-
for (var i = 0, e = this.set.length; i < e; ++i) {
|
1243 |
-
var line = this.set[i], mk = line.marked;
|
1244 |
-
for (var j = 0; j < mk.length; ++j) {
|
1245 |
-
var mark = mk[j];
|
1246 |
-
if (mark.set == this.set) {
|
1247 |
-
if (mark.from != null || mark.to != null) {
|
1248 |
-
var found = lineNo(line);
|
1249 |
-
if (found != null) {
|
1250 |
-
if (mark.from != null) from = {line: found, ch: mark.from};
|
1251 |
-
if (mark.to != null) to = {line: found, ch: mark.to};
|
1252 |
-
}
|
1253 |
-
}
|
1254 |
-
}
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
return {from: from, to: to};
|
1258 |
-
};
|
1259 |
-
|
1260 |
-
function markText(from, to, className) {
|
1261 |
-
from = clipPos(from); to = clipPos(to);
|
1262 |
-
var tm = new TextMarker();
|
1263 |
-
function add(line, from, to, className) {
|
1264 |
-
mark = getLine(line).addMark(new MarkedText(from, to, className, tm.set));
|
1265 |
-
}
|
1266 |
-
if (from.line == to.line) add(from.line, from.ch, to.ch, className);
|
1267 |
-
else {
|
1268 |
-
add(from.line, from.ch, null, className);
|
1269 |
-
for (var i = from.line + 1, e = to.line; i < e; ++i)
|
1270 |
-
add(i, null, null, className);
|
1271 |
-
add(to.line, null, to.ch, className);
|
1272 |
-
}
|
1273 |
-
changes.push({from: from.line, to: to.line + 1});
|
1274 |
-
return tm;
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
function setBookmark(pos) {
|
1278 |
-
pos = clipPos(pos);
|
1279 |
-
var bm = new Bookmark(pos.ch);
|
1280 |
-
getLine(pos.line).addMark(bm);
|
1281 |
-
return bm;
|
1282 |
-
}
|
1283 |
-
|
1284 |
-
function addGutterMarker(line, text, className) {
|
1285 |
-
if (typeof line == "number") line = getLine(clipLine(line));
|
1286 |
-
line.gutterMarker = {text: text, style: className};
|
1287 |
-
gutterDirty = true;
|
1288 |
-
return line;
|
1289 |
-
}
|
1290 |
-
function removeGutterMarker(line) {
|
1291 |
-
if (typeof line == "number") line = getLine(clipLine(line));
|
1292 |
-
line.gutterMarker = null;
|
1293 |
-
gutterDirty = true;
|
1294 |
-
}
|
1295 |
-
|
1296 |
-
function changeLine(handle, op) {
|
1297 |
-
var no = handle, line = handle;
|
1298 |
-
if (typeof handle == "number") line = getLine(clipLine(handle));
|
1299 |
-
else no = lineNo(handle);
|
1300 |
-
if (no == null) return null;
|
1301 |
-
if (op(line, no)) changes.push({from: no, to: no + 1});
|
1302 |
-
return line;
|
1303 |
-
}
|
1304 |
-
function setLineClass(handle, className) {
|
1305 |
-
return changeLine(handle, function(line) {
|
1306 |
-
if (line.className != className) {
|
1307 |
-
line.className = className;
|
1308 |
-
return true;
|
1309 |
-
}
|
1310 |
-
});
|
1311 |
-
}
|
1312 |
-
function setLineHidden(handle, hidden) {
|
1313 |
-
return changeLine(handle, function(line, no) {
|
1314 |
-
if (line.hidden != hidden) {
|
1315 |
-
line.hidden = hidden;
|
1316 |
-
updateLineHeight(line, hidden ? 0 : 1);
|
1317 |
-
if (hidden && (sel.from.line == no || sel.to.line == no))
|
1318 |
-
setSelection(skipHidden(sel.from, sel.from.line, sel.from.ch),
|
1319 |
-
skipHidden(sel.to, sel.to.line, sel.to.ch));
|
1320 |
-
return (gutterDirty = true);
|
1321 |
-
}
|
1322 |
-
});
|
1323 |
-
}
|
1324 |
-
|
1325 |
-
function lineInfo(line) {
|
1326 |
-
if (typeof line == "number") {
|
1327 |
-
if (!isLine(line)) return null;
|
1328 |
-
var n = line;
|
1329 |
-
line = getLine(line);
|
1330 |
-
if (!line) return null;
|
1331 |
-
}
|
1332 |
-
else {
|
1333 |
-
var n = lineNo(line);
|
1334 |
-
if (n == null) return null;
|
1335 |
-
}
|
1336 |
-
var marker = line.gutterMarker;
|
1337 |
-
return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
|
1338 |
-
markerClass: marker && marker.style, lineClass: line.className};
|
1339 |
-
}
|
1340 |
-
|
1341 |
-
function stringWidth(str) {
|
1342 |
-
measure.innerHTML = "<pre><span>x</span></pre>";
|
1343 |
-
measure.firstChild.firstChild.firstChild.nodeValue = str;
|
1344 |
-
return measure.firstChild.firstChild.offsetWidth || 10;
|
1345 |
-
}
|
1346 |
-
// These are used to go from pixel positions to character
|
1347 |
-
// positions, taking varying character widths into account.
|
1348 |
-
function charFromX(line, x) {
|
1349 |
-
if (x <= 0) return 0;
|
1350 |
-
var lineObj = getLine(line), text = lineObj.text;
|
1351 |
-
function getX(len) {
|
1352 |
-
measure.innerHTML = "<pre><span>" + lineObj.getHTML(null, null, false, len) + "</span></pre>";
|
1353 |
-
return measure.firstChild.firstChild.offsetWidth;
|
1354 |
-
}
|
1355 |
-
var from = 0, fromX = 0, to = text.length, toX;
|
1356 |
-
// Guess a suitable upper bound for our search.
|
1357 |
-
var estimated = Math.min(to, Math.ceil(x / charWidth()));
|
1358 |
-
for (;;) {
|
1359 |
-
var estX = getX(estimated);
|
1360 |
-
if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
|
1361 |
-
else {toX = estX; to = estimated; break;}
|
1362 |
-
}
|
1363 |
-
if (x > toX) return to;
|
1364 |
-
// Try to guess a suitable lower bound as well.
|
1365 |
-
estimated = Math.floor(to * 0.8); estX = getX(estimated);
|
1366 |
-
if (estX < x) {from = estimated; fromX = estX;}
|
1367 |
-
// Do a binary search between these bounds.
|
1368 |
-
for (;;) {
|
1369 |
-
if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
|
1370 |
-
var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
|
1371 |
-
if (middleX > x) {to = middle; toX = middleX;}
|
1372 |
-
else {from = middle; fromX = middleX;}
|
1373 |
-
}
|
1374 |
-
}
|
1375 |
-
|
1376 |
-
var tempId = Math.floor(Math.random() * 0xffffff).toString(16);
|
1377 |
-
function measureLine(line, ch) {
|
1378 |
-
var extra = "";
|
1379 |
-
// Include extra text at the end to make sure the measured line is wrapped in the right way.
|
1380 |
-
if (options.lineWrapping) {
|
1381 |
-
var end = line.text.indexOf(" ", ch + 2);
|
1382 |
-
extra = line.text.slice(ch + 1, end < 0 ? line.text.length : end + (ie ? 5 : 0));
|
1383 |
-
}
|
1384 |
-
measure.innerHTML = "<pre>" + line.getHTML(null, null, false, ch) +
|
1385 |
-
'<span id="CodeMirror-temp-' + tempId + '">' + (line.text.charAt(ch) || " ") + "</span>" +
|
1386 |
-
extra + "</pre>";
|
1387 |
-
var elt = document.getElementById("CodeMirror-temp-" + tempId);
|
1388 |
-
var top = elt.offsetTop, left = elt.offsetLeft;
|
1389 |
-
// Older IEs report zero offsets for spans directly after a wrap
|
1390 |
-
if (ie && ch && top == 0 && left == 0) {
|
1391 |
-
var backup = document.createElement("span");
|
1392 |
-
backup.innerHTML = "x";
|
1393 |
-
elt.parentNode.insertBefore(backup, elt.nextSibling);
|
1394 |
-
top = backup.offsetTop;
|
1395 |
-
}
|
1396 |
-
return {top: top, left: left};
|
1397 |
-
}
|
1398 |
-
function localCoords(pos, inLineWrap) {
|
1399 |
-
var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));
|
1400 |
-
if (pos.ch == 0) x = 0;
|
1401 |
-
else {
|
1402 |
-
var sp = measureLine(getLine(pos.line), pos.ch);
|
1403 |
-
x = sp.left;
|
1404 |
-
if (options.lineWrapping) y += Math.max(0, sp.top);
|
1405 |
-
}
|
1406 |
-
return {x: x, y: y, yBot: y + lh};
|
1407 |
-
}
|
1408 |
-
// Coords must be lineSpace-local
|
1409 |
-
function coordsChar(x, y) {
|
1410 |
-
if (y < 0) y = 0;
|
1411 |
-
var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
|
1412 |
-
var lineNo = lineAtHeight(doc, heightPos);
|
1413 |
-
if (lineNo >= doc.size) return {line: doc.size - 1, ch: 0};
|
1414 |
-
var lineObj = getLine(lineNo), text = lineObj.text;
|
1415 |
-
var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;
|
1416 |
-
if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};
|
1417 |
-
function getX(len) {
|
1418 |
-
var sp = measureLine(lineObj, len);
|
1419 |
-
if (tw) {
|
1420 |
-
var off = Math.round(sp.top / th);
|
1421 |
-
return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);
|
1422 |
-
}
|
1423 |
-
return sp.left;
|
1424 |
-
}
|
1425 |
-
var from = 0, fromX = 0, to = text.length, toX;
|
1426 |
-
// Guess a suitable upper bound for our search.
|
1427 |
-
var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));
|
1428 |
-
for (;;) {
|
1429 |
-
var estX = getX(estimated);
|
1430 |
-
if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
|
1431 |
-
else {toX = estX; to = estimated; break;}
|
1432 |
-
}
|
1433 |
-
if (x > toX) return {line: lineNo, ch: to};
|
1434 |
-
// Try to guess a suitable lower bound as well.
|
1435 |
-
estimated = Math.floor(to * 0.8); estX = getX(estimated);
|
1436 |
-
if (estX < x) {from = estimated; fromX = estX;}
|
1437 |
-
// Do a binary search between these bounds.
|
1438 |
-
for (;;) {
|
1439 |
-
if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};
|
1440 |
-
var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
|
1441 |
-
if (middleX > x) {to = middle; toX = middleX;}
|
1442 |
-
else {from = middle; fromX = middleX;}
|
1443 |
-
}
|
1444 |
-
}
|
1445 |
-
function pageCoords(pos) {
|
1446 |
-
var local = localCoords(pos, true), off = eltOffset(lineSpace);
|
1447 |
-
return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
|
1448 |
-
}
|
1449 |
-
|
1450 |
-
var cachedHeight, cachedFor;
|
1451 |
-
function textHeight() {
|
1452 |
-
var offsetHeight = lineDiv.offsetHeight;
|
1453 |
-
if (offsetHeight == cachedFor) return cachedHeight;
|
1454 |
-
cachedFor = offsetHeight;
|
1455 |
-
measure.innerHTML = "<pre>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x</pre>";
|
1456 |
-
return (cachedHeight = measure.firstChild.offsetHeight / 10 || 1);
|
1457 |
-
}
|
1458 |
-
var cachedWidth, cachedFor = 0;
|
1459 |
-
function charWidth() {
|
1460 |
-
if (scroller.clientWidth == cachedFor) return cachedWidth;
|
1461 |
-
cachedFor = scroller.clientWidth;
|
1462 |
-
return (cachedWidth = stringWidth("x"));
|
1463 |
-
}
|
1464 |
-
function paddingTop() {return lineSpace.offsetTop;}
|
1465 |
-
function paddingLeft() {return lineSpace.offsetLeft;}
|
1466 |
-
|
1467 |
-
function posFromMouse(e, liberal) {
|
1468 |
-
var offW = eltOffset(scroller, true), x, y;
|
1469 |
-
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
1470 |
-
try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
|
1471 |
-
// This is a mess of a heuristic to try and determine whether a
|
1472 |
-
// scroll-bar was clicked or not, and to return null if one was
|
1473 |
-
// (and !liberal).
|
1474 |
-
if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
|
1475 |
-
return null;
|
1476 |
-
var offL = eltOffset(lineSpace, true);
|
1477 |
-
return coordsChar(x - offL.left, y - offL.top);
|
1478 |
-
}
|
1479 |
-
function onContextMenu(e) {
|
1480 |
-
var pos = posFromMouse(e);
|
1481 |
-
if (!pos || window.opera) return; // Opera is difficult.
|
1482 |
-
if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
|
1483 |
-
operation(setCursor)(pos.line, pos.ch);
|
1484 |
-
|
1485 |
-
var oldCSS = input.style.cssText;
|
1486 |
-
inputDiv.style.position = "absolute";
|
1487 |
-
input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
|
1488 |
-
"px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
|
1489 |
-
"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
|
1490 |
-
leaveInputAlone = true;
|
1491 |
-
var val = input.value = getSelection();
|
1492 |
-
focusInput();
|
1493 |
-
setSelRange(input, 0, input.value.length);
|
1494 |
-
function rehide() {
|
1495 |
-
var newVal = splitLines(input.value).join("\n");
|
1496 |
-
if (newVal != val) operation(replaceSelection)(newVal, "end");
|
1497 |
-
inputDiv.style.position = "relative";
|
1498 |
-
input.style.cssText = oldCSS;
|
1499 |
-
leaveInputAlone = false;
|
1500 |
-
prepareInput();
|
1501 |
-
slowPoll();
|
1502 |
-
}
|
1503 |
-
|
1504 |
-
if (gecko) {
|
1505 |
-
e_stop(e);
|
1506 |
-
var mouseup = connect(window, "mouseup", function() {
|
1507 |
-
mouseup();
|
1508 |
-
setTimeout(rehide, 20);
|
1509 |
-
}, true);
|
1510 |
-
}
|
1511 |
-
else {
|
1512 |
-
setTimeout(rehide, 50);
|
1513 |
-
}
|
1514 |
-
}
|
1515 |
-
|
1516 |
-
// Cursor-blinking
|
1517 |
-
function restartBlink() {
|
1518 |
-
clearInterval(blinker);
|
1519 |
-
var on = true;
|
1520 |
-
cursor.style.visibility = "";
|
1521 |
-
blinker = setInterval(function() {
|
1522 |
-
cursor.style.visibility = (on = !on) ? "" : "hidden";
|
1523 |
-
}, 650);
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
1527 |
-
function matchBrackets(autoclear) {
|
1528 |
-
var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;
|
1529 |
-
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
|
1530 |
-
if (!match) return;
|
1531 |
-
var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
|
1532 |
-
for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
|
1533 |
-
if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
|
1534 |
-
|
1535 |
-
var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
|
1536 |
-
function scan(line, from, to) {
|
1537 |
-
if (!line.text) return;
|
1538 |
-
var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
|
1539 |
-
for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
|
1540 |
-
var text = st[i];
|
1541 |
-
if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
|
1542 |
-
for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
|
1543 |
-
if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
|
1544 |
-
var match = matching[cur];
|
1545 |
-
if (match.charAt(1) == ">" == forward) stack.push(cur);
|
1546 |
-
else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
|
1547 |
-
else if (!stack.length) return {pos: pos, match: true};
|
1548 |
-
}
|
1549 |
-
}
|
1550 |
-
}
|
1551 |
-
}
|
1552 |
-
for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {
|
1553 |
-
var line = getLine(i), first = i == head.line;
|
1554 |
-
var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
|
1555 |
-
if (found) break;
|
1556 |
-
}
|
1557 |
-
if (!found) found = {pos: null, match: false};
|
1558 |
-
var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
1559 |
-
var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
|
1560 |
-
two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
|
1561 |
-
var clear = operation(function(){one.clear(); two && two.clear();});
|
1562 |
-
if (autoclear) setTimeout(clear, 800);
|
1563 |
-
else bracketHighlighted = clear;
|
1564 |
-
}
|
1565 |
-
|
1566 |
-
// Finds the line to start with when starting a parse. Tries to
|
1567 |
-
// find a line with a stateAfter, so that it can start with a
|
1568 |
-
// valid state. If that fails, it returns the line with the
|
1569 |
-
// smallest indentation, which tends to need the least context to
|
1570 |
-
// parse correctly.
|
1571 |
-
function findStartLine(n) {
|
1572 |
-
var minindent, minline;
|
1573 |
-
for (var search = n, lim = n - 40; search > lim; --search) {
|
1574 |
-
if (search == 0) return 0;
|
1575 |
-
var line = getLine(search-1);
|
1576 |
-
if (line.stateAfter) return search;
|
1577 |
-
var indented = line.indentation();
|
1578 |
-
if (minline == null || minindent > indented) {
|
1579 |
-
minline = search - 1;
|
1580 |
-
minindent = indented;
|
1581 |
-
}
|
1582 |
-
}
|
1583 |
-
return minline;
|
1584 |
-
}
|
1585 |
-
function getStateBefore(n) {
|
1586 |
-
var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
|
1587 |
-
if (!state) state = startState(mode);
|
1588 |
-
else state = copyState(mode, state);
|
1589 |
-
doc.iter(start, n, function(line) {
|
1590 |
-
line.highlight(mode, state);
|
1591 |
-
line.stateAfter = copyState(mode, state);
|
1592 |
-
});
|
1593 |
-
if (start < n) changes.push({from: start, to: n});
|
1594 |
-
if (n < doc.size && !getLine(n).stateAfter) work.push(n);
|
1595 |
-
return state;
|
1596 |
-
}
|
1597 |
-
function highlightLines(start, end) {
|
1598 |
-
var state = getStateBefore(start);
|
1599 |
-
doc.iter(start, end, function(line) {
|
1600 |
-
line.highlight(mode, state);
|
1601 |
-
line.stateAfter = copyState(mode, state);
|
1602 |
-
});
|
1603 |
-
}
|
1604 |
-
function highlightWorker() {
|
1605 |
-
var end = +new Date + options.workTime;
|
1606 |
-
var foundWork = work.length;
|
1607 |
-
while (work.length) {
|
1608 |
-
if (!getLine(showingFrom).stateAfter) var task = showingFrom;
|
1609 |
-
else var task = work.pop();
|
1610 |
-
if (task >= doc.size) continue;
|
1611 |
-
var start = findStartLine(task), state = start && getLine(start-1).stateAfter;
|
1612 |
-
if (state) state = copyState(mode, state);
|
1613 |
-
else state = startState(mode);
|
1614 |
-
|
1615 |
-
var unchanged = 0, compare = mode.compareStates, realChange = false,
|
1616 |
-
i = start, bail = false;
|
1617 |
-
doc.iter(i, doc.size, function(line) {
|
1618 |
-
var hadState = line.stateAfter;
|
1619 |
-
if (+new Date > end) {
|
1620 |
-
work.push(i);
|
1621 |
-
startWorker(options.workDelay);
|
1622 |
-
if (realChange) changes.push({from: task, to: i + 1});
|
1623 |
-
return (bail = true);
|
1624 |
-
}
|
1625 |
-
var changed = line.highlight(mode, state);
|
1626 |
-
if (changed) realChange = true;
|
1627 |
-
line.stateAfter = copyState(mode, state);
|
1628 |
-
if (compare) {
|
1629 |
-
if (hadState && compare(hadState, state)) return true;
|
1630 |
-
} else {
|
1631 |
-
if (changed !== false || !hadState) unchanged = 0;
|
1632 |
-
else if (++unchanged > 3) return true;
|
1633 |
-
}
|
1634 |
-
++i;
|
1635 |
-
});
|
1636 |
-
if (bail) return;
|
1637 |
-
if (realChange) changes.push({from: task, to: i + 1});
|
1638 |
-
}
|
1639 |
-
if (foundWork && options.onHighlightComplete)
|
1640 |
-
options.onHighlightComplete(instance);
|
1641 |
-
}
|
1642 |
-
function startWorker(time) {
|
1643 |
-
if (!work.length) return;
|
1644 |
-
highlight.set(time, operation(highlightWorker));
|
1645 |
-
}
|
1646 |
-
|
1647 |
-
// Operations are used to wrap changes in such a way that each
|
1648 |
-
// change won't have to update the cursor and display (which would
|
1649 |
-
// be awkward, slow, and error-prone), but instead updates are
|
1650 |
-
// batched and then all combined and executed at once.
|
1651 |
-
function startOperation() {
|
1652 |
-
updateInput = null; changes = []; textChanged = selectionChanged = false;
|
1653 |
-
}
|
1654 |
-
function endOperation() {
|
1655 |
-
var reScroll = false;
|
1656 |
-
if (selectionChanged) reScroll = !scrollCursorIntoView();
|
1657 |
-
if (changes.length) updateDisplay(changes);
|
1658 |
-
else {
|
1659 |
-
if (selectionChanged) updateCursor();
|
1660 |
-
if (gutterDirty) updateGutter();
|
1661 |
-
}
|
1662 |
-
if (reScroll) scrollCursorIntoView();
|
1663 |
-
if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
|
1664 |
-
|
1665 |
-
// updateInput can be set to a boolean value to force/prevent an
|
1666 |
-
// update.
|
1667 |
-
if (focused && !leaveInputAlone &&
|
1668 |
-
(updateInput === true || (updateInput !== false && selectionChanged)))
|
1669 |
-
prepareInput();
|
1670 |
-
|
1671 |
-
if (selectionChanged && options.matchBrackets)
|
1672 |
-
setTimeout(operation(function() {
|
1673 |
-
if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
|
1674 |
-
matchBrackets(false);
|
1675 |
-
}), 20);
|
1676 |
-
var tc = textChanged; // textChanged can be reset by cursoractivity callback
|
1677 |
-
if (selectionChanged && options.onCursorActivity)
|
1678 |
-
options.onCursorActivity(instance);
|
1679 |
-
if (tc && options.onChange && instance)
|
1680 |
-
options.onChange(instance, tc);
|
1681 |
-
}
|
1682 |
-
var nestedOperation = 0;
|
1683 |
-
function operation(f) {
|
1684 |
-
return function() {
|
1685 |
-
if (!nestedOperation++) startOperation();
|
1686 |
-
try {var result = f.apply(this, arguments);}
|
1687 |
-
finally {if (!--nestedOperation) endOperation();}
|
1688 |
-
return result;
|
1689 |
-
};
|
1690 |
-
}
|
1691 |
-
|
1692 |
-
function SearchCursor(query, pos, caseFold) {
|
1693 |
-
this.atOccurrence = false;
|
1694 |
-
if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();
|
1695 |
-
|
1696 |
-
if (pos && typeof pos == "object") pos = clipPos(pos);
|
1697 |
-
else pos = {line: 0, ch: 0};
|
1698 |
-
this.pos = {from: pos, to: pos};
|
1699 |
-
|
1700 |
-
// The matches method is filled in based on the type of query.
|
1701 |
-
// It takes a position and a direction, and returns an object
|
1702 |
-
// describing the next occurrence of the query, or null if no
|
1703 |
-
// more matches were found.
|
1704 |
-
if (typeof query != "string") // Regexp match
|
1705 |
-
this.matches = function(reverse, pos) {
|
1706 |
-
if (reverse) {
|
1707 |
-
var line = getLine(pos.line).text.slice(0, pos.ch), match = line.match(query), start = 0;
|
1708 |
-
while (match) {
|
1709 |
-
var ind = line.indexOf(match[0]);
|
1710 |
-
start += ind;
|
1711 |
-
line = line.slice(ind + 1);
|
1712 |
-
var newmatch = line.match(query);
|
1713 |
-
if (newmatch) match = newmatch;
|
1714 |
-
else break;
|
1715 |
-
start++;
|
1716 |
-
}
|
1717 |
-
}
|
1718 |
-
else {
|
1719 |
-
var line = getLine(pos.line).text.slice(pos.ch), match = line.match(query),
|
1720 |
-
start = match && pos.ch + line.indexOf(match[0]);
|
1721 |
-
}
|
1722 |
-
if (match)
|
1723 |
-
return {from: {line: pos.line, ch: start},
|
1724 |
-
to: {line: pos.line, ch: start + match[0].length},
|
1725 |
-
match: match};
|
1726 |
-
};
|
1727 |
-
else { // String query
|
1728 |
-
if (caseFold) query = query.toLowerCase();
|
1729 |
-
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
|
1730 |
-
var target = query.split("\n");
|
1731 |
-
// Different methods for single-line and multi-line queries
|
1732 |
-
if (target.length == 1)
|
1733 |
-
this.matches = function(reverse, pos) {
|
1734 |
-
var line = fold(getLine(pos.line).text), len = query.length, match;
|
1735 |
-
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
|
1736 |
-
: (match = line.indexOf(query, pos.ch)) != -1)
|
1737 |
-
return {from: {line: pos.line, ch: match},
|
1738 |
-
to: {line: pos.line, ch: match + len}};
|
1739 |
-
};
|
1740 |
-
else
|
1741 |
-
this.matches = function(reverse, pos) {
|
1742 |
-
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(getLine(ln).text);
|
1743 |
-
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
|
1744 |
-
if (reverse ? offsetA >= pos.ch || offsetA != match.length
|
1745 |
-
: offsetA <= pos.ch || offsetA != line.length - match.length)
|
1746 |
-
return;
|
1747 |
-
for (;;) {
|
1748 |
-
if (reverse ? !ln : ln == doc.size - 1) return;
|
1749 |
-
line = fold(getLine(ln += reverse ? -1 : 1).text);
|
1750 |
-
match = target[reverse ? --idx : ++idx];
|
1751 |
-
if (idx > 0 && idx < target.length - 1) {
|
1752 |
-
if (line != match) return;
|
1753 |
-
else continue;
|
1754 |
-
}
|
1755 |
-
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
|
1756 |
-
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
|
1757 |
-
return;
|
1758 |
-
var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
|
1759 |
-
return {from: reverse ? end : start, to: reverse ? start : end};
|
1760 |
-
}
|
1761 |
-
};
|
1762 |
-
}
|
1763 |
-
}
|
1764 |
-
|
1765 |
-
SearchCursor.prototype = {
|
1766 |
-
findNext: function() {return this.find(false);},
|
1767 |
-
findPrevious: function() {return this.find(true);},
|
1768 |
-
|
1769 |
-
find: function(reverse) {
|
1770 |
-
var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);
|
1771 |
-
function savePosAndFail(line) {
|
1772 |
-
var pos = {line: line, ch: 0};
|
1773 |
-
self.pos = {from: pos, to: pos};
|
1774 |
-
self.atOccurrence = false;
|
1775 |
-
return false;
|
1776 |
-
}
|
1777 |
-
|
1778 |
-
for (;;) {
|
1779 |
-
if (this.pos = this.matches(reverse, pos)) {
|
1780 |
-
this.atOccurrence = true;
|
1781 |
-
return this.pos.match || true;
|
1782 |
-
}
|
1783 |
-
if (reverse) {
|
1784 |
-
if (!pos.line) return savePosAndFail(0);
|
1785 |
-
pos = {line: pos.line-1, ch: getLine(pos.line-1).text.length};
|
1786 |
-
}
|
1787 |
-
else {
|
1788 |
-
if (pos.line == doc.size - 1) return savePosAndFail(doc.size);
|
1789 |
-
pos = {line: pos.line+1, ch: 0};
|
1790 |
-
}
|
1791 |
-
}
|
1792 |
-
},
|
1793 |
-
|
1794 |
-
from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},
|
1795 |
-
to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},
|
1796 |
-
|
1797 |
-
replace: function(newText) {
|
1798 |
-
var self = this;
|
1799 |
-
if (this.atOccurrence)
|
1800 |
-
operation(function() {
|
1801 |
-
self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);
|
1802 |
-
})();
|
1803 |
-
}
|
1804 |
-
};
|
1805 |
-
|
1806 |
-
for (var ext in extensions)
|
1807 |
-
if (extensions.propertyIsEnumerable(ext) &&
|
1808 |
-
!instance.propertyIsEnumerable(ext))
|
1809 |
-
instance[ext] = extensions[ext];
|
1810 |
-
return instance;
|
1811 |
-
} // (end of function CodeMirror)
|
1812 |
-
|
1813 |
-
// The default configuration options.
|
1814 |
-
CodeMirror.defaults = {
|
1815 |
-
value: "",
|
1816 |
-
mode: null,
|
1817 |
-
theme: "default",
|
1818 |
-
indentUnit: 2,
|
1819 |
-
indentWithTabs: false,
|
1820 |
-
tabMode: "classic",
|
1821 |
-
enterMode: "indent",
|
1822 |
-
electricChars: true,
|
1823 |
-
onKeyEvent: null,
|
1824 |
-
lineWrapping: false,
|
1825 |
-
lineNumbers: false,
|
1826 |
-
gutter: false,
|
1827 |
-
fixedGutter: false,
|
1828 |
-
firstLineNumber: 1,
|
1829 |
-
readOnly: false,
|
1830 |
-
smartHome: true,
|
1831 |
-
onChange: null,
|
1832 |
-
onCursorActivity: null,
|
1833 |
-
onGutterClick: null,
|
1834 |
-
onHighlightComplete: null,
|
1835 |
-
onFocus: null, onBlur: null, onScroll: null,
|
1836 |
-
matchBrackets: false,
|
1837 |
-
workTime: 100,
|
1838 |
-
workDelay: 200,
|
1839 |
-
undoDepth: 40,
|
1840 |
-
tabindex: null,
|
1841 |
-
pollForIME: false,
|
1842 |
-
document: window.document
|
1843 |
-
};
|
1844 |
-
|
1845 |
-
// Known modes, by name and by MIME
|
1846 |
-
var modes = {}, mimeModes = {};
|
1847 |
-
CodeMirror.defineMode = function(name, mode) {
|
1848 |
-
if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
|
1849 |
-
modes[name] = mode;
|
1850 |
-
};
|
1851 |
-
CodeMirror.defineMIME = function(mime, spec) {
|
1852 |
-
mimeModes[mime] = spec;
|
1853 |
-
};
|
1854 |
-
CodeMirror.getMode = function(options, spec) {
|
1855 |
-
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
|
1856 |
-
spec = mimeModes[spec];
|
1857 |
-
if (typeof spec == "string")
|
1858 |
-
var mname = spec, config = {};
|
1859 |
-
else if (spec != null)
|
1860 |
-
var mname = spec.name, config = spec;
|
1861 |
-
var mfactory = modes[mname];
|
1862 |
-
if (!mfactory) {
|
1863 |
-
if (window.console) console.warn("No mode " + mname + " found, falling back to plain text.");
|
1864 |
-
return CodeMirror.getMode(options, "text/plain");
|
1865 |
-
}
|
1866 |
-
return mfactory(options, config || {});
|
1867 |
-
};
|
1868 |
-
CodeMirror.listModes = function() {
|
1869 |
-
var list = [];
|
1870 |
-
for (var m in modes)
|
1871 |
-
if (modes.propertyIsEnumerable(m)) list.push(m);
|
1872 |
-
return list;
|
1873 |
-
};
|
1874 |
-
CodeMirror.listMIMEs = function() {
|
1875 |
-
var list = [];
|
1876 |
-
for (var m in mimeModes)
|
1877 |
-
if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});
|
1878 |
-
return list;
|
1879 |
-
};
|
1880 |
-
|
1881 |
-
var extensions = {};
|
1882 |
-
CodeMirror.defineExtension = function(name, func) {
|
1883 |
-
extensions[name] = func;
|
1884 |
-
};
|
1885 |
-
|
1886 |
-
CodeMirror.fromTextArea = function(textarea, options) {
|
1887 |
-
if (!options) options = {};
|
1888 |
-
options.value = textarea.value;
|
1889 |
-
if (!options.tabindex && textarea.tabindex)
|
1890 |
-
options.tabindex = textarea.tabindex;
|
1891 |
-
|
1892 |
-
function save() {textarea.value = instance.getValue();}
|
1893 |
-
if (textarea.form) {
|
1894 |
-
// Deplorable hack to make the submit method do the right thing.
|
1895 |
-
var rmSubmit = connect(textarea.form, "submit", save, true);
|
1896 |
-
if (typeof textarea.form.submit == "function") {
|
1897 |
-
var realSubmit = textarea.form.submit;
|
1898 |
-
function wrappedSubmit() {
|
1899 |
-
save();
|
1900 |
-
textarea.form.submit = realSubmit;
|
1901 |
-
textarea.form.submit();
|
1902 |
-
textarea.form.submit = wrappedSubmit;
|
1903 |
-
}
|
1904 |
-
textarea.form.submit = wrappedSubmit;
|
1905 |
-
}
|
1906 |
-
}
|
1907 |
-
|
1908 |
-
textarea.style.display = "none";
|
1909 |
-
var instance = CodeMirror(function(node) {
|
1910 |
-
textarea.parentNode.insertBefore(node, textarea.nextSibling);
|
1911 |
-
}, options);
|
1912 |
-
instance.save = save;
|
1913 |
-
instance.toTextArea = function() {
|
1914 |
-
save();
|
1915 |
-
textarea.parentNode.removeChild(instance.getWrapperElement());
|
1916 |
-
textarea.style.display = "";
|
1917 |
-
if (textarea.form) {
|
1918 |
-
rmSubmit();
|
1919 |
-
if (typeof textarea.form.submit == "function")
|
1920 |
-
textarea.form.submit = realSubmit;
|
1921 |
-
}
|
1922 |
-
};
|
1923 |
-
return instance;
|
1924 |
-
};
|
1925 |
-
|
1926 |
-
// Utility functions for working with state. Exported because modes
|
1927 |
-
// sometimes need to do this.
|
1928 |
-
function copyState(mode, state) {
|
1929 |
-
if (state === true) return state;
|
1930 |
-
if (mode.copyState) return mode.copyState(state);
|
1931 |
-
var nstate = {};
|
1932 |
-
for (var n in state) {
|
1933 |
-
var val = state[n];
|
1934 |
-
if (val instanceof Array) val = val.concat([]);
|
1935 |
-
nstate[n] = val;
|
1936 |
-
}
|
1937 |
-
return nstate;
|
1938 |
-
}
|
1939 |
-
CodeMirror.copyState = copyState;
|
1940 |
-
function startState(mode, a1, a2) {
|
1941 |
-
return mode.startState ? mode.startState(a1, a2) : true;
|
1942 |
-
}
|
1943 |
-
CodeMirror.startState = startState;
|
1944 |
-
|
1945 |
-
// The character stream used by a mode's parser.
|
1946 |
-
function StringStream(string) {
|
1947 |
-
this.pos = this.start = 0;
|
1948 |
-
this.string = string;
|
1949 |
-
}
|
1950 |
-
StringStream.prototype = {
|
1951 |
-
eol: function() {return this.pos >= this.string.length;},
|
1952 |
-
sol: function() {return this.pos == 0;},
|
1953 |
-
peek: function() {return this.string.charAt(this.pos);},
|
1954 |
-
next: function() {
|
1955 |
-
if (this.pos < this.string.length)
|
1956 |
-
return this.string.charAt(this.pos++);
|
1957 |
-
},
|
1958 |
-
eat: function(match) {
|
1959 |
-
var ch = this.string.charAt(this.pos);
|
1960 |
-
if (typeof match == "string") var ok = ch == match;
|
1961 |
-
else var ok = ch && (match.test ? match.test(ch) : match(ch));
|
1962 |
-
if (ok) {++this.pos; return ch;}
|
1963 |
-
},
|
1964 |
-
eatWhile: function(match) {
|
1965 |
-
var start = this.pos;
|
1966 |
-
while (this.eat(match)){}
|
1967 |
-
return this.pos > start;
|
1968 |
-
},
|
1969 |
-
eatSpace: function() {
|
1970 |
-
var start = this.pos;
|
1971 |
-
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
|
1972 |
-
return this.pos > start;
|
1973 |
-
},
|
1974 |
-
skipToEnd: function() {this.pos = this.string.length;},
|
1975 |
-
skipTo: function(ch) {
|
1976 |
-
var found = this.string.indexOf(ch, this.pos);
|
1977 |
-
if (found > -1) {this.pos = found; return true;}
|
1978 |
-
},
|
1979 |
-
backUp: function(n) {this.pos -= n;},
|
1980 |
-
column: function() {return countColumn(this.string, this.start);},
|
1981 |
-
indentation: function() {return countColumn(this.string);},
|
1982 |
-
match: function(pattern, consume, caseInsensitive) {
|
1983 |
-
if (typeof pattern == "string") {
|
1984 |
-
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
1985 |
-
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
1986 |
-
if (consume !== false) this.pos += pattern.length;
|
1987 |
-
return true;
|
1988 |
-
}
|
1989 |
-
}
|
1990 |
-
else {
|
1991 |
-
var match = this.string.slice(this.pos).match(pattern);
|
1992 |
-
if (match && consume !== false) this.pos += match[0].length;
|
1993 |
-
return match;
|
1994 |
-
}
|
1995 |
-
},
|
1996 |
-
current: function(){return this.string.slice(this.start, this.pos);}
|
1997 |
-
};
|
1998 |
-
CodeMirror.StringStream = StringStream;
|
1999 |
-
|
2000 |
-
function MarkedText(from, to, className, set) {
|
2001 |
-
this.from = from; this.to = to; this.style = className; this.set = set;
|
2002 |
-
}
|
2003 |
-
MarkedText.prototype = {
|
2004 |
-
attach: function(line) { this.set.push(line); },
|
2005 |
-
detach: function(line) {
|
2006 |
-
var ix = indexOf(this.set, line);
|
2007 |
-
if (ix > -1) this.set.splice(ix, 1);
|
2008 |
-
},
|
2009 |
-
split: function(pos, lenBefore) {
|
2010 |
-
if (this.to <= pos && this.to != null) return null;
|
2011 |
-
var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore;
|
2012 |
-
var to = this.to == null ? null : this.to - pos + lenBefore;
|
2013 |
-
return new MarkedText(from, to, this.style, this.set);
|
2014 |
-
},
|
2015 |
-
dup: function() { return new MarkedText(null, null, this.style, this.set); },
|
2016 |
-
clipTo: function(fromOpen, from, toOpen, to, diff) {
|
2017 |
-
if (this.from != null && this.from >= from)
|
2018 |
-
this.from = Math.max(to, this.from) + diff;
|
2019 |
-
if (this.to != null && this.to > from)
|
2020 |
-
this.to = to < this.to ? this.to + diff : from;
|
2021 |
-
if (fromOpen && to > this.from && (to < this.to || this.to == null))
|
2022 |
-
this.from = null;
|
2023 |
-
if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null))
|
2024 |
-
this.to = null;
|
2025 |
-
},
|
2026 |
-
isDead: function() { return this.from != null && this.to != null && this.from >= this.to; },
|
2027 |
-
sameSet: function(x) { return this.set == x.set; }
|
2028 |
-
};
|
2029 |
-
|
2030 |
-
function Bookmark(pos) {
|
2031 |
-
this.from = pos; this.to = pos; this.line = null;
|
2032 |
-
}
|
2033 |
-
Bookmark.prototype = {
|
2034 |
-
attach: function(line) { this.line = line; },
|
2035 |
-
detach: function(line) { if (this.line == line) this.line = null; },
|
2036 |
-
split: function(pos, lenBefore) {
|
2037 |
-
if (pos < this.from) {
|
2038 |
-
this.from = this.to = (this.from - pos) + lenBefore;
|
2039 |
-
return this;
|
2040 |
-
}
|
2041 |
-
},
|
2042 |
-
isDead: function() { return this.from > this.to; },
|
2043 |
-
clipTo: function(fromOpen, from, toOpen, to, diff) {
|
2044 |
-
if ((fromOpen || from < this.from) && (toOpen || to > this.to)) {
|
2045 |
-
this.from = 0; this.to = -1;
|
2046 |
-
} else if (this.from > from) {
|
2047 |
-
this.from = this.to = Math.max(to, this.from) + diff;
|
2048 |
-
}
|
2049 |
-
},
|
2050 |
-
sameSet: function(x) { return false; },
|
2051 |
-
find: function() {
|
2052 |
-
if (!this.line || !this.line.parent) return null;
|
2053 |
-
return {line: lineNo(this.line), ch: this.from};
|
2054 |
-
},
|
2055 |
-
clear: function() {
|
2056 |
-
if (this.line) {
|
2057 |
-
var found = indexOf(this.line.marked, this);
|
2058 |
-
if (found != -1) this.line.marked.splice(found, 1);
|
2059 |
-
this.line = null;
|
2060 |
-
}
|
2061 |
-
}
|
2062 |
-
};
|
2063 |
-
|
2064 |
-
// Line objects. These hold state related to a line, including
|
2065 |
-
// highlighting info (the styles array).
|
2066 |
-
function Line(text, styles) {
|
2067 |
-
this.styles = styles || [text, null];
|
2068 |
-
this.text = text;
|
2069 |
-
this.height = 1;
|
2070 |
-
this.marked = this.gutterMarker = this.className = null;
|
2071 |
-
this.stateAfter = this.parent = this.hidden = null;
|
2072 |
-
}
|
2073 |
-
Line.inheritMarks = function(text, orig) {
|
2074 |
-
var ln = new Line(text), mk = orig.marked;
|
2075 |
-
if (mk) {
|
2076 |
-
for (var i = 0; i < mk.length; ++i) {
|
2077 |
-
if (mk[i].to == null && mk[i].style) {
|
2078 |
-
var newmk = ln.marked || (ln.marked = []), mark = mk[i];
|
2079 |
-
var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln);
|
2080 |
-
}
|
2081 |
-
}
|
2082 |
-
}
|
2083 |
-
return ln;
|
2084 |
-
}
|
2085 |
-
Line.prototype = {
|
2086 |
-
// Replace a piece of a line, keeping the styles around it intact.
|
2087 |
-
replace: function(from, to_, text) {
|
2088 |
-
// Reset line class if the whole text was replaced.
|
2089 |
-
if (!from && (to_ == null || to_ == this.text.length))
|
2090 |
-
this.className = this.gutterMarker = null;
|
2091 |
-
var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_;
|
2092 |
-
copyStyles(0, from, this.styles, st);
|
2093 |
-
if (text) st.push(text, null);
|
2094 |
-
copyStyles(to, this.text.length, this.styles, st);
|
2095 |
-
this.styles = st;
|
2096 |
-
this.text = this.text.slice(0, from) + text + this.text.slice(to);
|
2097 |
-
this.stateAfter = null;
|
2098 |
-
if (mk) {
|
2099 |
-
var diff = text.length - (to - from);
|
2100 |
-
for (var i = 0, mark = mk[i]; i < mk.length; ++i) {
|
2101 |
-
mark.clipTo(from == null, from || 0, to_ == null, to, diff);
|
2102 |
-
if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);}
|
2103 |
-
}
|
2104 |
-
}
|
2105 |
-
},
|
2106 |
-
// Split a part off a line, keeping styles and markers intact.
|
2107 |
-
split: function(pos, textBefore) {
|
2108 |
-
var st = [textBefore, null], mk = this.marked;
|
2109 |
-
copyStyles(pos, this.text.length, this.styles, st);
|
2110 |
-
var taken = new Line(textBefore + this.text.slice(pos), st);
|
2111 |
-
if (mk) {
|
2112 |
-
for (var i = 0; i < mk.length; ++i) {
|
2113 |
-
var mark = mk[i];
|
2114 |
-
var newmark = mark.split(pos, textBefore.length);
|
2115 |
-
if (newmark) {
|
2116 |
-
if (!taken.marked) taken.marked = [];
|
2117 |
-
taken.marked.push(newmark); newmark.attach(taken);
|
2118 |
-
}
|
2119 |
-
}
|
2120 |
-
}
|
2121 |
-
return taken;
|
2122 |
-
},
|
2123 |
-
append: function(line) {
|
2124 |
-
var mylen = this.text.length, mk = line.marked, mymk = this.marked;
|
2125 |
-
this.text += line.text;
|
2126 |
-
copyStyles(0, line.text.length, line.styles, this.styles);
|
2127 |
-
if (mymk) {
|
2128 |
-
for (var i = 0; i < mymk.length; ++i)
|
2129 |
-
if (mymk[i].to == null) mymk[i].to = mylen;
|
2130 |
-
}
|
2131 |
-
if (mk && mk.length) {
|
2132 |
-
if (!mymk) this.marked = mymk = [];
|
2133 |
-
outer: for (var i = 0; i < mk.length; ++i) {
|
2134 |
-
var mark = mk[i];
|
2135 |
-
if (!mark.from) {
|
2136 |
-
for (var j = 0; j < mymk.length; ++j) {
|
2137 |
-
var mymark = mymk[j];
|
2138 |
-
if (mymark.to == mylen && mymark.sameSet(mark)) {
|
2139 |
-
mymark.to = mark.to == null ? null : mark.to + mylen;
|
2140 |
-
if (mymark.isDead()) {
|
2141 |
-
mymark.detach(this);
|
2142 |
-
mk.splice(i--, 1);
|
2143 |
-
}
|
2144 |
-
continue outer;
|
2145 |
-
}
|
2146 |
-
}
|
2147 |
-
}
|
2148 |
-
mymk.push(mark);
|
2149 |
-
mark.attach(this);
|
2150 |
-
mark.from += mylen;
|
2151 |
-
if (mark.to != null) mark.to += mylen;
|
2152 |
-
}
|
2153 |
-
}
|
2154 |
-
},
|
2155 |
-
fixMarkEnds: function(other) {
|
2156 |
-
var mk = this.marked, omk = other.marked;
|
2157 |
-
if (!mk) return;
|
2158 |
-
for (var i = 0; i < mk.length; ++i) {
|
2159 |
-
var mark = mk[i], close = mark.to == null;
|
2160 |
-
if (close && omk) {
|
2161 |
-
for (var j = 0; j < omk.length; ++j)
|
2162 |
-
if (omk[j].sameSet(mark)) {close = false; break;}
|
2163 |
-
}
|
2164 |
-
if (close) mark.to = this.text.length;
|
2165 |
-
}
|
2166 |
-
},
|
2167 |
-
addMark: function(mark) {
|
2168 |
-
mark.attach(this);
|
2169 |
-
if (this.marked == null) this.marked = [];
|
2170 |
-
this.marked.push(mark);
|
2171 |
-
this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);});
|
2172 |
-
},
|
2173 |
-
// Run the given mode's parser over a line, update the styles
|
2174 |
-
// array, which contains alternating fragments of text and CSS
|
2175 |
-
// classes.
|
2176 |
-
highlight: function(mode, state) {
|
2177 |
-
var stream = new StringStream(this.text), st = this.styles, pos = 0;
|
2178 |
-
var changed = false, curWord = st[0], prevWord;
|
2179 |
-
if (this.text == "" && mode.blankLine) mode.blankLine(state);
|
2180 |
-
while (!stream.eol()) {
|
2181 |
-
var style = mode.token(stream, state);
|
2182 |
-
var substr = this.text.slice(stream.start, stream.pos);
|
2183 |
-
stream.start = stream.pos;
|
2184 |
-
if (pos && st[pos-1] == style)
|
2185 |
-
st[pos-2] += substr;
|
2186 |
-
else if (substr) {
|
2187 |
-
if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;
|
2188 |
-
st[pos++] = substr; st[pos++] = style;
|
2189 |
-
prevWord = curWord; curWord = st[pos];
|
2190 |
-
}
|
2191 |
-
// Give up when line is ridiculously long
|
2192 |
-
if (stream.pos > 5000) {
|
2193 |
-
st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
|
2194 |
-
break;
|
2195 |
-
}
|
2196 |
-
}
|
2197 |
-
if (st.length != pos) {st.length = pos; changed = true;}
|
2198 |
-
if (pos && st[pos-2] != prevWord) changed = true;
|
2199 |
-
// Short lines with simple highlights return null, and are
|
2200 |
-
// counted as changed by the driver because they are likely to
|
2201 |
-
// highlight the same way in various contexts.
|
2202 |
-
return changed || (st.length < 5 && this.text.length < 10 ? null : false);
|
2203 |
-
},
|
2204 |
-
// Fetch the parser token for a given character. Useful for hacks
|
2205 |
-
// that want to inspect the mode state (say, for completion).
|
2206 |
-
getTokenAt: function(mode, state, ch) {
|
2207 |
-
var txt = this.text, stream = new StringStream(txt);
|
2208 |
-
while (stream.pos < ch && !stream.eol()) {
|
2209 |
-
stream.start = stream.pos;
|
2210 |
-
var style = mode.token(stream, state);
|
2211 |
-
}
|
2212 |
-
return {start: stream.start,
|
2213 |
-
end: stream.pos,
|
2214 |
-
string: stream.current(),
|
2215 |
-
className: style || null,
|
2216 |
-
state: state};
|
2217 |
-
},
|
2218 |
-
indentation: function() {return countColumn(this.text);},
|
2219 |
-
// Produces an HTML fragment for the line, taking selection,
|
2220 |
-
// marking, and highlighting into account.
|
2221 |
-
getHTML: function(sfrom, sto, includePre, endAt) {
|
2222 |
-
var html = [], first = true;
|
2223 |
-
if (includePre)
|
2224 |
-
html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
|
2225 |
-
function span(text, style) {
|
2226 |
-
if (!text) return;
|
2227 |
-
// Work around a bug where, in some compat modes, IE ignores leading spaces
|
2228 |
-
if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1);
|
2229 |
-
first = false;
|
2230 |
-
if (style) html.push('<span class="', style, '">', htmlEscape(text), "</span>");
|
2231 |
-
else html.push(htmlEscape(text));
|
2232 |
-
}
|
2233 |
-
var st = this.styles, allText = this.text, marked = this.marked;
|
2234 |
-
if (sfrom == sto) sfrom = null;
|
2235 |
-
var len = allText.length;
|
2236 |
-
if (endAt != null) len = Math.min(endAt, len);
|
2237 |
-
|
2238 |
-
if (!allText && endAt == null)
|
2239 |
-
span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);
|
2240 |
-
else if (!marked && sfrom == null)
|
2241 |
-
for (var i = 0, ch = 0; ch < len; i+=2) {
|
2242 |
-
var str = st[i], style = st[i+1], l = str.length;
|
2243 |
-
if (ch + l > len) str = str.slice(0, len - ch);
|
2244 |
-
ch += l;
|
2245 |
-
span(str, style && "cm-" + style);
|
2246 |
-
}
|
2247 |
-
else {
|
2248 |
-
var pos = 0, i = 0, text = "", style, sg = 0;
|
2249 |
-
var markpos = -1, mark = null;
|
2250 |
-
function nextMark() {
|
2251 |
-
if (marked) {
|
2252 |
-
markpos += 1;
|
2253 |
-
mark = (markpos < marked.length) ? marked[markpos] : null;
|
2254 |
-
}
|
2255 |
-
}
|
2256 |
-
nextMark();
|
2257 |
-
while (pos < len) {
|
2258 |
-
var upto = len;
|
2259 |
-
var extraStyle = "";
|
2260 |
-
if (sfrom != null) {
|
2261 |
-
if (sfrom > pos) upto = sfrom;
|
2262 |
-
else if (sto == null || sto > pos) {
|
2263 |
-
extraStyle = " CodeMirror-selected";
|
2264 |
-
if (sto != null) upto = Math.min(upto, sto);
|
2265 |
-
}
|
2266 |
-
}
|
2267 |
-
while (mark && mark.to != null && mark.to <= pos) nextMark();
|
2268 |
-
if (mark) {
|
2269 |
-
if (mark.from > pos) upto = Math.min(upto, mark.from);
|
2270 |
-
else {
|
2271 |
-
extraStyle += " " + mark.style;
|
2272 |
-
if (mark.to != null) upto = Math.min(upto, mark.to);
|
2273 |
-
}
|
2274 |
-
}
|
2275 |
-
for (;;) {
|
2276 |
-
var end = pos + text.length;
|
2277 |
-
var appliedStyle = style;
|
2278 |
-
if (extraStyle) appliedStyle = style ? style + extraStyle : extraStyle;
|
2279 |
-
span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);
|
2280 |
-
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
|
2281 |
-
pos = end;
|
2282 |
-
text = st[i++]; style = "cm-" + st[i++];
|
2283 |
-
}
|
2284 |
-
}
|
2285 |
-
if (sfrom != null && sto == null) span(" ", "CodeMirror-selected");
|
2286 |
-
}
|
2287 |
-
if (includePre) html.push("</pre>");
|
2288 |
-
return html.join("");
|
2289 |
-
},
|
2290 |
-
cleanUp: function() {
|
2291 |
-
this.parent = null;
|
2292 |
-
if (this.marked)
|
2293 |
-
for (var i = 0, e = this.marked.length; i < e; ++i) this.marked[i].detach(this);
|
2294 |
-
}
|
2295 |
-
};
|
2296 |
-
// Utility used by replace and split above
|
2297 |
-
function copyStyles(from, to, source, dest) {
|
2298 |
-
for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
|
2299 |
-
var part = source[i], end = pos + part.length;
|
2300 |
-
if (state == 0) {
|
2301 |
-
if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
|
2302 |
-
if (end >= from) state = 1;
|
2303 |
-
}
|
2304 |
-
else if (state == 1) {
|
2305 |
-
if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
|
2306 |
-
else dest.push(part, source[i+1]);
|
2307 |
-
}
|
2308 |
-
pos = end;
|
2309 |
-
}
|
2310 |
-
}
|
2311 |
-
|
2312 |
-
// Data structure that holds the sequence of lines.
|
2313 |
-
function LeafChunk(lines) {
|
2314 |
-
this.lines = lines;
|
2315 |
-
this.parent = null;
|
2316 |
-
for (var i = 0, e = lines.length, height = 0; i < e; ++i) {
|
2317 |
-
lines[i].parent = this;
|
2318 |
-
height += lines[i].height;
|
2319 |
-
}
|
2320 |
-
this.height = height;
|
2321 |
-
}
|
2322 |
-
LeafChunk.prototype = {
|
2323 |
-
chunkSize: function() { return this.lines.length; },
|
2324 |
-
remove: function(at, n) {
|
2325 |
-
for (var i = at, e = at + n; i < e; ++i) {
|
2326 |
-
var line = this.lines[i];
|
2327 |
-
line.cleanUp();
|
2328 |
-
this.height -= line.height;
|
2329 |
-
}
|
2330 |
-
this.lines.splice(at, n);
|
2331 |
-
},
|
2332 |
-
collapse: function(lines) {
|
2333 |
-
lines.splice.apply(lines, [lines.length, 0].concat(this.lines));
|
2334 |
-
},
|
2335 |
-
insertHeight: function(at, lines, height) {
|
2336 |
-
this.height += height;
|
2337 |
-
this.lines.splice.apply(this.lines, [at, 0].concat(lines));
|
2338 |
-
for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
|
2339 |
-
},
|
2340 |
-
iterN: function(at, n, op) {
|
2341 |
-
for (var e = at + n; at < e; ++at)
|
2342 |
-
if (op(this.lines[at])) return true;
|
2343 |
-
}
|
2344 |
-
};
|
2345 |
-
function BranchChunk(children) {
|
2346 |
-
this.children = children;
|
2347 |
-
var size = 0, height = 0;
|
2348 |
-
for (var i = 0, e = children.length; i < e; ++i) {
|
2349 |
-
var ch = children[i];
|
2350 |
-
size += ch.chunkSize(); height += ch.height;
|
2351 |
-
ch.parent = this;
|
2352 |
-
}
|
2353 |
-
this.size = size;
|
2354 |
-
this.height = height;
|
2355 |
-
this.parent = null;
|
2356 |
-
}
|
2357 |
-
BranchChunk.prototype = {
|
2358 |
-
chunkSize: function() { return this.size; },
|
2359 |
-
remove: function(at, n) {
|
2360 |
-
this.size -= n;
|
2361 |
-
for (var i = 0; i < this.children.length; ++i) {
|
2362 |
-
var child = this.children[i], sz = child.chunkSize();
|
2363 |
-
if (at < sz) {
|
2364 |
-
var rm = Math.min(n, sz - at), oldHeight = child.height;
|
2365 |
-
child.remove(at, rm);
|
2366 |
-
this.height -= oldHeight - child.height;
|
2367 |
-
if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
|
2368 |
-
if ((n -= rm) == 0) break;
|
2369 |
-
at = 0;
|
2370 |
-
} else at -= sz;
|
2371 |
-
}
|
2372 |
-
if (this.size - n < 25) {
|
2373 |
-
var lines = [];
|
2374 |
-
this.collapse(lines);
|
2375 |
-
this.children = [new LeafChunk(lines)];
|
2376 |
-
}
|
2377 |
-
},
|
2378 |
-
collapse: function(lines) {
|
2379 |
-
for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);
|
2380 |
-
},
|
2381 |
-
insert: function(at, lines) {
|
2382 |
-
var height = 0;
|
2383 |
-
for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
|
2384 |
-
this.insertHeight(at, lines, height);
|
2385 |
-
},
|
2386 |
-
insertHeight: function(at, lines, height) {
|
2387 |
-
this.size += lines.length;
|
2388 |
-
this.height += height;
|
2389 |
-
for (var i = 0, e = this.children.length; i < e; ++i) {
|
2390 |
-
var child = this.children[i], sz = child.chunkSize();
|
2391 |
-
if (at <= sz) {
|
2392 |
-
child.insertHeight(at, lines, height);
|
2393 |
-
if (child.lines && child.lines.length > 50) {
|
2394 |
-
while (child.lines.length > 50) {
|
2395 |
-
var spilled = child.lines.splice(child.lines.length - 25, 25);
|
2396 |
-
var newleaf = new LeafChunk(spilled);
|
2397 |
-
child.height -= newleaf.height;
|
2398 |
-
this.children.splice(i + 1, 0, newleaf);
|
2399 |
-
newleaf.parent = this;
|
2400 |
-
}
|
2401 |
-
this.maybeSpill();
|
2402 |
-
}
|
2403 |
-
break;
|
2404 |
-
}
|
2405 |
-
at -= sz;
|
2406 |
-
}
|
2407 |
-
},
|
2408 |
-
maybeSpill: function() {
|
2409 |
-
if (this.children.length <= 10) return;
|
2410 |
-
var me = this;
|
2411 |
-
do {
|
2412 |
-
var spilled = me.children.splice(me.children.length - 5, 5);
|
2413 |
-
var sibling = new BranchChunk(spilled);
|
2414 |
-
if (!me.parent) { // Become the parent node
|
2415 |
-
var copy = new BranchChunk(me.children);
|
2416 |
-
copy.parent = me;
|
2417 |
-
me.children = [copy, sibling];
|
2418 |
-
me = copy;
|
2419 |
-
} else {
|
2420 |
-
me.size -= sibling.size;
|
2421 |
-
me.height -= sibling.height;
|
2422 |
-
var myIndex = indexOf(me.parent.children, me);
|
2423 |
-
me.parent.children.splice(myIndex + 1, 0, sibling);
|
2424 |
-
}
|
2425 |
-
sibling.parent = me.parent;
|
2426 |
-
} while (me.children.length > 10);
|
2427 |
-
me.parent.maybeSpill();
|
2428 |
-
},
|
2429 |
-
iter: function(from, to, op) { this.iterN(from, to - from, op); },
|
2430 |
-
iterN: function(at, n, op) {
|
2431 |
-
for (var i = 0, e = this.children.length; i < e; ++i) {
|
2432 |
-
var child = this.children[i], sz = child.chunkSize();
|
2433 |
-
if (at < sz) {
|
2434 |
-
var used = Math.min(n, sz - at);
|
2435 |
-
if (child.iterN(at, used, op)) return true;
|
2436 |
-
if ((n -= used) == 0) break;
|
2437 |
-
at = 0;
|
2438 |
-
} else at -= sz;
|
2439 |
-
}
|
2440 |
-
}
|
2441 |
-
};
|
2442 |
-
|
2443 |
-
function getLineAt(chunk, n) {
|
2444 |
-
for (;;) {
|
2445 |
-
for (var i = 0, e = chunk.children.length; i < e; ++i) {
|
2446 |
-
var child = chunk.children[i], sz = child.chunkSize();
|
2447 |
-
if (n < sz) { chunk = child; break; }
|
2448 |
-
n -= sz;
|
2449 |
-
}
|
2450 |
-
if (chunk.lines) return chunk.lines[n];
|
2451 |
-
}
|
2452 |
-
}
|
2453 |
-
function lineNo(line) {
|
2454 |
-
if (line.parent == null) return null;
|
2455 |
-
var cur = line.parent, no = indexOf(cur.lines, line);
|
2456 |
-
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
2457 |
-
for (var i = 0, e = chunk.children.length; ; ++i) {
|
2458 |
-
if (chunk.children[i] == cur) break;
|
2459 |
-
no += chunk.children[i].chunkSize();
|
2460 |
-
}
|
2461 |
-
}
|
2462 |
-
return no;
|
2463 |
-
}
|
2464 |
-
function lineAtHeight(chunk, h) {
|
2465 |
-
var n = 0;
|
2466 |
-
outer: do {
|
2467 |
-
for (var i = 0, e = chunk.children.length; i < e; ++i) {
|
2468 |
-
var child = chunk.children[i], ch = child.height;
|
2469 |
-
if (h < ch) { chunk = child; continue outer; }
|
2470 |
-
h -= ch;
|
2471 |
-
n += child.chunkSize();
|
2472 |
-
}
|
2473 |
-
return n;
|
2474 |
-
} while (!chunk.lines);
|
2475 |
-
for (var i = 0, e = chunk.lines.length; i < e; ++i) {
|
2476 |
-
var line = chunk.lines[i], lh = line.height;
|
2477 |
-
if (h < lh) break;
|
2478 |
-
h -= lh;
|
2479 |
-
}
|
2480 |
-
return n + i;
|
2481 |
-
}
|
2482 |
-
function heightAtLine(chunk, n) {
|
2483 |
-
var h = 0;
|
2484 |
-
outer: do {
|
2485 |
-
for (var i = 0, e = chunk.children.length; i < e; ++i) {
|
2486 |
-
var child = chunk.children[i], sz = child.chunkSize();
|
2487 |
-
if (n < sz) { chunk = child; continue outer; }
|
2488 |
-
n -= sz;
|
2489 |
-
h += child.height;
|
2490 |
-
}
|
2491 |
-
return h;
|
2492 |
-
} while (!chunk.lines);
|
2493 |
-
for (var i = 0; i < n; ++i) h += chunk.lines[i].height;
|
2494 |
-
return h;
|
2495 |
-
}
|
2496 |
-
|
2497 |
-
// The history object 'chunks' changes that are made close together
|
2498 |
-
// and at almost the same time into bigger undoable units.
|
2499 |
-
function History() {
|
2500 |
-
this.time = 0;
|
2501 |
-
this.done = []; this.undone = [];
|
2502 |
-
}
|
2503 |
-
History.prototype = {
|
2504 |
-
addChange: function(start, added, old) {
|
2505 |
-
this.undone.length = 0;
|
2506 |
-
var time = +new Date, last = this.done[this.done.length - 1];
|
2507 |
-
if (time - this.time > 400 || !last ||
|
2508 |
-
last.start > start + added || last.start + last.added < start - last.added + last.old.length)
|
2509 |
-
this.done.push({start: start, added: added, old: old});
|
2510 |
-
else {
|
2511 |
-
var oldoff = 0;
|
2512 |
-
if (start < last.start) {
|
2513 |
-
for (var i = last.start - start - 1; i >= 0; --i)
|
2514 |
-
last.old.unshift(old[i]);
|
2515 |
-
last.added += last.start - start;
|
2516 |
-
last.start = start;
|
2517 |
-
}
|
2518 |
-
else if (last.start < start) {
|
2519 |
-
oldoff = start - last.start;
|
2520 |
-
added += oldoff;
|
2521 |
-
}
|
2522 |
-
for (var i = last.added - oldoff, e = old.length; i < e; ++i)
|
2523 |
-
last.old.push(old[i]);
|
2524 |
-
if (last.added < added) last.added = added;
|
2525 |
-
}
|
2526 |
-
this.time = time;
|
2527 |
-
}
|
2528 |
-
};
|
2529 |
-
|
2530 |
-
function stopMethod() {e_stop(this);}
|
2531 |
-
// Ensure an event has a stop method.
|
2532 |
-
function addStop(event) {
|
2533 |
-
if (!event.stop) event.stop = stopMethod;
|
2534 |
-
return event;
|
2535 |
-
}
|
2536 |
-
|
2537 |
-
function e_preventDefault(e) {
|
2538 |
-
if (e.preventDefault) e.preventDefault();
|
2539 |
-
else e.returnValue = false;
|
2540 |
-
}
|
2541 |
-
function e_stopPropagation(e) {
|
2542 |
-
if (e.stopPropagation) e.stopPropagation();
|
2543 |
-
else e.cancelBubble = true;
|
2544 |
-
}
|
2545 |
-
function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
|
2546 |
-
function e_target(e) {return e.target || e.srcElement;}
|
2547 |
-
function e_button(e) {
|
2548 |
-
if (e.which) return e.which;
|
2549 |
-
else if (e.button & 1) return 1;
|
2550 |
-
else if (e.button & 2) return 3;
|
2551 |
-
else if (e.button & 4) return 2;
|
2552 |
-
}
|
2553 |
-
|
2554 |
-
// Event handler registration. If disconnect is true, it'll return a
|
2555 |
-
// function that unregisters the handler.
|
2556 |
-
function connect(node, type, handler, disconnect) {
|
2557 |
-
function wrapHandler(event) {handler(event || window.event);}
|
2558 |
-
if (typeof node.addEventListener == "function") {
|
2559 |
-
node.addEventListener(type, wrapHandler, false);
|
2560 |
-
if (disconnect) return function() {node.removeEventListener(type, wrapHandler, false);};
|
2561 |
-
}
|
2562 |
-
else {
|
2563 |
-
node.attachEvent("on" + type, wrapHandler);
|
2564 |
-
if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
|
2565 |
-
}
|
2566 |
-
}
|
2567 |
-
|
2568 |
-
function Delayed() {this.id = null;}
|
2569 |
-
Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
|
2570 |
-
|
2571 |
-
// Detect drag-and-drop
|
2572 |
-
var dragAndDrop = function() {
|
2573 |
-
// IE8 has ondragstart and ondrop properties, but doesn't seem to
|
2574 |
-
// actually support ondragstart the way it's supposed to work.
|
2575 |
-
if (/MSIE [1-8]\b/.test(navigator.userAgent)) return false;
|
2576 |
-
var div = document.createElement('div');
|
2577 |
-
return "draggable" in div;
|
2578 |
-
}();
|
2579 |
-
|
2580 |
-
var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
|
2581 |
-
var ie = /MSIE \d/.test(navigator.userAgent);
|
2582 |
-
var webkit = /WebKit\//.test(navigator.userAgent);
|
2583 |
-
|
2584 |
-
var lineSep = "\n";
|
2585 |
-
// Feature-detect whether newlines in textareas are converted to \r\n
|
2586 |
-
(function () {
|
2587 |
-
var te = document.createElement("textarea");
|
2588 |
-
te.value = "foo\nbar";
|
2589 |
-
if (te.value.indexOf("\r") > -1) lineSep = "\r\n";
|
2590 |
-
}());
|
2591 |
-
|
2592 |
-
var tabSize = 8;
|
2593 |
-
var mac = /Mac/.test(navigator.platform);
|
2594 |
-
var win = /Win/.test(navigator.platform);
|
2595 |
-
var movementKeys = {};
|
2596 |
-
for (var i = 35; i <= 40; ++i)
|
2597 |
-
movementKeys[i] = movementKeys["c" + i] = true;
|
2598 |
-
|
2599 |
-
// Counts the column offset in a string, taking tabs into account.
|
2600 |
-
// Used mostly to find indentation.
|
2601 |
-
function countColumn(string, end) {
|
2602 |
-
if (end == null) {
|
2603 |
-
end = string.search(/[^\s\u00a0]/);
|
2604 |
-
if (end == -1) end = string.length;
|
2605 |
-
}
|
2606 |
-
for (var i = 0, n = 0; i < end; ++i) {
|
2607 |
-
if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
|
2608 |
-
else ++n;
|
2609 |
-
}
|
2610 |
-
return n;
|
2611 |
-
}
|
2612 |
-
|
2613 |
-
function computedStyle(elt) {
|
2614 |
-
if (elt.currentStyle) return elt.currentStyle;
|
2615 |
-
return window.getComputedStyle(elt, null);
|
2616 |
-
}
|
2617 |
-
|
2618 |
-
// Find the position of an element by following the offsetParent chain.
|
2619 |
-
// If screen==true, it returns screen (rather than page) coordinates.
|
2620 |
-
function eltOffset(node, screen) {
|
2621 |
-
var bod = node.ownerDocument.body;
|
2622 |
-
var x = 0, y = 0, skipBody = false;
|
2623 |
-
for (var n = node; n; n = n.offsetParent) {
|
2624 |
-
var ol = n.offsetLeft, ot = n.offsetTop;
|
2625 |
-
// Firefox reports weird inverted offsets when the body has a border.
|
2626 |
-
if (n == bod) { x += Math.abs(ol); y += Math.abs(ot); }
|
2627 |
-
else { x += ol, y += ot; }
|
2628 |
-
if (screen && computedStyle(n).position == "fixed")
|
2629 |
-
skipBody = true;
|
2630 |
-
}
|
2631 |
-
var e = screen && !skipBody ? null : bod;
|
2632 |
-
for (var n = node.parentNode; n != e; n = n.parentNode)
|
2633 |
-
if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;}
|
2634 |
-
return {left: x, top: y};
|
2635 |
-
}
|
2636 |
-
// Use the faster and saner getBoundingClientRect method when possible.
|
2637 |
-
if (document.documentElement.getBoundingClientRect != null) eltOffset = function(node, screen) {
|
2638 |
-
// Take the parts of bounding client rect that we are interested in so we are able to edit if need be,
|
2639 |
-
// since the returned value cannot be changed externally (they are kept in sync as the element moves within the page)
|
2640 |
-
try { var box = node.getBoundingClientRect(); box = { top: box.top, left: box.left }; }
|
2641 |
-
catch(e) { box = {top: 0, left: 0}; }
|
2642 |
-
if (!screen) {
|
2643 |
-
// Get the toplevel scroll, working around browser differences.
|
2644 |
-
if (window.pageYOffset == null) {
|
2645 |
-
var t = document.documentElement || document.body.parentNode;
|
2646 |
-
if (t.scrollTop == null) t = document.body;
|
2647 |
-
box.top += t.scrollTop; box.left += t.scrollLeft;
|
2648 |
-
} else {
|
2649 |
-
box.top += window.pageYOffset; box.left += window.pageXOffset;
|
2650 |
-
}
|
2651 |
-
}
|
2652 |
-
return box;
|
2653 |
-
};
|
2654 |
-
|
2655 |
-
// Get a node's text content.
|
2656 |
-
function eltText(node) {
|
2657 |
-
return node.textContent || node.innerText || node.nodeValue || "";
|
2658 |
-
}
|
2659 |
-
|
2660 |
-
// Operations on {line, ch} objects.
|
2661 |
-
function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
|
2662 |
-
function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
|
2663 |
-
function copyPos(x) {return {line: x.line, ch: x.ch};}
|
2664 |
-
|
2665 |
-
var escapeElement = document.createElement("pre");
|
2666 |
-
function htmlEscape(str) {
|
2667 |
-
if (badTextContent) {
|
2668 |
-
escapeElement.innerHTML = "";
|
2669 |
-
escapeElement.appendChild(document.createTextNode(str));
|
2670 |
-
} else {
|
2671 |
-
escapeElement.textContent = str;
|
2672 |
-
}
|
2673 |
-
return escapeElement.innerHTML;
|
2674 |
-
}
|
2675 |
-
var badTextContent = htmlEscape("\t") != "\t";
|
2676 |
-
CodeMirror.htmlEscape = htmlEscape;
|
2677 |
-
|
2678 |
-
// Used to position the cursor after an undo/redo by finding the
|
2679 |
-
// last edited character.
|
2680 |
-
function editEnd(from, to) {
|
2681 |
-
if (!to) return from ? from.length : 0;
|
2682 |
-
if (!from) return to.length;
|
2683 |
-
for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
|
2684 |
-
if (from.charAt(i) != to.charAt(j)) break;
|
2685 |
-
return j + 1;
|
2686 |
-
}
|
2687 |
-
|
2688 |
-
function indexOf(collection, elt) {
|
2689 |
-
if (collection.indexOf) return collection.indexOf(elt);
|
2690 |
-
for (var i = 0, e = collection.length; i < e; ++i)
|
2691 |
-
if (collection[i] == elt) return i;
|
2692 |
-
return -1;
|
2693 |
-
}
|
2694 |
-
|
2695 |
-
// See if "".split is the broken IE version, if so, provide an
|
2696 |
-
// alternative way to split lines.
|
2697 |
-
var splitLines, selRange, setSelRange;
|
2698 |
-
if ("\n\nb".split(/\n/).length != 3)
|
2699 |
-
splitLines = function(string) {
|
2700 |
-
var pos = 0, nl, result = [];
|
2701 |
-
while ((nl = string.indexOf("\n", pos)) > -1) {
|
2702 |
-
result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl));
|
2703 |
-
pos = nl + 1;
|
2704 |
-
}
|
2705 |
-
result.push(string.slice(pos));
|
2706 |
-
return result;
|
2707 |
-
};
|
2708 |
-
else
|
2709 |
-
splitLines = function(string){return string.split(/\r?\n/);};
|
2710 |
-
CodeMirror.splitLines = splitLines;
|
2711 |
-
|
2712 |
-
// Sane model of finding and setting the selection in a textarea
|
2713 |
-
if (window.getSelection) {
|
2714 |
-
selRange = function(te) {
|
2715 |
-
try {return {start: te.selectionStart, end: te.selectionEnd};}
|
2716 |
-
catch(e) {return null;}
|
2717 |
-
};
|
2718 |
-
if (webkit)
|
2719 |
-
// On Safari, selection set with setSelectionRange are in a sort
|
2720 |
-
// of limbo wrt their anchor. If you press shift-left in them,
|
2721 |
-
// the anchor is put at the end, and the selection expanded to
|
2722 |
-
// the left. If you press shift-right, the anchor ends up at the
|
2723 |
-
// front. This is not what CodeMirror wants, so it does a
|
2724 |
-
// spurious modify() call to get out of limbo.
|
2725 |
-
setSelRange = function(te, start, end) {
|
2726 |
-
if (start == end)
|
2727 |
-
te.setSelectionRange(start, end);
|
2728 |
-
else {
|
2729 |
-
te.setSelectionRange(start, end - 1);
|
2730 |
-
window.getSelection().modify("extend", "forward", "character");
|
2731 |
-
}
|
2732 |
-
};
|
2733 |
-
else
|
2734 |
-
setSelRange = function(te, start, end) {
|
2735 |
-
try {te.setSelectionRange(start, end);}
|
2736 |
-
catch(e) {} // Fails on Firefox when textarea isn't part of the document
|
2737 |
-
};
|
2738 |
-
}
|
2739 |
-
// IE model. Don't ask.
|
2740 |
-
else {
|
2741 |
-
selRange = function(te) {
|
2742 |
-
try {var range = te.ownerDocument.selection.createRange();}
|
2743 |
-
catch(e) {return null;}
|
2744 |
-
if (!range || range.parentElement() != te) return null;
|
2745 |
-
var val = te.value, len = val.length, localRange = te.createTextRange();
|
2746 |
-
localRange.moveToBookmark(range.getBookmark());
|
2747 |
-
var endRange = te.createTextRange();
|
2748 |
-
endRange.collapse(false);
|
2749 |
-
|
2750 |
-
if (localRange.compareEndPoints("StartToEnd", endRange) > -1)
|
2751 |
-
return {start: len, end: len};
|
2752 |
-
|
2753 |
-
var start = -localRange.moveStart("character", -len);
|
2754 |
-
for (var i = val.indexOf("\r"); i > -1 && i < start; i = val.indexOf("\r", i+1), start++) {}
|
2755 |
-
|
2756 |
-
if (localRange.compareEndPoints("EndToEnd", endRange) > -1)
|
2757 |
-
return {start: start, end: len};
|
2758 |
-
|
2759 |
-
var end = -localRange.moveEnd("character", -len);
|
2760 |
-
for (var i = val.indexOf("\r"); i > -1 && i < end; i = val.indexOf("\r", i+1), end++) {}
|
2761 |
-
return {start: start, end: end};
|
2762 |
-
};
|
2763 |
-
setSelRange = function(te, start, end) {
|
2764 |
-
var range = te.createTextRange();
|
2765 |
-
range.collapse(true);
|
2766 |
-
var endrange = range.duplicate();
|
2767 |
-
var newlines = 0, txt = te.value;
|
2768 |
-
for (var pos = txt.indexOf("\n"); pos > -1 && pos < start; pos = txt.indexOf("\n", pos + 1))
|
2769 |
-
++newlines;
|
2770 |
-
range.move("character", start - newlines);
|
2771 |
-
for (; pos > -1 && pos < end; pos = txt.indexOf("\n", pos + 1))
|
2772 |
-
++newlines;
|
2773 |
-
endrange.move("character", end - newlines);
|
2774 |
-
range.setEndPoint("EndToEnd", endrange);
|
2775 |
-
range.select();
|
2776 |
-
};
|
2777 |
-
}
|
2778 |
-
|
2779 |
-
CodeMirror.defineMode("null", function() {
|
2780 |
-
return {token: function(stream) {stream.skipToEnd();}};
|
2781 |
-
});
|
2782 |
-
CodeMirror.defineMIME("text/plain", "null");
|
2783 |
-
|
2784 |
-
return CodeMirror;
|
2785 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/foldcode.js
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
CodeMirror.braceRangeFinder = function(cm, line) {
|
2 |
-
var lineText = cm.getLine(line);
|
3 |
-
var startChar = lineText.lastIndexOf("{");
|
4 |
-
if (startChar < 0 || lineText.lastIndexOf("}") > startChar) return;
|
5 |
-
var tokenType = cm.getTokenAt({line: line, ch: startChar}).className;
|
6 |
-
var count = 1, lastLine = cm.lineCount(), end;
|
7 |
-
outer: for (var i = line + 1; i < lastLine; ++i) {
|
8 |
-
var text = cm.getLine(i), pos = 0;
|
9 |
-
for (;;) {
|
10 |
-
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
|
11 |
-
if (nextOpen < 0) nextOpen = text.length;
|
12 |
-
if (nextClose < 0) nextClose = text.length;
|
13 |
-
pos = Math.min(nextOpen, nextClose);
|
14 |
-
if (pos == text.length) break;
|
15 |
-
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
|
16 |
-
if (pos == nextOpen) ++count;
|
17 |
-
else if (!--count) { end = i; break outer; }
|
18 |
-
}
|
19 |
-
++pos;
|
20 |
-
}
|
21 |
-
}
|
22 |
-
if (end == null || end == line + 1) return;
|
23 |
-
return end;
|
24 |
-
};
|
25 |
-
|
26 |
-
|
27 |
-
CodeMirror.newFoldFunction = function(rangeFinder, markText) {
|
28 |
-
var folded = [];
|
29 |
-
if (markText == null) markText = '<span style="color:#600">▼</span>%N%';
|
30 |
-
|
31 |
-
function isFolded(cm, n) {
|
32 |
-
for (var i = 0; i < folded.length; ++i) {
|
33 |
-
var start = cm.lineInfo(folded[i].start);
|
34 |
-
if (!start) folded.splice(i--, 1);
|
35 |
-
else if (start.line == n) return {pos: i, start: start.line, end: start.line + folded[i].size};
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
return function(cm, line) {
|
40 |
-
cm.operation(function() {
|
41 |
-
var known = isFolded(cm, line);
|
42 |
-
if (known) {
|
43 |
-
folded.splice(known.pos, 1);
|
44 |
-
cm.clearMarker(known.start);
|
45 |
-
var stack = [];
|
46 |
-
for (var i = known.start; i < known.end; ++i) {
|
47 |
-
if (!stack.length) cm.showLine(i);
|
48 |
-
if (i == stack[0]) stack.shift();
|
49 |
-
var overlap = isFolded(cm, i);
|
50 |
-
if (overlap) stack.unshift(overlap.end - 1);
|
51 |
-
}
|
52 |
-
} else {
|
53 |
-
var end = rangeFinder(cm, line);
|
54 |
-
if (end == null) return;
|
55 |
-
for (var i = line + 1; i < end; ++i) cm.hideLine(i);
|
56 |
-
var first = cm.setMarker(line, markText);
|
57 |
-
folded.push({start: first, size: end - line});
|
58 |
-
}
|
59 |
-
});
|
60 |
-
};
|
61 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/javascript-hint.js
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
(function () {
|
2 |
-
function forEach(arr, f) {
|
3 |
-
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
4 |
-
}
|
5 |
-
|
6 |
-
function arrayContains(arr, item) {
|
7 |
-
if (!Array.prototype.indexOf) {
|
8 |
-
var i = arr.length;
|
9 |
-
while (i--) {
|
10 |
-
if (arr[i] === item) {
|
11 |
-
return true;
|
12 |
-
}
|
13 |
-
}
|
14 |
-
return false;
|
15 |
-
}
|
16 |
-
return arr.indexOf(item) != -1;
|
17 |
-
}
|
18 |
-
|
19 |
-
CodeMirror.javascriptHint = function(editor) {
|
20 |
-
// Find the token at the cursor
|
21 |
-
var cur = editor.getCursor(), token = editor.getTokenAt(cur), tprop = token;
|
22 |
-
// If it's not a 'word-style' token, ignore the token.
|
23 |
-
if (!/^[\w$_]*$/.test(token.string)) {
|
24 |
-
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
25 |
-
className: token.string == "." ? "property" : null};
|
26 |
-
}
|
27 |
-
// If it is a property, find out what it is a property of.
|
28 |
-
while (tprop.className == "property") {
|
29 |
-
tprop = editor.getTokenAt({line: cur.line, ch: tprop.start});
|
30 |
-
if (tprop.string != ".") return;
|
31 |
-
tprop = editor.getTokenAt({line: cur.line, ch: tprop.start});
|
32 |
-
if (!context) var context = [];
|
33 |
-
context.push(tprop);
|
34 |
-
}
|
35 |
-
return {list: getCompletions(token, context),
|
36 |
-
from: {line: cur.line, ch: token.start},
|
37 |
-
to: {line: cur.line, ch: token.end}};
|
38 |
-
}
|
39 |
-
|
40 |
-
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
41 |
-
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
42 |
-
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
43 |
-
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
44 |
-
var funcProps = "prototype apply call bind".split(" ");
|
45 |
-
var keywords = ("break case catch continue debugger default delete do else false finally for function " +
|
46 |
-
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
|
47 |
-
|
48 |
-
function getCompletions(token, context) {
|
49 |
-
var found = [], start = token.string;
|
50 |
-
function maybeAdd(str) {
|
51 |
-
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
|
52 |
-
}
|
53 |
-
function gatherCompletions(obj) {
|
54 |
-
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
55 |
-
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
56 |
-
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
57 |
-
for (var name in obj) maybeAdd(name);
|
58 |
-
}
|
59 |
-
|
60 |
-
if (context) {
|
61 |
-
// If this is a property, see if it belongs to some object we can
|
62 |
-
// find in the current environment.
|
63 |
-
var obj = context.pop(), base;
|
64 |
-
if (obj.className == "variable")
|
65 |
-
base = window[obj.string];
|
66 |
-
else if (obj.className == "string")
|
67 |
-
base = "";
|
68 |
-
else if (obj.className == "atom")
|
69 |
-
base = 1;
|
70 |
-
while (base != null && context.length)
|
71 |
-
base = base[context.pop().string];
|
72 |
-
if (base != null) gatherCompletions(base);
|
73 |
-
}
|
74 |
-
else {
|
75 |
-
// If not, just look in the window object and any local scope
|
76 |
-
// (reading into JS mode internals to get at the local variables)
|
77 |
-
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
78 |
-
gatherCompletions(window);
|
79 |
-
forEach(keywords, maybeAdd);
|
80 |
-
}
|
81 |
-
return found;
|
82 |
-
}
|
83 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/overlay.js
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
// Utility function that allows modes to be combined. The mode given
|
2 |
-
// as the base argument takes care of most of the normal mode
|
3 |
-
// functionality, but a second (typically simple) mode is used, which
|
4 |
-
// can override the style of text. Both modes get to parse all of the
|
5 |
-
// text, but when both assign a non-null style to a piece of code, the
|
6 |
-
// overlay wins, unless the combine argument was true, in which case
|
7 |
-
// the styles are combined.
|
8 |
-
|
9 |
-
CodeMirror.overlayParser = function(base, overlay, combine) {
|
10 |
-
return {
|
11 |
-
startState: function() {
|
12 |
-
return {
|
13 |
-
base: CodeMirror.startState(base),
|
14 |
-
overlay: CodeMirror.startState(overlay),
|
15 |
-
basePos: 0, baseCur: null,
|
16 |
-
overlayPos: 0, overlayCur: null
|
17 |
-
};
|
18 |
-
},
|
19 |
-
copyState: function(state) {
|
20 |
-
return {
|
21 |
-
base: CodeMirror.copyState(base, state.base),
|
22 |
-
overlay: CodeMirror.copyState(overlay, state.overlay),
|
23 |
-
basePos: state.basePos, baseCur: null,
|
24 |
-
overlayPos: state.overlayPos, overlayCur: null
|
25 |
-
};
|
26 |
-
},
|
27 |
-
|
28 |
-
token: function(stream, state) {
|
29 |
-
if (stream.start == state.basePos) {
|
30 |
-
state.baseCur = base.token(stream, state.base);
|
31 |
-
state.basePos = stream.pos;
|
32 |
-
}
|
33 |
-
if (stream.start == state.overlayPos) {
|
34 |
-
stream.pos = stream.start;
|
35 |
-
state.overlayCur = overlay.token(stream, state.overlay);
|
36 |
-
state.overlayPos = stream.pos;
|
37 |
-
}
|
38 |
-
stream.pos = Math.min(state.basePos, state.overlayPos);
|
39 |
-
if (stream.eol()) state.basePos = state.overlayPos = 0;
|
40 |
-
|
41 |
-
if (state.overlayCur == null) return state.baseCur;
|
42 |
-
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
|
43 |
-
else return state.overlayCur;
|
44 |
-
},
|
45 |
-
|
46 |
-
indent: function(state, textAfter) {
|
47 |
-
return base.indent(state.base, textAfter);
|
48 |
-
},
|
49 |
-
electricChars: base.electricChars
|
50 |
-
};
|
51 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/runmode.js
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
CodeMirror.runMode = function(string, modespec, callback) {
|
2 |
-
var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
|
3 |
-
var isNode = callback.nodeType == 1;
|
4 |
-
if (isNode) {
|
5 |
-
var node = callback, accum = [];
|
6 |
-
callback = function(string, style) {
|
7 |
-
if (string == "\n")
|
8 |
-
accum.push("<br>");
|
9 |
-
else if (style)
|
10 |
-
accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + CodeMirror.htmlEscape(string) + "</span>");
|
11 |
-
else
|
12 |
-
accum.push(CodeMirror.htmlEscape(string));
|
13 |
-
}
|
14 |
-
}
|
15 |
-
var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
|
16 |
-
for (var i = 0, e = lines.length; i < e; ++i) {
|
17 |
-
if (i) callback("\n");
|
18 |
-
var stream = new CodeMirror.StringStream(lines[i]);
|
19 |
-
while (!stream.eol()) {
|
20 |
-
var style = mode.token(stream, state);
|
21 |
-
callback(stream.current(), style, i, stream.start);
|
22 |
-
stream.start = stream.pos;
|
23 |
-
}
|
24 |
-
}
|
25 |
-
if (isNode)
|
26 |
-
node.innerHTML = accum.join("");
|
27 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/simple-hint.css
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
.CodeMirror-completions {
|
2 |
-
position: absolute;
|
3 |
-
z-index: 10;
|
4 |
-
overflow: hidden;
|
5 |
-
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
6 |
-
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
7 |
-
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
8 |
-
}
|
9 |
-
.CodeMirror-completions select {
|
10 |
-
background: #fafafa;
|
11 |
-
outline: none;
|
12 |
-
border: none;
|
13 |
-
padding: 0;
|
14 |
-
margin: 0;
|
15 |
-
font-family: monospace;
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/lib/util/simple-hint.js
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
(function() {
|
2 |
-
// Minimal event-handling wrapper.
|
3 |
-
function stopEvent() {
|
4 |
-
if (this.preventDefault) {this.preventDefault(); this.stopPropagation();}
|
5 |
-
else {this.returnValue = false; this.cancelBubble = true;}
|
6 |
-
}
|
7 |
-
function connect(node, type, handler) {
|
8 |
-
function wrapHandler(event) {handler(event || window.event);}
|
9 |
-
if (typeof node.addEventListener == "function")
|
10 |
-
node.addEventListener(type, wrapHandler, false);
|
11 |
-
else
|
12 |
-
node.attachEvent("on" + type, wrapHandler);
|
13 |
-
}
|
14 |
-
|
15 |
-
CodeMirror.simpleHint = function(editor, getHints) {
|
16 |
-
// We want a single cursor position.
|
17 |
-
if (editor.somethingSelected()) return;
|
18 |
-
var result = getHints(editor);
|
19 |
-
if (!result || !result.list.length) return;
|
20 |
-
var completions = result.list;
|
21 |
-
function insert(str) {
|
22 |
-
editor.replaceRange(str, result.from, result.to);
|
23 |
-
}
|
24 |
-
// When there is only one completion, use it directly.
|
25 |
-
if (completions.length == 1) {insert(completions[0]); return true;}
|
26 |
-
|
27 |
-
// Build the select widget
|
28 |
-
var complete = document.createElement("div");
|
29 |
-
complete.className = "CodeMirror-completions";
|
30 |
-
var sel = complete.appendChild(document.createElement("select"));
|
31 |
-
// Opera doesn't move the selection when pressing up/down in a
|
32 |
-
// multi-select, but it does properly support the size property on
|
33 |
-
// single-selects, so no multi-select is necessary.
|
34 |
-
if (!window.opera) sel.multiple = true;
|
35 |
-
for (var i = 0; i < completions.length; ++i) {
|
36 |
-
var opt = sel.appendChild(document.createElement("option"));
|
37 |
-
opt.appendChild(document.createTextNode(completions[i]));
|
38 |
-
}
|
39 |
-
sel.firstChild.selected = true;
|
40 |
-
sel.size = Math.min(10, completions.length);
|
41 |
-
var pos = editor.cursorCoords();
|
42 |
-
complete.style.left = pos.x + "px";
|
43 |
-
complete.style.top = pos.yBot + "px";
|
44 |
-
document.body.appendChild(complete);
|
45 |
-
// Hack to hide the scrollbar.
|
46 |
-
if (completions.length <= 10)
|
47 |
-
complete.style.width = (sel.clientWidth - 1) + "px";
|
48 |
-
|
49 |
-
var done = false;
|
50 |
-
function close() {
|
51 |
-
if (done) return;
|
52 |
-
done = true;
|
53 |
-
complete.parentNode.removeChild(complete);
|
54 |
-
}
|
55 |
-
function pick() {
|
56 |
-
insert(completions[sel.selectedIndex]);
|
57 |
-
close();
|
58 |
-
setTimeout(function(){editor.focus();}, 50);
|
59 |
-
}
|
60 |
-
connect(sel, "blur", close);
|
61 |
-
connect(sel, "keydown", function(event) {
|
62 |
-
var code = event.keyCode;
|
63 |
-
// Enter
|
64 |
-
if (code == 13) {stopEvent(event); pick();}
|
65 |
-
// Escape
|
66 |
-
else if (code == 27) {stopEvent(event); close(); editor.focus();}
|
67 |
-
else if (code != 38 && code != 40) {
|
68 |
-
close(); editor.focus();
|
69 |
-
setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
|
70 |
-
}
|
71 |
-
});
|
72 |
-
connect(sel, "dblclick", pick);
|
73 |
-
|
74 |
-
sel.focus();
|
75 |
-
// Opera sometimes ignores focusing a freshly created node
|
76 |
-
if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
|
77 |
-
return true;
|
78 |
-
};
|
79 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/manual.html
DELETED
@@ -1,903 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror: User Manual</title>
|
5 |
-
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
|
6 |
-
<link rel="stylesheet" type="text/css" href="css/docs.css"/>
|
7 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
8 |
-
<style>dl dl {margin: 0;}</style>
|
9 |
-
</head>
|
10 |
-
<body>
|
11 |
-
|
12 |
-
<h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
|
13 |
-
|
14 |
-
<pre class="grey">
|
15 |
-
<img src="css/baboon.png" class="logo" alt="logo"/>/* User manual and
|
16 |
-
reference guide */
|
17 |
-
</pre>
|
18 |
-
|
19 |
-
<div class="clear"><div class="leftbig blk">
|
20 |
-
|
21 |
-
<h2 id="overview">Overview</h2>
|
22 |
-
|
23 |
-
<p>CodeMirror is a code-editor component that can be embedded in
|
24 |
-
Web pages. It provides <em>only</em> the editor component, no
|
25 |
-
accompanying buttons
|
26 |
-
(see <a href="http://www.octolabs.com/javascripts/codemirror-ui/">CodeMirror
|
27 |
-
UI</a> for a drop-in button bar), auto-completion, or other IDE
|
28 |
-
functionality. It does provide a rich API on top of which such
|
29 |
-
functionality can be straightforwardly implemented.</p>
|
30 |
-
|
31 |
-
<p>CodeMirror works with language-specific modes. Modes are
|
32 |
-
JavaScript programs that help color (and optionally indent) text
|
33 |
-
written in a given language. The distribution comes with a few
|
34 |
-
modes (see the <code>mode/</code> directory), and it isn't hard
|
35 |
-
to <a href="#modeapi">write new ones</a> for other languages.</p>
|
36 |
-
|
37 |
-
<h2 id="usage">Basic Usage</h2>
|
38 |
-
|
39 |
-
<p>The easiest way to use CodeMirror is to simply load the script
|
40 |
-
and style sheet found under <code>lib/</code> in the distribution,
|
41 |
-
plus a mode script from one of the <code>mode/</code> directories
|
42 |
-
and a theme stylesheet from <code>theme/</code>. (See
|
43 |
-
also <a href="compress.html">the compression helper</a>.) For
|
44 |
-
example:</p>
|
45 |
-
|
46 |
-
<pre><script src="lib/codemirror.js"></script>
|
47 |
-
<link rel="stylesheet" href="lib/codemirror.css">
|
48 |
-
<script src="mode/javascript/javascript.js"></script>
|
49 |
-
<link rel="stylesheet" href="theme/default.css"></pre>
|
50 |
-
|
51 |
-
<p>(If you use a theme other than <code>default.css</code>, you
|
52 |
-
also have to specify the
|
53 |
-
<a href="#option_theme"><code>theme</code></a> option.) Having
|
54 |
-
done this, an editor instance can be created like this:</p>
|
55 |
-
|
56 |
-
<pre>var myCodeMirror = CodeMirror(document.body);</pre>
|
57 |
-
|
58 |
-
<p>The editor will be appended to the document body, will start
|
59 |
-
empty, and will use the mode that we loaded. To have more control
|
60 |
-
over the new editor, a configuration object can be passed
|
61 |
-
to <code>CodeMirror</code> as a second argument:</p>
|
62 |
-
|
63 |
-
<pre>var myCodeMirror = CodeMirror(document.body, {
|
64 |
-
value: "function myScript(){return 100;}\n",
|
65 |
-
mode: "javascript"
|
66 |
-
});</pre>
|
67 |
-
|
68 |
-
<p>This will initialize the editor with a piece of code already in
|
69 |
-
it, and explicitly tell it to use the JavaScript mode (which is
|
70 |
-
useful when multiple modes are loaded).
|
71 |
-
See <a href="#config">below</a> for a full discussion of the
|
72 |
-
configuration options that CodeMirror accepts.</p>
|
73 |
-
|
74 |
-
<p>In cases where you don't want to append the editor to an
|
75 |
-
element, and need more control over the way it is inserted, the
|
76 |
-
first argument to the <code>CodeMirror</code> function can also
|
77 |
-
be a function that, when given a DOM element, inserts it into the
|
78 |
-
document somewhere. This could be used to, for example, replace a
|
79 |
-
textarea with a real editor:</p>
|
80 |
-
|
81 |
-
<pre>var myCodeMirror = CodeMirror(function(elt) {
|
82 |
-
myTextArea.parentNode.replaceChild(elt, myTextArea);
|
83 |
-
}, {value: myTextArea.value});</pre>
|
84 |
-
|
85 |
-
<p>However, for this use case, which is a common way to use
|
86 |
-
CodeMirror, the library provides a much more powerful
|
87 |
-
shortcut:</p>
|
88 |
-
|
89 |
-
<pre>var myCodeMirror = CodeMirror.fromTextArea(myTextArea);</pre>
|
90 |
-
|
91 |
-
<p>This will, among other things, ensure that the textarea's value
|
92 |
-
is updated when the form (if it is part of a form) is submitted.
|
93 |
-
See the <a href="#fromTextArea">API reference</a> for a full
|
94 |
-
description of this method.</p>
|
95 |
-
|
96 |
-
<h2 id="config">Configuration</h2>
|
97 |
-
|
98 |
-
<p>Both the <code>CodeMirror</code> function and
|
99 |
-
its <code>fromTextArea</code> method take as second (optional)
|
100 |
-
argument an object containing configuration options. Any option
|
101 |
-
not supplied like this will be taken
|
102 |
-
from <code>CodeMirror.defaults</code>, an object containing the
|
103 |
-
default options. You can update this object to change the defaults
|
104 |
-
on your page.</p>
|
105 |
-
|
106 |
-
<p>Options are not checked in any way, so setting bogus option
|
107 |
-
values is bound to lead to odd errors.</p>
|
108 |
-
|
109 |
-
<p>These are the supported options:</p>
|
110 |
-
|
111 |
-
<dl>
|
112 |
-
<dt id="option_value"><code>value (string)</code></dt>
|
113 |
-
<dd>The starting value of the editor.</dd>
|
114 |
-
|
115 |
-
<dt id="option_mode"><code>mode (string or object)</code></dt>
|
116 |
-
<dd>The mode to use. When not given, this will default to the
|
117 |
-
first mode that was loaded. It may be a string, which either
|
118 |
-
simply names the mode or is
|
119 |
-
a <a href="http://en.wikipedia.org/wiki/MIME">MIME</a> type
|
120 |
-
associated with the mode. Alternatively, it may be an object
|
121 |
-
containing configuration options for the mode, with
|
122 |
-
a <code>name</code> property that names the mode (for
|
123 |
-
example <code>{name: "javascript", json: true}</code>). The demo
|
124 |
-
pages for each mode contain information about what configuration
|
125 |
-
parameters the mode supports. You can ask CodeMirror which modes
|
126 |
-
and MIME types are loaded with
|
127 |
-
the <code>CodeMirror.listModes</code>
|
128 |
-
and <code>CodeMirror.listMIMEs</code> functions.</dd>
|
129 |
-
|
130 |
-
<dt id="option_theme"><code>theme (string)</code></dt>
|
131 |
-
<dd>The theme to style the editor with. You must make sure the
|
132 |
-
CSS file defining the corresponding <code>.cm-s-[name]</code>
|
133 |
-
styles is loaded (see
|
134 |
-
the <a href="theme/"><code>theme</code></a> directory in the
|
135 |
-
distribution).</dd>
|
136 |
-
|
137 |
-
<dt id="option_indentUnit"><code>indentUnit (integer)</code></dt>
|
138 |
-
<dd>How many spaces a block (whatever that means in the edited
|
139 |
-
language) should be indented. The default is 2.</dd>
|
140 |
-
|
141 |
-
<dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
|
142 |
-
<dd>Whether, when indenting, the first N*8 spaces should be
|
143 |
-
replaced by N tabs. Default is false.</dd>
|
144 |
-
|
145 |
-
<dt id="option_tabMode"><code>tabMode (string)</code></dt>
|
146 |
-
<dd>Determines what happens when the user presses the tab key.
|
147 |
-
Must be one of the following:
|
148 |
-
<dl>
|
149 |
-
<dt><code>"classic" (the default)</code></dt>
|
150 |
-
<dd>When nothing is selected, insert a tab. Otherwise,
|
151 |
-
behave like the <code>"shift"</code> mode. (When shift is
|
152 |
-
held, this behaves like the <code>"indent"</code> mode.)</dd>
|
153 |
-
<dt><code>"shift"</code></dt>
|
154 |
-
<dd>Indent all selected lines by
|
155 |
-
one <a href="#option_indentUnit"><code>indentUnit</code></a>.
|
156 |
-
If shift was held while pressing tab, un-indent all selected
|
157 |
-
lines one unit.</dd>
|
158 |
-
<dt><code>"indent"</code></dt>
|
159 |
-
<dd>Indent the line the 'correctly', based on its syntactic
|
160 |
-
context. Only works if the
|
161 |
-
mode <a href="#indent">supports</a> it.</dd>
|
162 |
-
<dt><code>"default"</code></dt>
|
163 |
-
<dd>Do not capture tab presses, let the browser apply its
|
164 |
-
default behaviour (which usually means it skips to the next
|
165 |
-
control).</dd>
|
166 |
-
</dl></dd>
|
167 |
-
|
168 |
-
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
|
169 |
-
<dd>Determines whether and how new lines are indented when the
|
170 |
-
enter key is pressed. The following modes are supported:
|
171 |
-
<dl>
|
172 |
-
<dt><code>"indent" (the default)</code></dt>
|
173 |
-
<dd>Use the mode's indentation rules to give the new line
|
174 |
-
the correct indentation.</dd>
|
175 |
-
<dt><code>"keep"</code></dt>
|
176 |
-
<dd>Indent the line the same as the previous line.</dd>
|
177 |
-
<dt><code>"flat"</code></dt>
|
178 |
-
<dd>Do not indent the new line.</dd>
|
179 |
-
</dl></dd>
|
180 |
-
|
181 |
-
<dt id="option_electricChars"><code>electricChars (boolean)</code></dt>
|
182 |
-
<dd>Configures whether the editor should re-indent the current
|
183 |
-
line when a character is typed that might change its proper
|
184 |
-
indentation (only works if the mode supports indentation).
|
185 |
-
Default is true.</dd>
|
186 |
-
|
187 |
-
<dt id="option_smartHome"><code>smartHome (boolean)</code></dt>
|
188 |
-
<dd>Configures whether the home key takes you to the first
|
189 |
-
non-whitespace character (unless already there) or to the start
|
190 |
-
of the line. On by default.</dd>
|
191 |
-
|
192 |
-
<dt id="option_pollForIME"><code>pollForIME (boolean)</code></dt>
|
193 |
-
<dd>When on (off by default), this will cause CodeMirror to poll
|
194 |
-
for input more agressively in an attempt to respond quickly to
|
195 |
-
IME (composed character) input.</dd>
|
196 |
-
|
197 |
-
<dt id="option_lineWrapping"><code>lineWrapping (boolean)</code></dt>
|
198 |
-
<dd>Whether CodeMirror should scroll or wrap for long lines.
|
199 |
-
Defaults to <code>false</code> (scroll).</dd>
|
200 |
-
|
201 |
-
<dt id="option_lineNumbers"><code>lineNumbers (boolean)</code></dt>
|
202 |
-
<dd>Whether to show line numbers to the left of the editor.</dd>
|
203 |
-
|
204 |
-
<dt id="option_firstLineNumber"><code>firstLineNumber (integer)</code></dt>
|
205 |
-
<dd>At which number to start counting lines. Default is 1.</dd>
|
206 |
-
|
207 |
-
<dt id="option_gutter"><code>gutter (boolean)</code></dt>
|
208 |
-
<dd>Can be used to force a 'gutter' (empty space on the left of
|
209 |
-
the editor) to be shown even when no line numbers are active.
|
210 |
-
This is useful for setting <a href="#setMarker">markers</a>.</dd>
|
211 |
-
|
212 |
-
<dt id="option_fixedGutter"><code>fixedGutter (boolean)</code></dt>
|
213 |
-
<dd>When enabled (off by default), this will make the gutter
|
214 |
-
stay visible when the document is scrolled horizontally.</dd>
|
215 |
-
|
216 |
-
<dt id="option_readOnly"><code>readOnly (boolean)</code></dt>
|
217 |
-
<dd>This disables editing of the editor content by the user.
|
218 |
-
(Changes through API functions will still be possible.) If you
|
219 |
-
also want to disable the cursor, use <code>"nocursor"</code> as
|
220 |
-
a value for this option, instead of <code>true</code>.</dd>
|
221 |
-
|
222 |
-
<dt id="option_onChange"><code>onChange (function)</code></dt>
|
223 |
-
<dd>When given, this function will be called every time the
|
224 |
-
content of the editor is changed. It will be given the editor
|
225 |
-
instance as only argument.</dd>
|
226 |
-
|
227 |
-
<dt id="option_onCursorActivity"><code>onCursorActivity (function)</code></dt>
|
228 |
-
<dd>Like <code>onChange</code>, but will also be called when the
|
229 |
-
cursor moves without any changes being made.</dd>
|
230 |
-
|
231 |
-
<dt id="option_onGutterClick"><code>onGutterClick (function)</code></dt>
|
232 |
-
<dd>When given, will be called whenever the editor gutter (the
|
233 |
-
line-number area) is clicked. Will be given the editor instance
|
234 |
-
as first argument, the (zero-based) number of the line that was
|
235 |
-
clicked as second argument, and the raw <code>mousedown</code>
|
236 |
-
event object as third argument.</dd>
|
237 |
-
|
238 |
-
<dt id="option_onFocus"><code>onFocus, onBlur (function)</code></dt>
|
239 |
-
<dd>The given functions will be called whenever the editor is
|
240 |
-
focused or unfocused.</dd>
|
241 |
-
|
242 |
-
<dt id="option_onScroll"><code>onScroll (function)</code></dt>
|
243 |
-
<dd>When given, will be called whenever the editor is
|
244 |
-
scrolled.</dd>
|
245 |
-
|
246 |
-
<dt id="option_onHighlightComplete"><code>onHighlightComplete (function)</code></dt>
|
247 |
-
<dd>Whenever the editor's content has been fully highlighted,
|
248 |
-
this function (if given) will be called. It'll be given a single
|
249 |
-
argument, the editor instance.</dd>
|
250 |
-
|
251 |
-
<dt id="option_matchBrackets"><code>matchBrackets (boolean)</code></dt>
|
252 |
-
<dd>Determines whether brackets are matched whenever the cursor
|
253 |
-
is moved next to a bracket.</dd>
|
254 |
-
|
255 |
-
<dt id="option_workTime"><code>workTime, workDelay (number)</code></dt>
|
256 |
-
<dd>Highlighting is done by a pseudo background-thread that will
|
257 |
-
work for <code>workTime</code> milliseconds, and then use
|
258 |
-
timeout to sleep for <code>workDelay</code> milliseconds. The
|
259 |
-
defaults are 200 and 300, you can change these options to make
|
260 |
-
the highlighting more or less aggressive.</dd>
|
261 |
-
|
262 |
-
<dt id="option_undoDepth"><code>undoDepth (integer)</code></dt>
|
263 |
-
<dd>The maximum number of undo levels that the editor stores.
|
264 |
-
Defaults to 40.</dd>
|
265 |
-
|
266 |
-
<dt id="option_tabindex"><code>tabindex (integer)</code></dt>
|
267 |
-
<dd>The <a href="http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex">tab
|
268 |
-
index</a> to assign to the editor. If not given, no tab index
|
269 |
-
will be assigned.</dd>
|
270 |
-
|
271 |
-
<dt id="option_document"><code>document (DOM document)</code></dt>
|
272 |
-
<dd>Use this if you want to display the editor in another DOM.
|
273 |
-
By default it will use the global <code>document</code>
|
274 |
-
object.</dd>
|
275 |
-
|
276 |
-
<dt id="option_onKeyEvent"><code>onKeyEvent (function)</code></dt>
|
277 |
-
<dd>This provides a rather low-level hook into CodeMirror's key
|
278 |
-
handling. If provided, this function will be called on
|
279 |
-
every <code>keydown</code>, <code>keyup</code>,
|
280 |
-
and <code>keypress</code> event that CodeMirror captures. It
|
281 |
-
will be passed two arguments, the editor instance and the key
|
282 |
-
event. This key event is pretty much the raw key event, except
|
283 |
-
that a <code>stop()</code> method is always added to it. You
|
284 |
-
could feed it to, for example, <code>jQuery.Event</code> to
|
285 |
-
further normalize it.<br>This function can inspect the key
|
286 |
-
event, and handle it if it wants to. It may return true to tell
|
287 |
-
CodeMirror to ignore the event. Be wary that, on some browsers,
|
288 |
-
stopping a <code>keydown</code> does not stop
|
289 |
-
the <code>keypress</code> from firing, whereas on others it
|
290 |
-
does. If you respond to an event, you should probably inspect
|
291 |
-
its <code>type</code> property and only do something when it
|
292 |
-
is <code>keydown</code> (or <code>keypress</code> for actions
|
293 |
-
that need character data).</dd>
|
294 |
-
</dl>
|
295 |
-
|
296 |
-
<h2 id="styling">Customized Styling</h2>
|
297 |
-
|
298 |
-
<p>Up to a certain extent, CodeMirror's look can be changed by
|
299 |
-
modifying style sheet files. The style sheets supplied by modes
|
300 |
-
simply provide the colors for that mode, and can be adapted in a
|
301 |
-
very straightforward way. To style the editor itself, it is
|
302 |
-
possible to alter or override the styles defined
|
303 |
-
in <a href="lib/codemirror.css"><code>codemirror.css</code></a>.</p>
|
304 |
-
|
305 |
-
<p>Some care must be taken there, since a lot of the rules in this
|
306 |
-
file are necessary to have CodeMirror function properly. Adjusting
|
307 |
-
colors should be safe, of course, and with some care a lot of
|
308 |
-
other things can be changed as well. The CSS classes defined in
|
309 |
-
this file serve the following roles:</p>
|
310 |
-
|
311 |
-
<dl>
|
312 |
-
<dt id="class_CodeMirror"><code>CodeMirror</code></dt>
|
313 |
-
<dd>The outer element of the editor. This should be used for
|
314 |
-
borders and positioning. Can also be used to set styles that
|
315 |
-
should hold for everything inside the editor (such as font
|
316 |
-
and font size), or to set a background.</dd>
|
317 |
-
|
318 |
-
<dt id="class_CodeMirror_scroll"><code>CodeMirror-scroll</code></dt>
|
319 |
-
<dd>This determines whether the editor scrolls (<code>overflow:
|
320 |
-
auto</code> + fixed height). By default, it does. Giving
|
321 |
-
this <code>height: auto; overflow: visible;</code> will cause
|
322 |
-
the editor to resize to fit its content.</dd>
|
323 |
-
|
324 |
-
<dt id="class_CodeMirror_focused"><code>CodeMirror-focused</code></dt>
|
325 |
-
<dd>Whenever the editor is focused, the top element gets this
|
326 |
-
class. This is used to hide the cursor and give the selection a
|
327 |
-
different color when the editor is not focused.</dd>
|
328 |
-
|
329 |
-
<dt id="class_CodeMirror_gutter"><code>CodeMirror-gutter</code></dt>
|
330 |
-
<dd>Use this for giving a background or a border to the editor
|
331 |
-
gutter. Don't set any padding here,
|
332 |
-
use <code>CodeMirror-gutter-text</code> for that. By default,
|
333 |
-
the gutter is 'fluid', meaning it will adjust its width to the
|
334 |
-
maximum line number or line marker width. You can also set a
|
335 |
-
fixed width if you want.</dd>
|
336 |
-
|
337 |
-
<dt id="class_CodeMirror_gutter_text"><code>CodeMirror-gutter-text</code></dt>
|
338 |
-
<dd>Used to style the actual line numbers. For the numbers to
|
339 |
-
line up, you must make sure that the font in the gutter is the
|
340 |
-
same as the one in the rest of the editor, so you should
|
341 |
-
probably only set font style and size in
|
342 |
-
the <code>CodeMirror</code> class.</dd>
|
343 |
-
|
344 |
-
<dt id="class_CodeMirror_lines"><code>CodeMirror-lines</code></dt>
|
345 |
-
<dd>The visible lines. If this has vertical
|
346 |
-
padding, <code>CodeMirror-gutter</code> should have the same
|
347 |
-
padding.</dd>
|
348 |
-
|
349 |
-
<dt id="class_CodeMirror_cursor"><code>CodeMirror-cursor</code></dt>
|
350 |
-
<dd>The cursor is a block element that is absolutely positioned.
|
351 |
-
You can make it look whichever way you want.</dd>
|
352 |
-
|
353 |
-
<dt id="class_CodeMirror_selected"><code>CodeMirror-selected</code></dt>
|
354 |
-
<dd>The selection is represented by <code>span</code> elements
|
355 |
-
with this class.</dd>
|
356 |
-
|
357 |
-
<dt id="class_CodeMirror_matchingbracket"><code>CodeMirror-matchingbracket</code>,
|
358 |
-
<code>CodeMirror-nonmatchingbracket</code></dt>
|
359 |
-
<dd>These are used to style matched (or unmatched) brackets.</dd>
|
360 |
-
</dl>
|
361 |
-
|
362 |
-
<p>The actual lines, as well as the cursor, are represented
|
363 |
-
by <code>pre</code> elements. By default no text styling (such as
|
364 |
-
bold) that might change line height is applied. If you do want
|
365 |
-
such effects, you'll have to give <code>CodeMirror pre</code> a
|
366 |
-
fixed height. Also, you must still take care that character width
|
367 |
-
is constant.</p>
|
368 |
-
|
369 |
-
<p>If your page's style sheets do funky things to
|
370 |
-
all <code>div</code> or <code>pre</code> elements (you probably
|
371 |
-
shouldn't do that), you'll have to define rules to cancel these
|
372 |
-
effects out again for elements under the <code>CodeMirror</code>
|
373 |
-
class.</p>
|
374 |
-
|
375 |
-
<h2 id="api">Programming API</h2>
|
376 |
-
|
377 |
-
<p>A lot of CodeMirror features are only available through its API.
|
378 |
-
This has the disadvantage that you need to do work to enable them,
|
379 |
-
and the advantage that CodeMirror will fit seamlessly into your
|
380 |
-
application.</p>
|
381 |
-
|
382 |
-
<p>Whenever points in the document are represented, the API uses
|
383 |
-
objects with <code>line</code> and <code>ch</code> properties.
|
384 |
-
Both are zero-based. CodeMirror makes sure to 'clip' any positions
|
385 |
-
passed by client code so that they fit inside the document, so you
|
386 |
-
shouldn't worry too much about sanitizing your coordinates. If you
|
387 |
-
give <code>ch</code> a value of <code>null</code>, or don't
|
388 |
-
specify it, it will be replaced with the length of the specified
|
389 |
-
line.</p>
|
390 |
-
|
391 |
-
<dl>
|
392 |
-
<dt id="getValue"><code>getValue() → string</code></dt>
|
393 |
-
<dd>Get the current editor content.</dd>
|
394 |
-
<dt id="setValue"><code>setValue(string)</code></dt>
|
395 |
-
<dd>Set the editor content.</dd>
|
396 |
-
|
397 |
-
<dt id="getSelection"><code>getSelection() → string</code></dt>
|
398 |
-
<dd>Get the currently selected code.</dd>
|
399 |
-
<dt id="replaceSelection"><code>replaceSelection(string)</code></dt>
|
400 |
-
<dd>Replace the selection with the given string.</dd>
|
401 |
-
|
402 |
-
<dt id="focus"><code>focus()</code></dt>
|
403 |
-
<dd>Give the editor focus.</dd>
|
404 |
-
|
405 |
-
<dt id="setOption"><code>setOption(option, value)</code></dt>
|
406 |
-
<dd>Change the configuration of the editor. <code>option</code>
|
407 |
-
should the name of an <a href="#config">option</a>,
|
408 |
-
and <code>value</code> should be a valid value for that
|
409 |
-
option.</dd>
|
410 |
-
<dt id="getOption"><code>getOption(option) → value</code></dt>
|
411 |
-
<dd>Retrieves the current value of the given option for this
|
412 |
-
editor instance.</dd>
|
413 |
-
|
414 |
-
<dt id="cursorCoords"><code>cursorCoords(start) → object</code></dt>
|
415 |
-
<dd>Returns an <code>{x, y, yBot}</code> object containing the
|
416 |
-
coordinates of the cursor relative to the top-left corner of the
|
417 |
-
page. <code>yBot</code> is the coordinate of the bottom of the
|
418 |
-
cursor. <code>start</code> is a boolean indicating whether you
|
419 |
-
want the start or the end of the selection.</dd>
|
420 |
-
<dt id="charCoords"><code>charCoords(pos) → object</code></dt>
|
421 |
-
<dd>Like <code>cursorCoords</code>, but returns the position of
|
422 |
-
an arbitrary characters. <code>pos</code> should be
|
423 |
-
a <code>{line, ch}</code> object.</dd>
|
424 |
-
<dt id="coordsChar"><code>coordsChar(object) → pos</code></dt>
|
425 |
-
<dd>Given an <code>{x, y}</code> object (in page coordinates),
|
426 |
-
returns the <code>{line, ch}</code> position that corresponds to
|
427 |
-
it.</dd>
|
428 |
-
|
429 |
-
<dt id="undo"><code>undo()</code></dt>
|
430 |
-
<dd>Undo one edit (if any undo events are stored).</dd>
|
431 |
-
<dt id="redo"><code>redo()</code></dt>
|
432 |
-
<dd>Redo one undone edit.</dd>
|
433 |
-
<dt id="historySize"><code>historySize() → object</code></dt>
|
434 |
-
<dd>Returns an object with <code>{undo, redo}</code> properties,
|
435 |
-
both of which hold integers, indicating the amount of stored
|
436 |
-
undo and redo operations.</dd>
|
437 |
-
<dt id="clearHistory"><code>clearHistory()</code></dt>
|
438 |
-
<dd>Clears the editor's undo history.</dd>
|
439 |
-
|
440 |
-
<dt id="indentLine"><code>indentLine(line, dir)</code></dt>
|
441 |
-
<dd>Reset the given line's indentation to the indentation
|
442 |
-
prescribed by the mode. If the second argument is given,
|
443 |
-
indentation will be increased (if <code>dir</code> is true) or
|
444 |
-
decreased (if false) by an <a href="#option_indentUnit">indent
|
445 |
-
unit</a> instead.</dd>
|
446 |
-
|
447 |
-
<dt id="getSearchCursor"><code>getSearchCursor(query, start, caseFold) → cursor</code></dt>
|
448 |
-
<dd>Used to implement search/replace
|
449 |
-
functionality. <code>query</code> can be a regular expression or
|
450 |
-
a string (only strings will match across lines—if they contain
|
451 |
-
newlines). <code>start</code> provides the starting position of
|
452 |
-
the search. It can be a <code>{line, ch}</code> object, or can
|
453 |
-
be left off to default to the start of the
|
454 |
-
document. <code>caseFold</code> is only relevant when matching a
|
455 |
-
string. It will cause the search to be case-insensitive. A
|
456 |
-
search cursor has the following methods:
|
457 |
-
<dl>
|
458 |
-
<dt><code>findNext(), findPrevious() → boolean</code></dt>
|
459 |
-
<dd>Search forward or backward from the current position.
|
460 |
-
The return value indicates whether a match was found. If
|
461 |
-
matching a regular expression, the return value will be the
|
462 |
-
array returned by the <code>match</code> method, in case you
|
463 |
-
want to extract matched groups.</dd>
|
464 |
-
<dt><code>from(), to() → object</code></dt>
|
465 |
-
<dd>These are only valid when the last call
|
466 |
-
to <code>findNext</code> or <code>findPrevious</code> did
|
467 |
-
not return false. They will return <code>{line, ch}</code>
|
468 |
-
objects pointing at the start and end of the match.</dd>
|
469 |
-
<dt><code>replace(text)</code></dt>
|
470 |
-
<dd>Replaces the currently found match with the given text
|
471 |
-
and adjusts the cursor position to reflect the
|
472 |
-
replacement.</dd>
|
473 |
-
</dl></dd>
|
474 |
-
|
475 |
-
<dt id="getTokenAt"><code>getTokenAt(pos) → object</code></dt>
|
476 |
-
<dd>Retrieves information about the token the current mode found
|
477 |
-
at the given position (a <code>{line, ch}</code> object). The
|
478 |
-
returned object has the following properties:
|
479 |
-
<dl>
|
480 |
-
<dt><code>start</code></dt><dd>The character (on the given line) at which the token starts.</dd>
|
481 |
-
<dt><code>end</code></dt><dd>The character at which the token ends.</dd>
|
482 |
-
<dt><code>string</code></dt><dd>The token's string.</dd>
|
483 |
-
<dt><code>className</code></dt><dd>The class the mode assigned
|
484 |
-
to the token. (Can be null when no class was assigned.)</dd>
|
485 |
-
<dt><code>state</code></dt><dd>The mode's state at the end of this token.</dd>
|
486 |
-
</dl></dd>
|
487 |
-
|
488 |
-
<dt id="markText"><code>markText(from, to, className) → object</code></dt>
|
489 |
-
<dd>Can be used to mark a range of text with a specific CSS
|
490 |
-
class name. <code>from</code> and <code>to</code> should
|
491 |
-
be <code>{line, ch}</code> objects. The method will return an
|
492 |
-
object with two methods, <code>clear()</code>, which removes the
|
493 |
-
mark, and <code>find()</code>, which returns a <code>{from,
|
494 |
-
to}</code> (both document positions), indicating the current
|
495 |
-
position of the marked range.</dd>
|
496 |
-
|
497 |
-
<dt id="setBookmark"><code>setBookmark(pos) → object</code></dt>
|
498 |
-
<dd>Inserts a bookmark, a handle that follows the text around it
|
499 |
-
as it is being edited, at the given position. A bookmark has two
|
500 |
-
methods <code>find()</code> and <code>clear()</code>. The first
|
501 |
-
returns the current position of the bookmark, if it is still in
|
502 |
-
the document, and the second explicitly removes the
|
503 |
-
bookmark.</dd>
|
504 |
-
|
505 |
-
<dt id="setMarker"><code>setMarker(line, text, className) → lineHandle</code></dt>
|
506 |
-
<dd>Add a gutter marker for the given line. Gutter markers are
|
507 |
-
shown in the line-number area (instead of the number for this
|
508 |
-
line). Both <code>text</code> and <code>className</code> are
|
509 |
-
optional. Setting <code>text</code> to a Unicode character like
|
510 |
-
● tends to give a nice effect. To put a picture in the gutter,
|
511 |
-
set <code>text</code> to a space and <code>className</code> to
|
512 |
-
something that sets a background image. If you
|
513 |
-
specify <code>text</code>, the given text (which may contain
|
514 |
-
HTML) will, by default, replace the line number for that line.
|
515 |
-
If this is not what you want, you can include the
|
516 |
-
string <code>%N%</code> in the text, which will be replaced by
|
517 |
-
the line number.</dd>
|
518 |
-
<dt id="clearMarker"><code>clearMarker(line)</code></dt>
|
519 |
-
<dd>Clears a marker created
|
520 |
-
with <code>setMarker</code>. <code>line</code> can be either a
|
521 |
-
number or a handle returned by <code>setMarker</code> (since a
|
522 |
-
number may now refer to a different line if something was added
|
523 |
-
or deleted).</dd>
|
524 |
-
<dt id="setLineClass"><code>setLineClass(line, className) → lineHandle</code></dt>
|
525 |
-
<dd>Set a CSS class name for the given line. <code>line</code>
|
526 |
-
can be a number or a line handle (as returned
|
527 |
-
by <code>setMarker</code> or this function).
|
528 |
-
Pass <code>null</code> to clear the class for a line.</dd>
|
529 |
-
<dt id="hideLine"><code>hideLine(line) → lineHandle</code></dt>
|
530 |
-
<dd>Hide the given line (either by number or by handle). Hidden
|
531 |
-
lines don't show up in the editor, and their numbers are skipped
|
532 |
-
when <a href="#option_lineNumbers">line numbers</a> are enabled.
|
533 |
-
Deleting a region around them does delete them, and coping a
|
534 |
-
region around will include them in the copied text.</dd>
|
535 |
-
<dt id="showLine"><code>showLine(line) → lineHandle</code></dt>
|
536 |
-
<dd>The inverse of <code>hideLine</code>—re-shows a previously
|
537 |
-
hidden line, by number or by handle.</dd>
|
538 |
-
|
539 |
-
<dt id="lineInfo"><code>lineInfo(line) → object</code></dt>
|
540 |
-
<dd>Returns the line number, text content, and marker status of
|
541 |
-
the given line, which can be either a number or a handle
|
542 |
-
returned by <code>setMarker</code>. The returned object has the
|
543 |
-
structure <code>{line, handle, text, markerText, markerClass}</code>.</dd>
|
544 |
-
|
545 |
-
<dt id="addWidget"><code>addWidget(pos, node, scrollIntoView)</code></dt>
|
546 |
-
<dd>Puts <code>node</code>, which should be an absolutely
|
547 |
-
positioned DOM node, into the editor, positioned right below the
|
548 |
-
given <code>{line, ch}</code> position.
|
549 |
-
When <code>scrollIntoView</code> is true, the editor will ensure
|
550 |
-
that the entire node is visible (if possible). To remove the
|
551 |
-
widget again, simply use DOM methods (move it somewhere else, or
|
552 |
-
call <code>removeChild</code> on its parent).</dd>
|
553 |
-
|
554 |
-
<dt id="matchBrackets"><code>matchBrackets()</code></dt>
|
555 |
-
<dd>Force matching-bracket-highlighting to happen.</dd>
|
556 |
-
|
557 |
-
<dt id="lineCount"><code>lineCount() → number</code></dt>
|
558 |
-
<dd>Get the number of lines in the editor.</dd>
|
559 |
-
|
560 |
-
<dt id="getCursor"><code>getCursor(start) → object</code></dt>
|
561 |
-
<dd><code>start</code> is a boolean indicating whether the start
|
562 |
-
or the end of the selection must be retrieved. If it is not
|
563 |
-
given, the current cursor pos, i.e. the side of the selection
|
564 |
-
that would move if you pressed an arrow key, is chosen.
|
565 |
-
A <code>{line, ch}</code> object will be returned.</dd>
|
566 |
-
<dt id="somethingSelected"><code>somethingSelected() → boolean</code></dt>
|
567 |
-
<dd>Return true if any text is selected.</dd>
|
568 |
-
<dt id="setCursor"><code>setCursor(pos)</code></dt>
|
569 |
-
<dd>Set the cursor position. You can either pass a
|
570 |
-
single <code>{line, ch}</code> object, or the line and the
|
571 |
-
character as two separate parameters.</dd>
|
572 |
-
<dt id="setSelection"><code>setSelection(start, end)</code></dt>
|
573 |
-
<dd>Set the selection range. <code>start</code>
|
574 |
-
and <code>end</code> should be <code>{line, ch}</code> objects.</dd>
|
575 |
-
|
576 |
-
<dt id="getLine"><code>getLine(n) → string</code></dt>
|
577 |
-
<dd>Get the content of line <code>n</code>.</dd>
|
578 |
-
<dt id="setLine"><code>setLine(n, text)</code></dt>
|
579 |
-
<dd>Set the content of line <code>n</code>.</dd>
|
580 |
-
<dt id="removeLine"><code>removeLine(n)</code></dt>
|
581 |
-
<dd>Remove the given line from the document.</dd>
|
582 |
-
|
583 |
-
<dt id="getRange"><code>getRange(from, to) → string</code></td>
|
584 |
-
<dd>Get the text between the given points in the editor, which
|
585 |
-
should be <code>{line, ch}</code> objects.</dd>
|
586 |
-
<dt id="replaceRange"><code>replaceRange(string, from, to)</code></dt>
|
587 |
-
<dd>Replace the part of the document between <code>from</code>
|
588 |
-
and <code>to</code> with the given string. <code>from</code>
|
589 |
-
and <code>to</code> must be <code>{line, ch}</code>
|
590 |
-
objects. <code>to</code> can be left off to simply insert the
|
591 |
-
string at position <code>from</code>.</dd>
|
592 |
-
|
593 |
-
<dt id="coordsFromIndex"><code>coordsFromIndex(index) → object</code></dt>
|
594 |
-
<dd>Calculates and returns a <code>{line, ch}</code> object for a
|
595 |
-
zero-based <code>index</code> who's value is relative to the start of the
|
596 |
-
editor's text. If the <code>index</code> is out of range of the text then
|
597 |
-
the returned object is clipped to start or end of the text
|
598 |
-
respectively.</dd>
|
599 |
-
</dl>
|
600 |
-
|
601 |
-
<p>The following are more low-level methods:</p>
|
602 |
-
|
603 |
-
<dl>
|
604 |
-
<dt id="operation"><code>operation(func) → result</code></dt>
|
605 |
-
<dd>CodeMirror internally buffers changes and only updates its
|
606 |
-
DOM structure after it has finished performing some operation.
|
607 |
-
If you need to perform a lot of operations on a CodeMirror
|
608 |
-
instance, you can call this method with a function argument. It
|
609 |
-
will call the function, buffering up all changes, and only doing
|
610 |
-
the expensive update after the function returns. This can be a
|
611 |
-
lot faster. The return value from this method will be the return
|
612 |
-
value of your function.</dd>
|
613 |
-
|
614 |
-
<dt id="refresh"><code>refresh()</code></dt>
|
615 |
-
<dd>If your code does something to change the size of the editor
|
616 |
-
element (window resizes are already listened for), or unhides
|
617 |
-
it, you should probably follow up by calling this method to
|
618 |
-
ensure CodeMirror is still looking as intended.</dd>
|
619 |
-
|
620 |
-
<dt id="getInputField"><code>getInputField() → textarea</code></dt>
|
621 |
-
<dd>Returns the hiden textarea used to read input.</dd>
|
622 |
-
<dt id="getWrapperElement"><code>getWrapperElement() → node</code></dt>
|
623 |
-
<dd>Returns the DOM node that represents the editor. Remove this
|
624 |
-
from your tree to delete an editor instance.</dd>
|
625 |
-
<dt id="getScrollerElement"><code>getScrollerElement() → node</code></dt>
|
626 |
-
<dd>Returns the DOM node that is responsible for the sizing and
|
627 |
-
the scrolling of the editor. You can change
|
628 |
-
the <code>height</code> and <code>width</code> styles of this
|
629 |
-
element to resize an editor. (You might have to call
|
630 |
-
the <a href="#refresh"><code>refresh</code></a> method
|
631 |
-
afterwards.)</dd>
|
632 |
-
<dt id="getGutterElement"><code>getGutterElement() → node</code></dt>
|
633 |
-
<dd>Fetches the DOM node that represents the editor gutter.</dd>
|
634 |
-
|
635 |
-
<dt id="getStateAfter"><code>getStateAfter(line) → state</code></dt>
|
636 |
-
<dd>Returns the mode's parser state, if any, at the end of the
|
637 |
-
given line number. If no line number is given, the state at the
|
638 |
-
end of the document is returned. This can be useful for storing
|
639 |
-
parsing errors in the state, or getting other kinds of
|
640 |
-
contextual information for a line.</dd>
|
641 |
-
</dl>
|
642 |
-
|
643 |
-
<p id="fromTextArea">Finally, the <code>CodeMirror</code> object
|
644 |
-
itself has a method <code>fromTextArea</code>. This takes a
|
645 |
-
textarea DOM node as first argument and an optional configuration
|
646 |
-
object as second. It will replace the textarea with a CodeMirror
|
647 |
-
instance, and wire up the form of that textarea (if any) to make
|
648 |
-
sure the editor contents are put into the textarea when the form
|
649 |
-
is submitted. A CodeMirror instance created this way has two
|
650 |
-
additional methods:</p>
|
651 |
-
|
652 |
-
<dl>
|
653 |
-
<dt id="save"><code>save()</code></dt>
|
654 |
-
<dd>Copy the content of the editor into the textarea.</dd>
|
655 |
-
|
656 |
-
<dt id="toTextArea"><code>toTextArea()</code></dt>
|
657 |
-
<dd>Remove the editor, and restore the original textarea (with
|
658 |
-
the editor's current content).</dd>
|
659 |
-
</dl>
|
660 |
-
|
661 |
-
<p id="defineExtension">If you want to define extra methods in terms
|
662 |
-
of the CodeMirror API, it is possible to
|
663 |
-
use <code>CodeMirror.defineExtension(name, value)</code>. This
|
664 |
-
will cause the given value (usually a method) to be added to all
|
665 |
-
CodeMirror instances created from then on.</p>
|
666 |
-
|
667 |
-
<h2 id="modeapi">Writing CodeMirror Modes</h2>
|
668 |
-
|
669 |
-
<p>Modes typically consist of a JavaScript file and a CSS file.
|
670 |
-
The CSS file (see, for
|
671 |
-
example <a href="mode/javascript/javascript.css"><code>javascript.css</code></a>)
|
672 |
-
defines the classes that will be used to style the syntactic
|
673 |
-
elements of the code, and the script contains the logic to
|
674 |
-
actually assign these classes to the right pieces of text.</p>
|
675 |
-
|
676 |
-
<p>You'll usually want to use some kind of prefix for your CSS
|
677 |
-
classes, so that they are unlikely to clash with other classes,
|
678 |
-
both those used by other modes and those defined by the page in
|
679 |
-
which CodeMirror is embedded.</p>
|
680 |
-
|
681 |
-
<p id="defineMode">The mode script should
|
682 |
-
call <code>CodeMirror.defineMode</code> to register itself with
|
683 |
-
CodeMirror. This function takes two arguments. The first should be
|
684 |
-
the name of the mode, for which you should use a lowercase string,
|
685 |
-
preferably one that is also the name of the files that define the
|
686 |
-
mode (i.e. <code>"xml"</code> is defined <code>xml.js</code>). The
|
687 |
-
second argument should be a function that, given a CodeMirror
|
688 |
-
configuration object (the thing passed to
|
689 |
-
the <code>CodeMirror</code> function) and a mode configuration
|
690 |
-
object (as in the <a href="#option_mode"><code>mode</code></a>
|
691 |
-
option), returns a mode object.</p>
|
692 |
-
|
693 |
-
<p>Typically, you should use this second argument
|
694 |
-
to <code>defineMode</code> as your module scope function (modes
|
695 |
-
should not leak anything into the global scope!), i.e. write your
|
696 |
-
whole mode inside this function.</p>
|
697 |
-
|
698 |
-
<p>The main responsibility of a mode script is <em>parsing</em>
|
699 |
-
the content of the editor. Depending on the language and the
|
700 |
-
amount of functionality desired, this can be done in really easy
|
701 |
-
or extremely complicated ways. Some parsers can be stateless,
|
702 |
-
meaning that they look at one element (<em>token</em>) of the code
|
703 |
-
at a time, with no memory of what came before. Most, however, will
|
704 |
-
need to remember something. This is done by using a <em>state
|
705 |
-
object</em>, which is an object that can be mutated every time a
|
706 |
-
new token is read.</p>
|
707 |
-
|
708 |
-
<p id="startState">Modes that use a state must define
|
709 |
-
a <code>startState</code> method on their mode object. This is a
|
710 |
-
function of no arguments that produces a state object to be used
|
711 |
-
at the start of a document.</p>
|
712 |
-
|
713 |
-
<p id="token">The most important part of a mode object is
|
714 |
-
its <code>token(stream, state)</code> method. All modes must
|
715 |
-
define this method. It should read one token from the stream it is
|
716 |
-
given as an argument, optionally update its state, and return a
|
717 |
-
style string, or <code>null</code> for tokens that do not have to
|
718 |
-
be styled. For your styles, you can either use the 'standard' ones
|
719 |
-
defined in the themes (without the <code>cm-</code> prefix), or
|
720 |
-
define your own (as the <a href="../mode/diff/index.html">diff</a>
|
721 |
-
mode does) and have people include a custom theme for your
|
722 |
-
mode.<p>
|
723 |
-
|
724 |
-
<p id="StringStream">The stream object encapsulates a line of code
|
725 |
-
(tokens may never span lines) and our current position in that
|
726 |
-
line. It has the following API:</p>
|
727 |
-
|
728 |
-
<dl>
|
729 |
-
<dt><code>eol() → boolean</code></dt>
|
730 |
-
<dd>Returns true only if the stream is at the end of the
|
731 |
-
line.</dd>
|
732 |
-
<dt><code>sol() → boolean</code></dt>
|
733 |
-
<dd>Returns true only if the stream is at the start of the
|
734 |
-
line.</dd>
|
735 |
-
|
736 |
-
<dt><code>peek() → character</code></dt>
|
737 |
-
<dd>Returns the next character in the stream without advancing
|
738 |
-
it. Will return <code>undefined</code> at the end of the
|
739 |
-
line.</dd>
|
740 |
-
<dt><code>next() → character</code></dt>
|
741 |
-
<dd>Returns the next character in the stream and advances it.
|
742 |
-
Also returns <code>undefined</code> when no more characters are
|
743 |
-
available.</dd>
|
744 |
-
|
745 |
-
<dt><code>eat(match) → character</code></dt>
|
746 |
-
<dd><code>match</code> can be a character, a regular expression,
|
747 |
-
or a function that takes a character and returns a boolean. If
|
748 |
-
the next character in the stream 'matches' the given argument,
|
749 |
-
it is consumed and returned. Otherwise, <code>undefined</code>
|
750 |
-
is returned.</dd>
|
751 |
-
<dt><code>eatWhile(match) → boolean</code></dt>
|
752 |
-
<dd>Repeatedly calls <code>eat</code> with the given argument,
|
753 |
-
until it fails. Returns true if any characters were eaten.</dd>
|
754 |
-
<dt><code>eatSpace() → boolean</code></dt>
|
755 |
-
<dd>Shortcut for <code>eatWhile</code> when matching
|
756 |
-
white-space.</dd>
|
757 |
-
<dt><code>skipToEnd()</code></dt>
|
758 |
-
<dd>Moves the position to the end of the line.</dd>
|
759 |
-
<dt><code>skipTo(ch) → boolean</code></dt>
|
760 |
-
<dd>Skips to the next occurrence of the given character, if
|
761 |
-
found on the current line (doesn't advance the stream if the
|
762 |
-
character does not occur on the line). Returns true if the
|
763 |
-
character was found.</dd>
|
764 |
-
<dt><code>match(pattern, consume, caseFold) → boolean</code></dt>
|
765 |
-
<dd>Act like a
|
766 |
-
multi-character <code>eat</code>—if <code>consume</code> is true
|
767 |
-
or not given—or a look-ahead that doesn't update the stream
|
768 |
-
position—if it is false. <code>pattern</code> can be either a
|
769 |
-
string or a regular expression starting with <code>^</code>.
|
770 |
-
When it is a string, <code>caseFold</code> can be set to true to
|
771 |
-
make the match case-insensitive. When successfully matching a
|
772 |
-
regular expression, the returned value will be the array
|
773 |
-
returned by <code>match</code>, in case you need to extract
|
774 |
-
matched groups.</dd>
|
775 |
-
|
776 |
-
<dt><code>backUp(n)</code></dt>
|
777 |
-
<dd>Backs up the stream <code>n</code> characters. Backing it up
|
778 |
-
further than the start of the current token will cause things to
|
779 |
-
break, so be careful.</dd>
|
780 |
-
<dt><code>column() → integer</code></dt>
|
781 |
-
<dd>Returns the column (taking into account tabs) at which the
|
782 |
-
current token starts. Can be used to find out whether a token
|
783 |
-
starts a new line.</dd>
|
784 |
-
<dt><code>indentation() → integer</code></dt>
|
785 |
-
<dd>Tells you how far the current line has been indented, in
|
786 |
-
spaces. Corrects for tab characters.</dd>
|
787 |
-
|
788 |
-
<dt><code>current() → string</code></dt>
|
789 |
-
<dd>Get the string between the start of the current token and
|
790 |
-
the current stream position.</dd>
|
791 |
-
</dl>
|
792 |
-
|
793 |
-
<p id="blankLine">By default, blank lines are simply skipped when
|
794 |
-
tokenizing a document. For languages that have significant blank
|
795 |
-
lines, you can define a <code>blankLine(state)</code> method on
|
796 |
-
your mode that will get called whenever a blank line is passed
|
797 |
-
over, so that it can update the parser state.</p>
|
798 |
-
|
799 |
-
<p id="copyState">Because state object are mutated, and CodeMirror
|
800 |
-
needs to keep valid versions of a state around so that it can
|
801 |
-
restart a parse at any line, copies must be made of state objects.
|
802 |
-
The default algorithm used is that a new state object is created,
|
803 |
-
which gets all the properties of the old object. Any properties
|
804 |
-
which hold arrays get a copy of these arrays (since arrays tend to
|
805 |
-
be used as mutable stacks). When this is not correct, for example
|
806 |
-
because a mode mutates non-array properties of its state object, a
|
807 |
-
mode object should define a <code>copyState</code> method,
|
808 |
-
which is given a state and should return a safe copy of that
|
809 |
-
state.</p>
|
810 |
-
|
811 |
-
<p id="compareStates">By default, CodeMirror will stop re-parsing
|
812 |
-
a document as soon as it encounters a few lines that were
|
813 |
-
highlighted the same in the old parse as in the new one. It is
|
814 |
-
possible to provide an explicit way to test whether a state is
|
815 |
-
equivalent to another one, which CodeMirror will use (instead of
|
816 |
-
the unchanged-lines heuristic) to decide when to stop
|
817 |
-
highlighting. You do this by providing
|
818 |
-
a <code>compareStates</code> method on your mode object, which
|
819 |
-
takes two state arguments and returns a boolean indicating whether
|
820 |
-
they are equivalent. See the XML mode, which uses this to provide
|
821 |
-
reliable highlighting of bad closing tags, as an example.</p>
|
822 |
-
|
823 |
-
<p id="indent">If you want your mode to provide smart indentation
|
824 |
-
(see <a href="#option_enterMode"><code>entermode</code></a>
|
825 |
-
and <a href="#option_tabMode"><code>tabMode</code></a> when they
|
826 |
-
have a value of <code>"indent"</code>), you must define
|
827 |
-
an <code>indent(state, textAfter)</code> method on your mode
|
828 |
-
object.</p>
|
829 |
-
|
830 |
-
<p>The indentation method should inspect the given state object,
|
831 |
-
and optionally the <code>textAfter</code> string, which contains
|
832 |
-
the text on the line that is being indented, and return an
|
833 |
-
integer, the amount of spaces to indent. It should usually take
|
834 |
-
the <a href="#option_indentUnit"><code>indentUnit</code></a>
|
835 |
-
option into account.</p>
|
836 |
-
|
837 |
-
<p id="electricChars">Finally, a mode may define
|
838 |
-
an <code>electricChars</code> property, which should hold a string
|
839 |
-
containing all the characters that should trigger the behaviour
|
840 |
-
described for
|
841 |
-
the <a href="#option_electricChars"><code>electricChars</code></a>
|
842 |
-
option.</p>
|
843 |
-
|
844 |
-
<p>So, to summarize, a mode <em>must</em> provide
|
845 |
-
a <code>token</code> method, and it <em>may</em>
|
846 |
-
provide <code>startState</code>, <code>copyState</code>,
|
847 |
-
and <code>indent</code> methods. For an example of a trivial mode,
|
848 |
-
see the <a href="mode/diff/diff.js">diff mode</a>, for a more
|
849 |
-
involved example, see
|
850 |
-
the <a href="mode/javascript/javascript.js">JavaScript
|
851 |
-
mode</a>.</p>
|
852 |
-
|
853 |
-
<p>Sometimes, it is useful for modes to <em>nest</em>—to have one
|
854 |
-
mode delegate work to another mode. An example of this kind of
|
855 |
-
mode is the <a href="mode/htmlmixed/htmlmixed.js">mixed-mode HTML
|
856 |
-
mode</a>. To implement such nesting, it is usually necessary to
|
857 |
-
create mode objects and copy states yourself. To create a mode
|
858 |
-
object, there are <code>CodeMirror.getMode(options,
|
859 |
-
parserConfig)</code>, where the first argument is a configuration
|
860 |
-
object as passed to the mode constructor function, and the second
|
861 |
-
argument is a mode specification as in
|
862 |
-
the <a href="#option_mode"><code>mode</code></a> option. To copy a
|
863 |
-
state object, call <code>CodeMirror.copyState(mode, state)</code>,
|
864 |
-
where <code>mode</code> is the mode that created the given
|
865 |
-
state.</p>
|
866 |
-
|
867 |
-
<p>To make indentation work properly in a nested parser, it is
|
868 |
-
advisable to give the <code>startState</code> method of modes that
|
869 |
-
are intended to be nested an optional argument that provides the
|
870 |
-
base indentation for the block of code. The JavaScript and CSS
|
871 |
-
parser do this, for example, to allow JavaScript and CSS code
|
872 |
-
inside the mixed-mode HTML mode to be properly indented.</p>
|
873 |
-
|
874 |
-
<p>Finally, it is possible to associate your mode, or a certain
|
875 |
-
configuration of your mode, with
|
876 |
-
a <a href="http://en.wikipedia.org/wiki/MIME">MIME</a> type. For
|
877 |
-
example, the JavaScript mode associates itself
|
878 |
-
with <code>text/javascript</code>, and its JSON variant
|
879 |
-
with <code>application/json</code>. To do this,
|
880 |
-
call <code>CodeMirror.defineMIME(mime, modeSpec)</code>,
|
881 |
-
where <code>modeSpec</code> can be a string or object specifying a
|
882 |
-
mode, as in the <a href="#option_mode"><code>mode</code></a>
|
883 |
-
option.</p>
|
884 |
-
|
885 |
-
</div><div class="rightsmall blk">
|
886 |
-
|
887 |
-
<h2>Contents</h2>
|
888 |
-
|
889 |
-
<ul>
|
890 |
-
<li><a href="#overview">Overview</a></li>
|
891 |
-
<li><a href="#usage">Basic Usage</a></li>
|
892 |
-
<li><a href="#config">Configuration</a></li>
|
893 |
-
<li><a href="#styling">Customized Styling</a></li>
|
894 |
-
<li><a href="#api">Programming API</a></li>
|
895 |
-
<li><a href="#modeapi">Writing CodeMirror Modes</a></li>
|
896 |
-
</ul>
|
897 |
-
|
898 |
-
</div></div>
|
899 |
-
|
900 |
-
<div style="height: 2em"> </div>
|
901 |
-
|
902 |
-
</body>
|
903 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clike/clike.js
DELETED
@@ -1,247 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
2 |
-
var indentUnit = config.indentUnit,
|
3 |
-
keywords = parserConfig.keywords || {},
|
4 |
-
blockKeywords = parserConfig.blockKeywords || {},
|
5 |
-
atoms = parserConfig.atoms || {},
|
6 |
-
hooks = parserConfig.hooks || {},
|
7 |
-
multiLineStrings = parserConfig.multiLineStrings;
|
8 |
-
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
9 |
-
|
10 |
-
var curPunc;
|
11 |
-
|
12 |
-
function tokenBase(stream, state) {
|
13 |
-
var ch = stream.next();
|
14 |
-
if (hooks[ch]) {
|
15 |
-
var result = hooks[ch](stream, state);
|
16 |
-
if (result !== false) return result;
|
17 |
-
}
|
18 |
-
if (ch == '"' || ch == "'") {
|
19 |
-
state.tokenize = tokenString(ch);
|
20 |
-
return state.tokenize(stream, state);
|
21 |
-
}
|
22 |
-
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
23 |
-
curPunc = ch;
|
24 |
-
return null
|
25 |
-
}
|
26 |
-
if (/\d/.test(ch)) {
|
27 |
-
stream.eatWhile(/[\w\.]/);
|
28 |
-
return "number";
|
29 |
-
}
|
30 |
-
if (ch == "/") {
|
31 |
-
if (stream.eat("*")) {
|
32 |
-
state.tokenize = tokenComment;
|
33 |
-
return tokenComment(stream, state);
|
34 |
-
}
|
35 |
-
if (stream.eat("/")) {
|
36 |
-
stream.skipToEnd();
|
37 |
-
return "comment";
|
38 |
-
}
|
39 |
-
}
|
40 |
-
if (isOperatorChar.test(ch)) {
|
41 |
-
stream.eatWhile(isOperatorChar);
|
42 |
-
return "operator";
|
43 |
-
}
|
44 |
-
stream.eatWhile(/[\w\$_]/);
|
45 |
-
var cur = stream.current();
|
46 |
-
if (keywords.propertyIsEnumerable(cur)) {
|
47 |
-
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
48 |
-
return "keyword";
|
49 |
-
}
|
50 |
-
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
51 |
-
return "word";
|
52 |
-
}
|
53 |
-
|
54 |
-
function tokenString(quote) {
|
55 |
-
return function(stream, state) {
|
56 |
-
var escaped = false, next, end = false;
|
57 |
-
while ((next = stream.next()) != null) {
|
58 |
-
if (next == quote && !escaped) {end = true; break;}
|
59 |
-
escaped = !escaped && next == "\\";
|
60 |
-
}
|
61 |
-
if (end || !(escaped || multiLineStrings))
|
62 |
-
state.tokenize = tokenBase;
|
63 |
-
return "string";
|
64 |
-
};
|
65 |
-
}
|
66 |
-
|
67 |
-
function tokenComment(stream, state) {
|
68 |
-
var maybeEnd = false, ch;
|
69 |
-
while (ch = stream.next()) {
|
70 |
-
if (ch == "/" && maybeEnd) {
|
71 |
-
state.tokenize = tokenBase;
|
72 |
-
break;
|
73 |
-
}
|
74 |
-
maybeEnd = (ch == "*");
|
75 |
-
}
|
76 |
-
return "comment";
|
77 |
-
}
|
78 |
-
|
79 |
-
function Context(indented, column, type, align, prev) {
|
80 |
-
this.indented = indented;
|
81 |
-
this.column = column;
|
82 |
-
this.type = type;
|
83 |
-
this.align = align;
|
84 |
-
this.prev = prev;
|
85 |
-
}
|
86 |
-
function pushContext(state, col, type) {
|
87 |
-
return state.context = new Context(state.indented, col, type, null, state.context);
|
88 |
-
}
|
89 |
-
function popContext(state) {
|
90 |
-
var t = state.context.type;
|
91 |
-
if (t == ")" || t == "]" || t == "}")
|
92 |
-
state.indented = state.context.indented;
|
93 |
-
return state.context = state.context.prev;
|
94 |
-
}
|
95 |
-
|
96 |
-
// Interface
|
97 |
-
|
98 |
-
return {
|
99 |
-
startState: function(basecolumn) {
|
100 |
-
return {
|
101 |
-
tokenize: null,
|
102 |
-
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
103 |
-
indented: 0,
|
104 |
-
startOfLine: true
|
105 |
-
};
|
106 |
-
},
|
107 |
-
|
108 |
-
token: function(stream, state) {
|
109 |
-
var ctx = state.context;
|
110 |
-
if (stream.sol()) {
|
111 |
-
if (ctx.align == null) ctx.align = false;
|
112 |
-
state.indented = stream.indentation();
|
113 |
-
state.startOfLine = true;
|
114 |
-
}
|
115 |
-
if (stream.eatSpace()) return null;
|
116 |
-
curPunc = null;
|
117 |
-
var style = (state.tokenize || tokenBase)(stream, state);
|
118 |
-
if (style == "comment" || style == "meta") return style;
|
119 |
-
if (ctx.align == null) ctx.align = true;
|
120 |
-
|
121 |
-
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
122 |
-
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
123 |
-
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
124 |
-
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
125 |
-
else if (curPunc == "}") {
|
126 |
-
while (ctx.type == "statement") ctx = popContext(state);
|
127 |
-
if (ctx.type == "}") ctx = popContext(state);
|
128 |
-
while (ctx.type == "statement") ctx = popContext(state);
|
129 |
-
}
|
130 |
-
else if (curPunc == ctx.type) popContext(state);
|
131 |
-
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
132 |
-
pushContext(state, stream.column(), "statement");
|
133 |
-
state.startOfLine = false;
|
134 |
-
return style;
|
135 |
-
},
|
136 |
-
|
137 |
-
indent: function(state, textAfter) {
|
138 |
-
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
139 |
-
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
|
140 |
-
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
|
141 |
-
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
142 |
-
else return ctx.indented + (closing ? 0 : indentUnit);
|
143 |
-
},
|
144 |
-
|
145 |
-
electricChars: "{}"
|
146 |
-
};
|
147 |
-
});
|
148 |
-
|
149 |
-
(function() {
|
150 |
-
function words(str) {
|
151 |
-
var obj = {}, words = str.split(" ");
|
152 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
153 |
-
return obj;
|
154 |
-
}
|
155 |
-
var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
|
156 |
-
"double static else struct entry switch extern typedef float union for unsigned " +
|
157 |
-
"goto while enum void const signed volatile";
|
158 |
-
|
159 |
-
function cppHook(stream, state) {
|
160 |
-
if (!state.startOfLine) return false;
|
161 |
-
stream.skipToEnd();
|
162 |
-
return "meta";
|
163 |
-
}
|
164 |
-
|
165 |
-
// C#-style strings where "" escapes a quote.
|
166 |
-
function tokenAtString(stream, state) {
|
167 |
-
var next;
|
168 |
-
while ((next = stream.next()) != null) {
|
169 |
-
if (next == '"' && !stream.eat('"')) {
|
170 |
-
state.tokenize = null;
|
171 |
-
break;
|
172 |
-
}
|
173 |
-
}
|
174 |
-
return "string";
|
175 |
-
}
|
176 |
-
|
177 |
-
CodeMirror.defineMIME("text/x-csrc", {
|
178 |
-
name: "clike",
|
179 |
-
keywords: words(cKeywords),
|
180 |
-
blockKeywords: words("case do else for if switch while struct"),
|
181 |
-
atoms: words("null"),
|
182 |
-
hooks: {"#": cppHook}
|
183 |
-
});
|
184 |
-
CodeMirror.defineMIME("text/x-c++src", {
|
185 |
-
name: "clike",
|
186 |
-
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
187 |
-
"static_cast typeid catch operator template typename class friend private " +
|
188 |
-
"this using const_cast inline public throw virtual delete mutable protected " +
|
189 |
-
"wchar_t"),
|
190 |
-
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
191 |
-
atoms: words("true false null"),
|
192 |
-
hooks: {"#": cppHook}
|
193 |
-
});
|
194 |
-
CodeMirror.defineMIME("text/x-java", {
|
195 |
-
name: "clike",
|
196 |
-
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
197 |
-
"do double else enum extends final finally float for goto if implements import " +
|
198 |
-
"instanceof int interface long native new package private protected public " +
|
199 |
-
"return short static strictfp super switch synchronized this throw throws transient " +
|
200 |
-
"try void volatile while"),
|
201 |
-
blockKeywords: words("catch class do else finally for if switch try while"),
|
202 |
-
atoms: words("true false null"),
|
203 |
-
hooks: {
|
204 |
-
"@": function(stream, state) {
|
205 |
-
stream.eatWhile(/[\w\$_]/);
|
206 |
-
return "meta";
|
207 |
-
}
|
208 |
-
}
|
209 |
-
});
|
210 |
-
CodeMirror.defineMIME("text/x-csharp", {
|
211 |
-
name: "clike",
|
212 |
-
keywords: words("abstract as base bool break byte case catch char checked class const continue decimal" +
|
213 |
-
" default delegate do double else enum event explicit extern finally fixed float for" +
|
214 |
-
" foreach goto if implicit in int interface internal is lock long namespace new object" +
|
215 |
-
" operator out override params private protected public readonly ref return sbyte sealed short" +
|
216 |
-
" sizeof stackalloc static string struct switch this throw try typeof uint ulong unchecked" +
|
217 |
-
" unsafe ushort using virtual void volatile while add alias ascending descending dynamic from get" +
|
218 |
-
" global group into join let orderby partial remove select set value var yield"),
|
219 |
-
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
220 |
-
atoms: words("true false null"),
|
221 |
-
hooks: {
|
222 |
-
"@": function(stream, state) {
|
223 |
-
if (stream.eat('"')) {
|
224 |
-
state.tokenize = tokenAtString;
|
225 |
-
return tokenAtString(stream, state);
|
226 |
-
}
|
227 |
-
stream.eatWhile(/[\w\$_]/);
|
228 |
-
return "meta";
|
229 |
-
}
|
230 |
-
}
|
231 |
-
});
|
232 |
-
CodeMirror.defineMIME("text/x-groovy", {
|
233 |
-
name: "clike",
|
234 |
-
keywords: words("abstract as assert boolean break byte case catch char class const continue def default " +
|
235 |
-
"do double else enum extends final finally float for goto if implements import " +
|
236 |
-
"in instanceof int interface long native new package property private protected public " +
|
237 |
-
"return short static strictfp super switch synchronized this throw throws transient " +
|
238 |
-
"try void volatile while"),
|
239 |
-
atoms: words("true false null"),
|
240 |
-
hooks: {
|
241 |
-
"@": function(stream, state) {
|
242 |
-
stream.eatWhile(/[\w\$_]/);
|
243 |
-
return "meta";
|
244 |
-
}
|
245 |
-
}
|
246 |
-
});
|
247 |
-
}());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clike/index.html
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: C-like mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="clike.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style>.CodeMirror {border: 2px inset #dee;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: C-like mode</h1>
|
14 |
-
|
15 |
-
<form><textarea id="code" name="code">
|
16 |
-
/* C demo code */
|
17 |
-
|
18 |
-
#include <zmq.h>
|
19 |
-
#include <pthread.h>
|
20 |
-
#include <semaphore.h>
|
21 |
-
#include <time.h>
|
22 |
-
#include <stdio.h>
|
23 |
-
#include <fcntl.h>
|
24 |
-
#include <malloc.h>
|
25 |
-
|
26 |
-
typedef struct {
|
27 |
-
void* arg_socket;
|
28 |
-
zmq_msg_t* arg_msg;
|
29 |
-
char* arg_string;
|
30 |
-
unsigned long arg_len;
|
31 |
-
int arg_int, arg_command;
|
32 |
-
|
33 |
-
int signal_fd;
|
34 |
-
int pad;
|
35 |
-
void* context;
|
36 |
-
sem_t sem;
|
37 |
-
} acl_zmq_context;
|
38 |
-
|
39 |
-
#define p(X) (context->arg_##X)
|
40 |
-
|
41 |
-
void* zmq_thread(void* context_pointer) {
|
42 |
-
acl_zmq_context* context = (acl_zmq_context*)context_pointer;
|
43 |
-
char ok = 'K', err = 'X';
|
44 |
-
int res;
|
45 |
-
|
46 |
-
while (1) {
|
47 |
-
while ((res = sem_wait(&context->sem)) == EINTR);
|
48 |
-
if (res) {write(context->signal_fd, &err, 1); goto cleanup;}
|
49 |
-
switch(p(command)) {
|
50 |
-
case 0: goto cleanup;
|
51 |
-
case 1: p(socket) = zmq_socket(context->context, p(int)); break;
|
52 |
-
case 2: p(int) = zmq_close(p(socket)); break;
|
53 |
-
case 3: p(int) = zmq_bind(p(socket), p(string)); break;
|
54 |
-
case 4: p(int) = zmq_connect(p(socket), p(string)); break;
|
55 |
-
case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break;
|
56 |
-
case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
|
57 |
-
case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
|
58 |
-
case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
|
59 |
-
case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
|
60 |
-
}
|
61 |
-
p(command) = errno;
|
62 |
-
write(context->signal_fd, &ok, 1);
|
63 |
-
}
|
64 |
-
cleanup:
|
65 |
-
close(context->signal_fd);
|
66 |
-
free(context_pointer);
|
67 |
-
return 0;
|
68 |
-
}
|
69 |
-
|
70 |
-
void* zmq_thread_init(void* zmq_context, int signal_fd) {
|
71 |
-
acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
|
72 |
-
pthread_t thread;
|
73 |
-
|
74 |
-
context->context = zmq_context;
|
75 |
-
context->signal_fd = signal_fd;
|
76 |
-
sem_init(&context->sem, 1, 0);
|
77 |
-
pthread_create(&thread, 0, &zmq_thread, context);
|
78 |
-
pthread_detach(thread);
|
79 |
-
return context;
|
80 |
-
}
|
81 |
-
</textarea></form>
|
82 |
-
|
83 |
-
<script>
|
84 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
85 |
-
lineNumbers: true,
|
86 |
-
matchBrackets: true,
|
87 |
-
mode: "text/x-csrc"
|
88 |
-
});
|
89 |
-
</script>
|
90 |
-
|
91 |
-
<p>Simple mode that tries to handle C-like languages as well as it
|
92 |
-
can. Takes two configuration parameters: <code>keywords</code>, an
|
93 |
-
object whose property names are the keywords in the language,
|
94 |
-
and <code>useCPP</code>, which determines whether C preprocessor
|
95 |
-
directives are recognized.</p>
|
96 |
-
|
97 |
-
<p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
|
98 |
-
(C code), <code>text/x-c++src</code> (C++
|
99 |
-
code), <code>text/x-java</code> (Java
|
100 |
-
code), <code>text/x-groovy</code> (Groovy code).</p>
|
101 |
-
</body>
|
102 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clojure/clojure.js
DELETED
@@ -1,207 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Author: Hans Engel
|
3 |
-
* Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
|
4 |
-
*/
|
5 |
-
CodeMirror.defineMode("clojure", function (config, mode) {
|
6 |
-
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", TAG = "tag",
|
7 |
-
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
|
8 |
-
var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
|
9 |
-
|
10 |
-
function makeKeywords(str) {
|
11 |
-
var obj = {}, words = str.split(" ");
|
12 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
13 |
-
return obj;
|
14 |
-
}
|
15 |
-
|
16 |
-
var atoms = makeKeywords("true false nil");
|
17 |
-
|
18 |
-
var keywords = makeKeywords(
|
19 |
-
// Control structures
|
20 |
-
"defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle" +
|
21 |
-
|
22 |
-
// Built-ins
|
23 |
-
"* *1 *2 *3 *agent* *allow-unresolved-vars* *assert *clojure-version* *command-line-args* *compile-files* *compile-path* *e *err* *file* *flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *use-context-classloader* *warn-on-reflection* + - / < <= = == > >= accessor aclone agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defstruct delay delay? deliver deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall doc dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq eval even? every? extend extend-protocol extend-type extends? extenders false? ffirst file-seq filter find find-doc find-ns find-var first float float-array float? floats flush fn fn? fnext for force format future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map? mapcat max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod name namespace neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-doc print-dup print-method print-namespace-doc print-simple print-special-doc print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string reify reduce ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure release-pending-sends rem remove remove-method remove-ns repeat repeatedly replace replicate require reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-validator! set? short short-array shorts shutdown-agents slurp some sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-form-anchor special-symbol? split-at split-with str stream? string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test the-ns time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision xml-seq");
|
24 |
-
|
25 |
-
var indentKeys = makeKeywords(
|
26 |
-
// Built-ins
|
27 |
-
"ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch" +
|
28 |
-
|
29 |
-
// Binding forms
|
30 |
-
"let letfn binding loop for doseq dotimes when-let if-let" +
|
31 |
-
|
32 |
-
// Data structures
|
33 |
-
"defstruct struct-map assoc" +
|
34 |
-
|
35 |
-
// clojure.test
|
36 |
-
"testing deftest" +
|
37 |
-
|
38 |
-
// contrib
|
39 |
-
"handler-case handle dotrace deftrace");
|
40 |
-
|
41 |
-
var tests = {
|
42 |
-
digit: /\d/,
|
43 |
-
digit_or_colon: /[\d:]/,
|
44 |
-
hex: /[0-9a-fA-F]/,
|
45 |
-
sign: /[+-]/,
|
46 |
-
exponent: /[eE]/,
|
47 |
-
keyword_char: /[^\s\(\[\;\)\]]/,
|
48 |
-
basic: /[\w\$_\-]/,
|
49 |
-
lang_keyword: /[\w*+!\-_?:\/]/
|
50 |
-
};
|
51 |
-
|
52 |
-
function stateStack(indent, type, prev) { // represents a state stack object
|
53 |
-
this.indent = indent;
|
54 |
-
this.type = type;
|
55 |
-
this.prev = prev;
|
56 |
-
}
|
57 |
-
|
58 |
-
function pushStack(state, indent, type) {
|
59 |
-
state.indentStack = new stateStack(indent, type, state.indentStack);
|
60 |
-
}
|
61 |
-
|
62 |
-
function popStack(state) {
|
63 |
-
state.indentStack = state.indentStack.prev;
|
64 |
-
}
|
65 |
-
|
66 |
-
function isNumber(ch, stream){
|
67 |
-
// hex
|
68 |
-
if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) {
|
69 |
-
stream.eat('x');
|
70 |
-
stream.eatWhile(tests.hex);
|
71 |
-
return true;
|
72 |
-
}
|
73 |
-
|
74 |
-
// leading sign
|
75 |
-
if ( ch == '+' || ch == '-' ) {
|
76 |
-
stream.eat(tests.sign);
|
77 |
-
ch = stream.next();
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( tests.digit.test(ch) ) {
|
81 |
-
stream.eat(ch);
|
82 |
-
stream.eatWhile(tests.digit);
|
83 |
-
|
84 |
-
if ( '.' == stream.peek() ) {
|
85 |
-
stream.eat('.');
|
86 |
-
stream.eatWhile(tests.digit);
|
87 |
-
}
|
88 |
-
|
89 |
-
if ( 'e' == stream.peek().toLowerCase() ) {
|
90 |
-
stream.eat(tests.exponent);
|
91 |
-
stream.eat(tests.sign);
|
92 |
-
stream.eatWhile(tests.digit);
|
93 |
-
}
|
94 |
-
|
95 |
-
return true;
|
96 |
-
}
|
97 |
-
|
98 |
-
return false;
|
99 |
-
}
|
100 |
-
|
101 |
-
return {
|
102 |
-
startState: function () {
|
103 |
-
return {
|
104 |
-
indentStack: null,
|
105 |
-
indentation: 0,
|
106 |
-
mode: false,
|
107 |
-
};
|
108 |
-
},
|
109 |
-
|
110 |
-
token: function (stream, state) {
|
111 |
-
if (state.indentStack == null && stream.sol()) {
|
112 |
-
// update indentation, but only if indentStack is empty
|
113 |
-
state.indentation = stream.indentation();
|
114 |
-
}
|
115 |
-
|
116 |
-
// skip spaces
|
117 |
-
if (stream.eatSpace()) {
|
118 |
-
return null;
|
119 |
-
}
|
120 |
-
var returnType = null;
|
121 |
-
|
122 |
-
switch(state.mode){
|
123 |
-
case "string": // multi-line string parsing mode
|
124 |
-
var next, escaped = false;
|
125 |
-
while ((next = stream.next()) != null) {
|
126 |
-
if (next == "\"" && !escaped) {
|
127 |
-
|
128 |
-
state.mode = false;
|
129 |
-
break;
|
130 |
-
}
|
131 |
-
escaped = !escaped && next == "\\";
|
132 |
-
}
|
133 |
-
returnType = STRING; // continue on in string mode
|
134 |
-
break;
|
135 |
-
default: // default parsing mode
|
136 |
-
var ch = stream.next();
|
137 |
-
|
138 |
-
if (ch == "\"") {
|
139 |
-
state.mode = "string";
|
140 |
-
returnType = STRING;
|
141 |
-
} else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
|
142 |
-
returnType = ATOM;
|
143 |
-
} else if (ch == ";") { // comment
|
144 |
-
stream.skipToEnd(); // rest of the line is a comment
|
145 |
-
returnType = COMMENT;
|
146 |
-
} else if (isNumber(ch,stream)){
|
147 |
-
returnType = NUMBER;
|
148 |
-
} else if (ch == "(" || ch == "[") {
|
149 |
-
var keyWord = ''; var indentTemp = stream.column();
|
150 |
-
/**
|
151 |
-
Either
|
152 |
-
(indent-word ..
|
153 |
-
(non-indent-word ..
|
154 |
-
(;something else, bracket, etc.
|
155 |
-
*/
|
156 |
-
|
157 |
-
while ((letter = stream.eat(tests.keyword_char)) != null) {
|
158 |
-
keyWord += letter;
|
159 |
-
}
|
160 |
-
|
161 |
-
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
|
162 |
-
|
163 |
-
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
164 |
-
} else { // non-indent word
|
165 |
-
// we continue eating the spaces
|
166 |
-
stream.eatSpace();
|
167 |
-
if (stream.eol() || stream.peek() == ";") {
|
168 |
-
// nothing significant after
|
169 |
-
// we restart indentation 1 space after
|
170 |
-
pushStack(state, indentTemp + 1, ch);
|
171 |
-
} else {
|
172 |
-
pushStack(state, indentTemp + stream.current().length, ch); // else we match
|
173 |
-
}
|
174 |
-
}
|
175 |
-
stream.backUp(stream.current().length - 1); // undo all the eating
|
176 |
-
|
177 |
-
returnType = BRACKET;
|
178 |
-
} else if (ch == ")" || ch == "]") {
|
179 |
-
returnType = BRACKET;
|
180 |
-
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
181 |
-
popStack(state);
|
182 |
-
}
|
183 |
-
} else if ( ch == ":" ) {
|
184 |
-
stream.eatWhile(tests.lang_keyword);
|
185 |
-
return TAG;
|
186 |
-
} else {
|
187 |
-
stream.eatWhile(tests.basic);
|
188 |
-
|
189 |
-
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
|
190 |
-
returnType = BUILTIN;
|
191 |
-
} else if ( atoms && atoms.propertyIsEnumerable(stream.current()) ) {
|
192 |
-
returnType = ATOM;
|
193 |
-
} else returnType = null;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
return returnType;
|
198 |
-
},
|
199 |
-
|
200 |
-
indent: function (state, textAfter) {
|
201 |
-
if (state.indentStack == null) return state.indentation;
|
202 |
-
return state.indentStack.indent;
|
203 |
-
}
|
204 |
-
};
|
205 |
-
});
|
206 |
-
|
207 |
-
CodeMirror.defineMIME("text/x-clojure", "clojure");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/clojure/index.html
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Clojure mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="clojure.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>.CodeMirror {background: #f8f8f8;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Clojure mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
; Conway's Game of Life, based on the work of:
|
16 |
-
;; Laurent Petit https://gist.github.com/1200343
|
17 |
-
;; Christophe Grand http://clj-me.cgrand.net/2011/08/19/conways-game-of-life
|
18 |
-
|
19 |
-
(ns ^{:doc "Conway's Game of Life."}
|
20 |
-
game-of-life)
|
21 |
-
|
22 |
-
;; Core game of life's algorithm functions
|
23 |
-
|
24 |
-
(defn neighbours
|
25 |
-
"Given a cell's coordinates, returns the coordinates of its neighbours."
|
26 |
-
[[x y]]
|
27 |
-
(for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])]
|
28 |
-
[(+ dx x) (+ dy y)]))
|
29 |
-
|
30 |
-
(defn step
|
31 |
-
"Given a set of living cells, computes the new set of living cells."
|
32 |
-
[cells]
|
33 |
-
(set (for [[cell n] (frequencies (mapcat neighbours cells))
|
34 |
-
:when (or (= n 3) (and (= n 2) (cells cell)))]
|
35 |
-
cell)))
|
36 |
-
|
37 |
-
;; Utility methods for displaying game on a text terminal
|
38 |
-
|
39 |
-
(defn print-board
|
40 |
-
"Prints a board on *out*, representing a step in the game."
|
41 |
-
[board w h]
|
42 |
-
(doseq [x (range (inc w)) y (range (inc h))]
|
43 |
-
(if (= y 0) (print "\n"))
|
44 |
-
(print (if (board [x y]) "[X]" " . "))))
|
45 |
-
|
46 |
-
(defn display-grids
|
47 |
-
"Prints a squence of boards on *out*, representing several steps."
|
48 |
-
[grids w h]
|
49 |
-
(doseq [board grids]
|
50 |
-
(print-board board w h)
|
51 |
-
(print "\n")))
|
52 |
-
|
53 |
-
;; Launches an example board
|
54 |
-
|
55 |
-
(def
|
56 |
-
^{:doc "board represents the initial set of living cells"}
|
57 |
-
board #{[2 1] [2 2] [2 3]})
|
58 |
-
|
59 |
-
(display-grids (take 3 (iterate step board)) 5 5) </textarea></form>
|
60 |
-
<script>
|
61 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
62 |
-
</script>
|
63 |
-
|
64 |
-
<p><strong>MIME types defined:</strong> <code>text/x-clojure</code>.</p>
|
65 |
-
|
66 |
-
</body>
|
67 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/coffeescript/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
The MIT License
|
2 |
-
|
3 |
-
Copyright (c) 2011 Jeff Pickhardt
|
4 |
-
Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
|
5 |
-
|
6 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
-
of this software and associated documentation files (the "Software"), to deal
|
8 |
-
in the Software without restriction, including without limitation the rights
|
9 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
-
copies of the Software, and to permit persons to whom the Software is
|
11 |
-
furnished to do so, subject to the following conditions:
|
12 |
-
|
13 |
-
The above copyright notice and this permission notice shall be included in
|
14 |
-
all copies or substantial portions of the Software.
|
15 |
-
|
16 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/coffeescript/coffeescript.js
DELETED
@@ -1,325 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Link to the project's GitHub page:
|
3 |
-
* https://github.com/pickhardt/coffeescript-codemirror-mode
|
4 |
-
*/
|
5 |
-
CodeMirror.defineMode('coffeescript', function(conf) {
|
6 |
-
var ERRORCLASS = 'error';
|
7 |
-
|
8 |
-
function wordRegexp(words) {
|
9 |
-
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
10 |
-
}
|
11 |
-
|
12 |
-
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]");
|
13 |
-
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
|
14 |
-
var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))");
|
15 |
-
var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
|
16 |
-
var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))");
|
17 |
-
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
|
18 |
-
|
19 |
-
var wordOperators = wordRegexp(['and', 'or', 'not',
|
20 |
-
'is', 'isnt', 'in',
|
21 |
-
'instanceof', 'typeof']);
|
22 |
-
var indentKeywords = ['for', 'while', 'loop', 'if', 'unless', 'else',
|
23 |
-
'switch', 'try', 'catch', 'finally', 'class'];
|
24 |
-
var commonKeywords = ['break', 'by', 'continue', 'debugger', 'delete',
|
25 |
-
'do', 'in', 'of', 'new', 'return', 'then',
|
26 |
-
'this', 'throw', 'when', 'until'];
|
27 |
-
|
28 |
-
var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
|
29 |
-
|
30 |
-
indentKeywords = wordRegexp(indentKeywords);
|
31 |
-
|
32 |
-
|
33 |
-
var stringPrefixes = new RegExp("^('{3}|\"{3}|['\"])");
|
34 |
-
var regexPrefixes = new RegExp("^(/{3}|/)");
|
35 |
-
var commonConstants = ['Infinity', 'NaN', 'undefined', 'null', 'true', 'false', 'on', 'off', 'yes', 'no'];
|
36 |
-
var constants = wordRegexp(commonConstants);
|
37 |
-
|
38 |
-
// Tokenizers
|
39 |
-
function tokenBase(stream, state) {
|
40 |
-
// Handle scope changes
|
41 |
-
if (stream.sol()) {
|
42 |
-
var scopeOffset = state.scopes[0].offset;
|
43 |
-
if (stream.eatSpace()) {
|
44 |
-
var lineOffset = stream.indentation();
|
45 |
-
if (lineOffset > scopeOffset) {
|
46 |
-
return 'indent';
|
47 |
-
} else if (lineOffset < scopeOffset) {
|
48 |
-
return 'dedent';
|
49 |
-
}
|
50 |
-
return null;
|
51 |
-
} else {
|
52 |
-
if (scopeOffset > 0) {
|
53 |
-
dedent(stream, state);
|
54 |
-
}
|
55 |
-
}
|
56 |
-
}
|
57 |
-
if (stream.eatSpace()) {
|
58 |
-
return null;
|
59 |
-
}
|
60 |
-
|
61 |
-
var ch = stream.peek();
|
62 |
-
|
63 |
-
// Handle comments
|
64 |
-
if (ch === '#') {
|
65 |
-
stream.skipToEnd();
|
66 |
-
return 'comment';
|
67 |
-
}
|
68 |
-
|
69 |
-
// Handle number literals
|
70 |
-
if (stream.match(/^-?[0-9\.]/, false)) {
|
71 |
-
var floatLiteral = false;
|
72 |
-
// Floats
|
73 |
-
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
|
74 |
-
floatLiteral = true;
|
75 |
-
}
|
76 |
-
if (stream.match(/^-?\d+\.\d*/)) {
|
77 |
-
floatLiteral = true;
|
78 |
-
}
|
79 |
-
if (stream.match(/^-?\.\d+/)) {
|
80 |
-
floatLiteral = true;
|
81 |
-
}
|
82 |
-
if (floatLiteral) {
|
83 |
-
return 'number';
|
84 |
-
}
|
85 |
-
// Integers
|
86 |
-
var intLiteral = false;
|
87 |
-
// Hex
|
88 |
-
if (stream.match(/^-?0x[0-9a-f]+/i)) {
|
89 |
-
intLiteral = true;
|
90 |
-
}
|
91 |
-
// Decimal
|
92 |
-
if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
|
93 |
-
intLiteral = true;
|
94 |
-
}
|
95 |
-
// Zero by itself with no other piece of number.
|
96 |
-
if (stream.match(/^-?0(?![\dx])/i)) {
|
97 |
-
intLiteral = true;
|
98 |
-
}
|
99 |
-
if (intLiteral) {
|
100 |
-
return 'number';
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
// Handle strings
|
105 |
-
if (stream.match(stringPrefixes)) {
|
106 |
-
state.tokenize = tokenFactory(stream.current(), 'string');
|
107 |
-
return state.tokenize(stream, state);
|
108 |
-
}
|
109 |
-
// Handle regex literals
|
110 |
-
if (stream.match(regexPrefixes)) {
|
111 |
-
if (stream.current() != '/' || stream.match(/^.*\//, false)) { // prevent highlight of division
|
112 |
-
state.tokenize = tokenFactory(stream.current(), 'string-2');
|
113 |
-
return state.tokenize(stream, state);
|
114 |
-
} else {
|
115 |
-
stream.backUp(1);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
// Handle operators and delimiters
|
120 |
-
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
|
121 |
-
return 'punctuation';
|
122 |
-
}
|
123 |
-
if (stream.match(doubleOperators)
|
124 |
-
|| stream.match(singleOperators)
|
125 |
-
|| stream.match(wordOperators)) {
|
126 |
-
return 'operator';
|
127 |
-
}
|
128 |
-
if (stream.match(singleDelimiters)) {
|
129 |
-
return 'punctuation';
|
130 |
-
}
|
131 |
-
|
132 |
-
if (stream.match(constants)) {
|
133 |
-
return 'atom';
|
134 |
-
}
|
135 |
-
|
136 |
-
if (stream.match(keywords)) {
|
137 |
-
return 'keyword';
|
138 |
-
}
|
139 |
-
|
140 |
-
if (stream.match(identifiers)) {
|
141 |
-
return 'variable';
|
142 |
-
}
|
143 |
-
|
144 |
-
// Handle non-detected items
|
145 |
-
stream.next();
|
146 |
-
return ERRORCLASS;
|
147 |
-
}
|
148 |
-
|
149 |
-
function tokenFactory(delimiter, outclass) {
|
150 |
-
var delim_re = new RegExp(delimiter);
|
151 |
-
var singleline = delimiter.length == 1;
|
152 |
-
|
153 |
-
return function tokenString(stream, state) {
|
154 |
-
while (!stream.eol()) {
|
155 |
-
stream.eatWhile(/[^'"\/\\]/);
|
156 |
-
if (stream.eat('\\')) {
|
157 |
-
stream.next();
|
158 |
-
if (singleline && stream.eol()) {
|
159 |
-
return outclass;
|
160 |
-
}
|
161 |
-
} else if (stream.match(delim_re)) {
|
162 |
-
state.tokenize = tokenBase;
|
163 |
-
return outclass;
|
164 |
-
} else {
|
165 |
-
stream.eat(/['"\/]/);
|
166 |
-
}
|
167 |
-
}
|
168 |
-
if (singleline) {
|
169 |
-
if (conf.mode.singleLineStringErrors) {
|
170 |
-
outclass = ERRORCLASS
|
171 |
-
} else {
|
172 |
-
state.tokenize = tokenBase;
|
173 |
-
}
|
174 |
-
}
|
175 |
-
return outclass;
|
176 |
-
};
|
177 |
-
}
|
178 |
-
|
179 |
-
function indent(stream, state, type) {
|
180 |
-
type = type || 'coffee';
|
181 |
-
var indentUnit = 0;
|
182 |
-
if (type === 'coffee') {
|
183 |
-
for (var i = 0; i < state.scopes.length; i++) {
|
184 |
-
if (state.scopes[i].type === 'coffee') {
|
185 |
-
indentUnit = state.scopes[i].offset + conf.indentUnit;
|
186 |
-
break;
|
187 |
-
}
|
188 |
-
}
|
189 |
-
} else {
|
190 |
-
indentUnit = stream.column() + stream.current().length;
|
191 |
-
}
|
192 |
-
state.scopes.unshift({
|
193 |
-
offset: indentUnit,
|
194 |
-
type: type
|
195 |
-
});
|
196 |
-
}
|
197 |
-
|
198 |
-
function dedent(stream, state) {
|
199 |
-
if (state.scopes.length == 1) return;
|
200 |
-
if (state.scopes[0].type === 'coffee') {
|
201 |
-
var _indent = stream.indentation();
|
202 |
-
var _indent_index = -1;
|
203 |
-
for (var i = 0; i < state.scopes.length; ++i) {
|
204 |
-
if (_indent === state.scopes[i].offset) {
|
205 |
-
_indent_index = i;
|
206 |
-
break;
|
207 |
-
}
|
208 |
-
}
|
209 |
-
if (_indent_index === -1) {
|
210 |
-
return true;
|
211 |
-
}
|
212 |
-
while (state.scopes[0].offset !== _indent) {
|
213 |
-
state.scopes.shift();
|
214 |
-
}
|
215 |
-
return false
|
216 |
-
} else {
|
217 |
-
state.scopes.shift();
|
218 |
-
return false;
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
function tokenLexer(stream, state) {
|
223 |
-
var style = state.tokenize(stream, state);
|
224 |
-
var current = stream.current();
|
225 |
-
|
226 |
-
// Handle '.' connected identifiers
|
227 |
-
if (current === '.') {
|
228 |
-
style = state.tokenize(stream, state);
|
229 |
-
current = stream.current();
|
230 |
-
if (style === 'variable') {
|
231 |
-
return 'variable';
|
232 |
-
} else {
|
233 |
-
return ERRORCLASS;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
// Handle properties
|
238 |
-
if (current === '@') {
|
239 |
-
style = state.tokenize(stream, state);
|
240 |
-
current = stream.current();
|
241 |
-
if (style === 'variable') {
|
242 |
-
return 'variable-2';
|
243 |
-
} else {
|
244 |
-
return ERRORCLASS;
|
245 |
-
}
|
246 |
-
}
|
247 |
-
|
248 |
-
// Handle scope changes.
|
249 |
-
if (current === 'return') {
|
250 |
-
state.dedent += 1;
|
251 |
-
}
|
252 |
-
if (((current === '->' || current === '=>') &&
|
253 |
-
!state.lambda &&
|
254 |
-
state.scopes[0].type == 'coffee' &&
|
255 |
-
stream.peek() === '')
|
256 |
-
|| style === 'indent') {
|
257 |
-
indent(stream, state);
|
258 |
-
}
|
259 |
-
var delimiter_index = '[({'.indexOf(current);
|
260 |
-
if (delimiter_index !== -1) {
|
261 |
-
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
|
262 |
-
}
|
263 |
-
if (indentKeywords.exec(current)){
|
264 |
-
indent(stream, state);
|
265 |
-
}
|
266 |
-
if (current == 'then'){
|
267 |
-
dedent(stream, state);
|
268 |
-
}
|
269 |
-
|
270 |
-
|
271 |
-
if (style === 'dedent') {
|
272 |
-
if (dedent(stream, state)) {
|
273 |
-
return ERRORCLASS;
|
274 |
-
}
|
275 |
-
}
|
276 |
-
delimiter_index = '])}'.indexOf(current);
|
277 |
-
if (delimiter_index !== -1) {
|
278 |
-
if (dedent(stream, state)) {
|
279 |
-
return ERRORCLASS;
|
280 |
-
}
|
281 |
-
}
|
282 |
-
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') {
|
283 |
-
if (state.scopes.length > 1) state.scopes.shift();
|
284 |
-
state.dedent -= 1;
|
285 |
-
}
|
286 |
-
|
287 |
-
return style;
|
288 |
-
}
|
289 |
-
|
290 |
-
var external = {
|
291 |
-
startState: function(basecolumn) {
|
292 |
-
return {
|
293 |
-
tokenize: tokenBase,
|
294 |
-
scopes: [{offset:basecolumn || 0, type:'coffee'}],
|
295 |
-
lastToken: null,
|
296 |
-
lambda: false,
|
297 |
-
dedent: 0
|
298 |
-
};
|
299 |
-
},
|
300 |
-
|
301 |
-
token: function(stream, state) {
|
302 |
-
var style = tokenLexer(stream, state);
|
303 |
-
|
304 |
-
state.lastToken = {style:style, content: stream.current()};
|
305 |
-
|
306 |
-
if (stream.eol() && stream.lambda) {
|
307 |
-
state.lambda = false;
|
308 |
-
}
|
309 |
-
|
310 |
-
return style;
|
311 |
-
},
|
312 |
-
|
313 |
-
indent: function(state, textAfter) {
|
314 |
-
if (state.tokenize != tokenBase) {
|
315 |
-
return 0;
|
316 |
-
}
|
317 |
-
|
318 |
-
return state.scopes[0].offset;
|
319 |
-
}
|
320 |
-
|
321 |
-
};
|
322 |
-
return external;
|
323 |
-
});
|
324 |
-
|
325 |
-
CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/coffeescript/index.html
DELETED
@@ -1,722 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: CoffeeScript mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="coffeescript.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>.CodeMirror {border-top: 1px solid silver; border-bottom: 1px solid silver;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: CoffeeScript mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
# CoffeeScript mode for CodeMirror
|
16 |
-
# Copyright (c) 2011 Jeff Pickhardt, released under
|
17 |
-
# the MIT License.
|
18 |
-
#
|
19 |
-
# Modified from the Python CodeMirror mode, which also is
|
20 |
-
# under the MIT License Copyright (c) 2010 Timothy Farrell.
|
21 |
-
#
|
22 |
-
# The following script, Underscore.coffee, is used to
|
23 |
-
# demonstrate CoffeeScript mode for CodeMirror.
|
24 |
-
#
|
25 |
-
# To download CoffeeScript mode for CodeMirror, go to:
|
26 |
-
# https://github.com/pickhardt/coffeescript-codemirror-mode
|
27 |
-
|
28 |
-
# **Underscore.coffee
|
29 |
-
# (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.**
|
30 |
-
# Underscore is freely distributable under the terms of the
|
31 |
-
# [MIT license](http://en.wikipedia.org/wiki/MIT_License).
|
32 |
-
# Portions of Underscore are inspired by or borrowed from
|
33 |
-
# [Prototype.js](http://prototypejs.org/api), Oliver Steele's
|
34 |
-
# [Functional](http://osteele.com), and John Resig's
|
35 |
-
# [Micro-Templating](http://ejohn.org).
|
36 |
-
# For all details and documentation:
|
37 |
-
# http://documentcloud.github.com/underscore/
|
38 |
-
|
39 |
-
|
40 |
-
# Baseline setup
|
41 |
-
# --------------
|
42 |
-
|
43 |
-
# Establish the root object, `window` in the browser, or `global` on the server.
|
44 |
-
root = this
|
45 |
-
|
46 |
-
|
47 |
-
# Save the previous value of the `_` variable.
|
48 |
-
previousUnderscore = root._
|
49 |
-
|
50 |
-
|
51 |
-
# Establish the object that gets thrown to break out of a loop iteration.
|
52 |
-
# `StopIteration` is SOP on Mozilla.
|
53 |
-
breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
|
54 |
-
|
55 |
-
|
56 |
-
# Helper function to escape **RegExp** contents, because JS doesn't have one.
|
57 |
-
escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
|
58 |
-
|
59 |
-
|
60 |
-
# Save bytes in the minified (but not gzipped) version:
|
61 |
-
ArrayProto = Array.prototype
|
62 |
-
ObjProto = Object.prototype
|
63 |
-
|
64 |
-
|
65 |
-
# Create quick reference variables for speed access to core prototypes.
|
66 |
-
slice = ArrayProto.slice
|
67 |
-
unshift = ArrayProto.unshift
|
68 |
-
toString = ObjProto.toString
|
69 |
-
hasOwnProperty = ObjProto.hasOwnProperty
|
70 |
-
propertyIsEnumerable = ObjProto.propertyIsEnumerable
|
71 |
-
|
72 |
-
|
73 |
-
# All **ECMA5** native implementations we hope to use are declared here.
|
74 |
-
nativeForEach = ArrayProto.forEach
|
75 |
-
nativeMap = ArrayProto.map
|
76 |
-
nativeReduce = ArrayProto.reduce
|
77 |
-
nativeReduceRight = ArrayProto.reduceRight
|
78 |
-
nativeFilter = ArrayProto.filter
|
79 |
-
nativeEvery = ArrayProto.every
|
80 |
-
nativeSome = ArrayProto.some
|
81 |
-
nativeIndexOf = ArrayProto.indexOf
|
82 |
-
nativeLastIndexOf = ArrayProto.lastIndexOf
|
83 |
-
nativeIsArray = Array.isArray
|
84 |
-
nativeKeys = Object.keys
|
85 |
-
|
86 |
-
|
87 |
-
# Create a safe reference to the Underscore object for use below.
|
88 |
-
_ = (obj) -> new wrapper(obj)
|
89 |
-
|
90 |
-
|
91 |
-
# Export the Underscore object for **CommonJS**.
|
92 |
-
if typeof(exports) != 'undefined' then exports._ = _
|
93 |
-
|
94 |
-
|
95 |
-
# Export Underscore to global scope.
|
96 |
-
root._ = _
|
97 |
-
|
98 |
-
|
99 |
-
# Current version.
|
100 |
-
_.VERSION = '1.1.0'
|
101 |
-
|
102 |
-
|
103 |
-
# Collection Functions
|
104 |
-
# --------------------
|
105 |
-
|
106 |
-
# The cornerstone, an **each** implementation.
|
107 |
-
# Handles objects implementing **forEach**, arrays, and raw objects.
|
108 |
-
_.each = (obj, iterator, context) ->
|
109 |
-
try
|
110 |
-
if nativeForEach and obj.forEach is nativeForEach
|
111 |
-
obj.forEach iterator, context
|
112 |
-
else if _.isNumber obj.length
|
113 |
-
iterator.call context, obj[i], i, obj for i in [0...obj.length]
|
114 |
-
else
|
115 |
-
iterator.call context, val, key, obj for own key, val of obj
|
116 |
-
catch e
|
117 |
-
throw e if e isnt breaker
|
118 |
-
obj
|
119 |
-
|
120 |
-
|
121 |
-
# Return the results of applying the iterator to each element. Use JavaScript
|
122 |
-
# 1.6's version of **map**, if possible.
|
123 |
-
_.map = (obj, iterator, context) ->
|
124 |
-
return obj.map(iterator, context) if nativeMap and obj.map is nativeMap
|
125 |
-
results = []
|
126 |
-
_.each obj, (value, index, list) ->
|
127 |
-
results.push iterator.call context, value, index, list
|
128 |
-
results
|
129 |
-
|
130 |
-
|
131 |
-
# **Reduce** builds up a single result from a list of values. Also known as
|
132 |
-
# **inject**, or **foldl**. Uses JavaScript 1.8's version of **reduce**, if possible.
|
133 |
-
_.reduce = (obj, iterator, memo, context) ->
|
134 |
-
if nativeReduce and obj.reduce is nativeReduce
|
135 |
-
iterator = _.bind iterator, context if context
|
136 |
-
return obj.reduce iterator, memo
|
137 |
-
_.each obj, (value, index, list) ->
|
138 |
-
memo = iterator.call context, memo, value, index, list
|
139 |
-
memo
|
140 |
-
|
141 |
-
|
142 |
-
# The right-associative version of **reduce**, also known as **foldr**. Uses
|
143 |
-
# JavaScript 1.8's version of **reduceRight**, if available.
|
144 |
-
_.reduceRight = (obj, iterator, memo, context) ->
|
145 |
-
if nativeReduceRight and obj.reduceRight is nativeReduceRight
|
146 |
-
iterator = _.bind iterator, context if context
|
147 |
-
return obj.reduceRight iterator, memo
|
148 |
-
reversed = _.clone(_.toArray(obj)).reverse()
|
149 |
-
_.reduce reversed, iterator, memo, context
|
150 |
-
|
151 |
-
|
152 |
-
# Return the first value which passes a truth test.
|
153 |
-
_.detect = (obj, iterator, context) ->
|
154 |
-
result = null
|
155 |
-
_.each obj, (value, index, list) ->
|
156 |
-
if iterator.call context, value, index, list
|
157 |
-
result = value
|
158 |
-
_.breakLoop()
|
159 |
-
result
|
160 |
-
|
161 |
-
|
162 |
-
# Return all the elements that pass a truth test. Use JavaScript 1.6's
|
163 |
-
# **filter**, if it exists.
|
164 |
-
_.filter = (obj, iterator, context) ->
|
165 |
-
return obj.filter iterator, context if nativeFilter and obj.filter is nativeFilter
|
166 |
-
results = []
|
167 |
-
_.each obj, (value, index, list) ->
|
168 |
-
results.push value if iterator.call context, value, index, list
|
169 |
-
results
|
170 |
-
|
171 |
-
|
172 |
-
# Return all the elements for which a truth test fails.
|
173 |
-
_.reject = (obj, iterator, context) ->
|
174 |
-
results = []
|
175 |
-
_.each obj, (value, index, list) ->
|
176 |
-
results.push value if not iterator.call context, value, index, list
|
177 |
-
results
|
178 |
-
|
179 |
-
|
180 |
-
# Determine whether all of the elements match a truth test. Delegate to
|
181 |
-
# JavaScript 1.6's **every**, if it is present.
|
182 |
-
_.every = (obj, iterator, context) ->
|
183 |
-
iterator ||= _.identity
|
184 |
-
return obj.every iterator, context if nativeEvery and obj.every is nativeEvery
|
185 |
-
result = true
|
186 |
-
_.each obj, (value, index, list) ->
|
187 |
-
_.breakLoop() unless (result = result and iterator.call(context, value, index, list))
|
188 |
-
result
|
189 |
-
|
190 |
-
|
191 |
-
# Determine if at least one element in the object matches a truth test. Use
|
192 |
-
# JavaScript 1.6's **some**, if it exists.
|
193 |
-
_.some = (obj, iterator, context) ->
|
194 |
-
iterator ||= _.identity
|
195 |
-
return obj.some iterator, context if nativeSome and obj.some is nativeSome
|
196 |
-
result = false
|
197 |
-
_.each obj, (value, index, list) ->
|
198 |
-
_.breakLoop() if (result = iterator.call(context, value, index, list))
|
199 |
-
result
|
200 |
-
|
201 |
-
|
202 |
-
# Determine if a given value is included in the array or object,
|
203 |
-
# based on `===`.
|
204 |
-
_.include = (obj, target) ->
|
205 |
-
return _.indexOf(obj, target) isnt -1 if nativeIndexOf and obj.indexOf is nativeIndexOf
|
206 |
-
return true for own key, val of obj when val is target
|
207 |
-
false
|
208 |
-
|
209 |
-
|
210 |
-
# Invoke a method with arguments on every item in a collection.
|
211 |
-
_.invoke = (obj, method) ->
|
212 |
-
args = _.rest arguments, 2
|
213 |
-
(if method then val[method] else val).apply(val, args) for val in obj
|
214 |
-
|
215 |
-
|
216 |
-
# Convenience version of a common use case of **map**: fetching a property.
|
217 |
-
_.pluck = (obj, key) ->
|
218 |
-
_.map(obj, (val) -> val[key])
|
219 |
-
|
220 |
-
|
221 |
-
# Return the maximum item or (item-based computation).
|
222 |
-
_.max = (obj, iterator, context) ->
|
223 |
-
return Math.max.apply(Math, obj) if not iterator and _.isArray(obj)
|
224 |
-
result = computed: -Infinity
|
225 |
-
_.each obj, (value, index, list) ->
|
226 |
-
computed = if iterator then iterator.call(context, value, index, list) else value
|
227 |
-
computed >= result.computed and (result = {value: value, computed: computed})
|
228 |
-
result.value
|
229 |
-
|
230 |
-
|
231 |
-
# Return the minimum element (or element-based computation).
|
232 |
-
_.min = (obj, iterator, context) ->
|
233 |
-
return Math.min.apply(Math, obj) if not iterator and _.isArray(obj)
|
234 |
-
result = computed: Infinity
|
235 |
-
_.each obj, (value, index, list) ->
|
236 |
-
computed = if iterator then iterator.call(context, value, index, list) else value
|
237 |
-
computed < result.computed and (result = {value: value, computed: computed})
|
238 |
-
result.value
|
239 |
-
|
240 |
-
|
241 |
-
# Sort the object's values by a criterion produced by an iterator.
|
242 |
-
_.sortBy = (obj, iterator, context) ->
|
243 |
-
_.pluck(((_.map obj, (value, index, list) ->
|
244 |
-
{value: value, criteria: iterator.call(context, value, index, list)}
|
245 |
-
).sort((left, right) ->
|
246 |
-
a = left.criteria; b = right.criteria
|
247 |
-
if a < b then -1 else if a > b then 1 else 0
|
248 |
-
)), 'value')
|
249 |
-
|
250 |
-
|
251 |
-
# Use a comparator function to figure out at what index an object should
|
252 |
-
# be inserted so as to maintain order. Uses binary search.
|
253 |
-
_.sortedIndex = (array, obj, iterator) ->
|
254 |
-
iterator ||= _.identity
|
255 |
-
low = 0
|
256 |
-
high = array.length
|
257 |
-
while low < high
|
258 |
-
mid = (low + high) >> 1
|
259 |
-
if iterator(array[mid]) < iterator(obj) then low = mid + 1 else high = mid
|
260 |
-
low
|
261 |
-
|
262 |
-
|
263 |
-
# Convert anything iterable into a real, live array.
|
264 |
-
_.toArray = (iterable) ->
|
265 |
-
return [] if (!iterable)
|
266 |
-
return iterable.toArray() if (iterable.toArray)
|
267 |
-
return iterable if (_.isArray(iterable))
|
268 |
-
return slice.call(iterable) if (_.isArguments(iterable))
|
269 |
-
_.values(iterable)
|
270 |
-
|
271 |
-
|
272 |
-
# Return the number of elements in an object.
|
273 |
-
_.size = (obj) -> _.toArray(obj).length
|
274 |
-
|
275 |
-
|
276 |
-
# Array Functions
|
277 |
-
# ---------------
|
278 |
-
|
279 |
-
# Get the first element of an array. Passing `n` will return the first N
|
280 |
-
# values in the array. Aliased as **head**. The `guard` check allows it to work
|
281 |
-
# with **map**.
|
282 |
-
_.first = (array, n, guard) ->
|
283 |
-
if n and not guard then slice.call(array, 0, n) else array[0]
|
284 |
-
|
285 |
-
|
286 |
-
# Returns everything but the first entry of the array. Aliased as **tail**.
|
287 |
-
# Especially useful on the arguments object. Passing an `index` will return
|
288 |
-
# the rest of the values in the array from that index onward. The `guard`
|
289 |
-
# check allows it to work with **map**.
|
290 |
-
_.rest = (array, index, guard) ->
|
291 |
-
slice.call(array, if _.isUndefined(index) or guard then 1 else index)
|
292 |
-
|
293 |
-
|
294 |
-
# Get the last element of an array.
|
295 |
-
_.last = (array) -> array[array.length - 1]
|
296 |
-
|
297 |
-
|
298 |
-
# Trim out all falsy values from an array.
|
299 |
-
_.compact = (array) -> item for item in array when item
|
300 |
-
|
301 |
-
|
302 |
-
# Return a completely flattened version of an array.
|
303 |
-
_.flatten = (array) ->
|
304 |
-
_.reduce array, (memo, value) ->
|
305 |
-
return memo.concat(_.flatten(value)) if _.isArray value
|
306 |
-
memo.push value
|
307 |
-
memo
|
308 |
-
, []
|
309 |
-
|
310 |
-
|
311 |
-
# Return a version of the array that does not contain the specified value(s).
|
312 |
-
_.without = (array) ->
|
313 |
-
values = _.rest arguments
|
314 |
-
val for val in _.toArray(array) when not _.include values, val
|
315 |
-
|
316 |
-
|
317 |
-
# Produce a duplicate-free version of the array. If the array has already
|
318 |
-
# been sorted, you have the option of using a faster algorithm.
|
319 |
-
_.uniq = (array, isSorted) ->
|
320 |
-
memo = []
|
321 |
-
for el, i in _.toArray array
|
322 |
-
memo.push el if i is 0 || (if isSorted is true then _.last(memo) isnt el else not _.include(memo, el))
|
323 |
-
memo
|
324 |
-
|
325 |
-
|
326 |
-
# Produce an array that contains every item shared between all the
|
327 |
-
# passed-in arrays.
|
328 |
-
_.intersect = (array) ->
|
329 |
-
rest = _.rest arguments
|
330 |
-
_.select _.uniq(array), (item) ->
|
331 |
-
_.all rest, (other) ->
|
332 |
-
_.indexOf(other, item) >= 0
|
333 |
-
|
334 |
-
|
335 |
-
# Zip together multiple lists into a single array -- elements that share
|
336 |
-
# an index go together.
|
337 |
-
_.zip = ->
|
338 |
-
length = _.max _.pluck arguments, 'length'
|
339 |
-
results = new Array length
|
340 |
-
for i in [0...length]
|
341 |
-
results[i] = _.pluck arguments, String i
|
342 |
-
results
|
343 |
-
|
344 |
-
|
345 |
-
# If the browser doesn't supply us with **indexOf** (I'm looking at you, MSIE),
|
346 |
-
# we need this function. Return the position of the first occurrence of an
|
347 |
-
# item in an array, or -1 if the item is not included in the array.
|
348 |
-
_.indexOf = (array, item) ->
|
349 |
-
return array.indexOf item if nativeIndexOf and array.indexOf is nativeIndexOf
|
350 |
-
i = 0; l = array.length
|
351 |
-
while l - i
|
352 |
-
if array[i] is item then return i else i++
|
353 |
-
-1
|
354 |
-
|
355 |
-
|
356 |
-
# Provide JavaScript 1.6's **lastIndexOf**, delegating to the native function,
|
357 |
-
# if possible.
|
358 |
-
_.lastIndexOf = (array, item) ->
|
359 |
-
return array.lastIndexOf(item) if nativeLastIndexOf and array.lastIndexOf is nativeLastIndexOf
|
360 |
-
i = array.length
|
361 |
-
while i
|
362 |
-
if array[i] is item then return i else i--
|
363 |
-
-1
|
364 |
-
|
365 |
-
|
366 |
-
# Generate an integer Array containing an arithmetic progression. A port of
|
367 |
-
# [the native Python **range** function](http://docs.python.org/library/functions.html#range).
|
368 |
-
_.range = (start, stop, step) ->
|
369 |
-
a = arguments
|
370 |
-
solo = a.length <= 1
|
371 |
-
i = start = if solo then 0 else a[0]
|
372 |
-
stop = if solo then a[0] else a[1]
|
373 |
-
step = a[2] or 1
|
374 |
-
len = Math.ceil((stop - start) / step)
|
375 |
-
return [] if len <= 0
|
376 |
-
range = new Array len
|
377 |
-
idx = 0
|
378 |
-
loop
|
379 |
-
return range if (if step > 0 then i - stop else stop - i) >= 0
|
380 |
-
range[idx] = i
|
381 |
-
idx++
|
382 |
-
i+= step
|
383 |
-
|
384 |
-
|
385 |
-
# Function Functions
|
386 |
-
# ------------------
|
387 |
-
|
388 |
-
# Create a function bound to a given object (assigning `this`, and arguments,
|
389 |
-
# optionally). Binding with arguments is also known as **curry**.
|
390 |
-
_.bind = (func, obj) ->
|
391 |
-
args = _.rest arguments, 2
|
392 |
-
-> func.apply obj or root, args.concat arguments
|
393 |
-
|
394 |
-
|
395 |
-
# Bind all of an object's methods to that object. Useful for ensuring that
|
396 |
-
# all callbacks defined on an object belong to it.
|
397 |
-
_.bindAll = (obj) ->
|
398 |
-
funcs = if arguments.length > 1 then _.rest(arguments) else _.functions(obj)
|
399 |
-
_.each funcs, (f) -> obj[f] = _.bind obj[f], obj
|
400 |
-
obj
|
401 |
-
|
402 |
-
|
403 |
-
# Delays a function for the given number of milliseconds, and then calls
|
404 |
-
# it with the arguments supplied.
|
405 |
-
_.delay = (func, wait) ->
|
406 |
-
args = _.rest arguments, 2
|
407 |
-
setTimeout((-> func.apply(func, args)), wait)
|
408 |
-
|
409 |
-
|
410 |
-
# Memoize an expensive function by storing its results.
|
411 |
-
_.memoize = (func, hasher) ->
|
412 |
-
memo = {}
|
413 |
-
hasher or= _.identity
|
414 |
-
->
|
415 |
-
key = hasher.apply this, arguments
|
416 |
-
return memo[key] if key of memo
|
417 |
-
memo[key] = func.apply this, arguments
|
418 |
-
|
419 |
-
|
420 |
-
# Defers a function, scheduling it to run after the current call stack has
|
421 |
-
# cleared.
|
422 |
-
_.defer = (func) ->
|
423 |
-
_.delay.apply _, [func, 1].concat _.rest arguments
|
424 |
-
|
425 |
-
|
426 |
-
# Returns the first function passed as an argument to the second,
|
427 |
-
# allowing you to adjust arguments, run code before and after, and
|
428 |
-
# conditionally execute the original function.
|
429 |
-
_.wrap = (func, wrapper) ->
|
430 |
-
-> wrapper.apply wrapper, [func].concat arguments
|
431 |
-
|
432 |
-
|
433 |
-
# Returns a function that is the composition of a list of functions, each
|
434 |
-
# consuming the return value of the function that follows.
|
435 |
-
_.compose = ->
|
436 |
-
funcs = arguments
|
437 |
-
->
|
438 |
-
args = arguments
|
439 |
-
for i in [funcs.length - 1..0] by -1
|
440 |
-
args = [funcs[i].apply(this, args)]
|
441 |
-
args[0]
|
442 |
-
|
443 |
-
|
444 |
-
# Object Functions
|
445 |
-
# ----------------
|
446 |
-
|
447 |
-
# Retrieve the names of an object's properties.
|
448 |
-
_.keys = nativeKeys or (obj) ->
|
449 |
-
return _.range 0, obj.length if _.isArray(obj)
|
450 |
-
key for key, val of obj
|
451 |
-
|
452 |
-
|
453 |
-
# Retrieve the values of an object's properties.
|
454 |
-
_.values = (obj) ->
|
455 |
-
_.map obj, _.identity
|
456 |
-
|
457 |
-
|
458 |
-
# Return a sorted list of the function names available in Underscore.
|
459 |
-
_.functions = (obj) ->
|
460 |
-
_.filter(_.keys(obj), (key) -> _.isFunction(obj[key])).sort()
|
461 |
-
|
462 |
-
|
463 |
-
# Extend a given object with all of the properties in a source object.
|
464 |
-
_.extend = (obj) ->
|
465 |
-
for source in _.rest(arguments)
|
466 |
-
obj[key] = val for key, val of source
|
467 |
-
obj
|
468 |
-
|
469 |
-
|
470 |
-
# Create a (shallow-cloned) duplicate of an object.
|
471 |
-
_.clone = (obj) ->
|
472 |
-
return obj.slice 0 if _.isArray obj
|
473 |
-
_.extend {}, obj
|
474 |
-
|
475 |
-
|
476 |
-
# Invokes interceptor with the obj, and then returns obj.
|
477 |
-
# The primary purpose of this method is to "tap into" a method chain,
|
478 |
-
# in order to perform operations on intermediate results within
|
479 |
-
the chain.
|
480 |
-
_.tap = (obj, interceptor) ->
|
481 |
-
interceptor obj
|
482 |
-
obj
|
483 |
-
|
484 |
-
|
485 |
-
# Perform a deep comparison to check if two objects are equal.
|
486 |
-
_.isEqual = (a, b) ->
|
487 |
-
# Check object identity.
|
488 |
-
return true if a is b
|
489 |
-
# Different types?
|
490 |
-
atype = typeof(a); btype = typeof(b)
|
491 |
-
return false if atype isnt btype
|
492 |
-
# Basic equality test (watch out for coercions).
|
493 |
-
return true if `a == b`
|
494 |
-
# One is falsy and the other truthy.
|
495 |
-
return false if (!a and b) or (a and !b)
|
496 |
-
# One of them implements an `isEqual()`?
|
497 |
-
return a.isEqual(b) if a.isEqual
|
498 |
-
# Check dates' integer values.
|
499 |
-
return a.getTime() is b.getTime() if _.isDate(a) and _.isDate(b)
|
500 |
-
# Both are NaN?
|
501 |
-
return false if _.isNaN(a) and _.isNaN(b)
|
502 |
-
# Compare regular expressions.
|
503 |
-
if _.isRegExp(a) and _.isRegExp(b)
|
504 |
-
return a.source is b.source and
|
505 |
-
a.global is b.global and
|
506 |
-
a.ignoreCase is b.ignoreCase and
|
507 |
-
a.multiline is b.multiline
|
508 |
-
# If a is not an object by this point, we can't handle it.
|
509 |
-
return false if atype isnt 'object'
|
510 |
-
# Check for different array lengths before comparing contents.
|
511 |
-
return false if a.length and (a.length isnt b.length)
|
512 |
-
# Nothing else worked, deep compare the contents.
|
513 |
-
aKeys = _.keys(a); bKeys = _.keys(b)
|
514 |
-
# Different object sizes?
|
515 |
-
return false if aKeys.length isnt bKeys.length
|
516 |
-
# Recursive comparison of contents.
|
517 |
-
return false for key, val of a when !(key of b) or !_.isEqual(val, b[key])
|
518 |
-
true
|
519 |
-
|
520 |
-
|
521 |
-
# Is a given array or object empty?
|
522 |
-
_.isEmpty = (obj) ->
|
523 |
-
return obj.length is 0 if _.isArray(obj) or _.isString(obj)
|
524 |
-
return false for own key of obj
|
525 |
-
true
|
526 |
-
|
527 |
-
|
528 |
-
# Is a given value a DOM element?
|
529 |
-
_.isElement = (obj) -> obj and obj.nodeType is 1
|
530 |
-
|
531 |
-
|
532 |
-
# Is a given value an array?
|
533 |
-
_.isArray = nativeIsArray or (obj) -> !!(obj and obj.concat and obj.unshift and not obj.callee)
|
534 |
-
|
535 |
-
|
536 |
-
# Is a given variable an arguments object?
|
537 |
-
_.isArguments = (obj) -> obj and obj.callee
|
538 |
-
|
539 |
-
|
540 |
-
# Is the given value a function?
|
541 |
-
_.isFunction = (obj) -> !!(obj and obj.constructor and obj.call and obj.apply)
|
542 |
-
|
543 |
-
|
544 |
-
# Is the given value a string?
|
545 |
-
_.isString = (obj) -> !!(obj is '' or (obj and obj.charCodeAt and obj.substr))
|
546 |
-
|
547 |
-
|
548 |
-
# Is a given value a number?
|
549 |
-
_.isNumber = (obj) -> (obj is +obj) or toString.call(obj) is '[object Number]'
|
550 |
-
|
551 |
-
|
552 |
-
# Is a given value a boolean?
|
553 |
-
_.isBoolean = (obj) -> obj is true or obj is false
|
554 |
-
|
555 |
-
|
556 |
-
# Is a given value a Date?
|
557 |
-
_.isDate = (obj) -> !!(obj and obj.getTimezoneOffset and obj.setUTCFullYear)
|
558 |
-
|
559 |
-
|
560 |
-
# Is the given value a regular expression?
|
561 |
-
_.isRegExp = (obj) -> !!(obj and obj.exec and (obj.ignoreCase or obj.ignoreCase is false))
|
562 |
-
|
563 |
-
|
564 |
-
# Is the given value NaN -- this one is interesting. `NaN != NaN`, and
|
565 |
-
# `isNaN(undefined) == true`, so we make sure it's a number first.
|
566 |
-
_.isNaN = (obj) -> _.isNumber(obj) and window.isNaN(obj)
|
567 |
-
|
568 |
-
|
569 |
-
# Is a given value equal to null?
|
570 |
-
_.isNull = (obj) -> obj is null
|
571 |
-
|
572 |
-
|
573 |
-
# Is a given variable undefined?
|
574 |
-
_.isUndefined = (obj) -> typeof obj is 'undefined'
|
575 |
-
|
576 |
-
|
577 |
-
# Utility Functions
|
578 |
-
# -----------------
|
579 |
-
|
580 |
-
# Run Underscore.js in noConflict mode, returning the `_` variable to its
|
581 |
-
# previous owner. Returns a reference to the Underscore object.
|
582 |
-
_.noConflict = ->
|
583 |
-
root._ = previousUnderscore
|
584 |
-
this
|
585 |
-
|
586 |
-
|
587 |
-
# Keep the identity function around for default iterators.
|
588 |
-
_.identity = (value) -> value
|
589 |
-
|
590 |
-
|
591 |
-
# Run a function `n` times.
|
592 |
-
_.times = (n, iterator, context) ->
|
593 |
-
iterator.call context, i for i in [0...n]
|
594 |
-
|
595 |
-
|
596 |
-
# Break out of the middle of an iteration.
|
597 |
-
_.breakLoop = -> throw breaker
|
598 |
-
|
599 |
-
|
600 |
-
# Add your own custom functions to the Underscore object, ensuring that
|
601 |
-
# they're correctly added to the OOP wrapper as well.
|
602 |
-
_.mixin = (obj) ->
|
603 |
-
for name in _.functions(obj)
|
604 |
-
addToWrapper name, _[name] = obj[name]
|
605 |
-
|
606 |
-
|
607 |
-
# Generate a unique integer id (unique within the entire client session).
|
608 |
-
# Useful for temporary DOM ids.
|
609 |
-
idCounter = 0
|
610 |
-
_.uniqueId = (prefix) ->
|
611 |
-
(prefix or '') + idCounter++
|
612 |
-
|
613 |
-
|
614 |
-
# By default, Underscore uses **ERB**-style template delimiters, change the
|
615 |
-
# following template settings to use alternative delimiters.
|
616 |
-
_.templateSettings = {
|
617 |
-
start: '<%'
|
618 |
-
end: '%>'
|
619 |
-
interpolate: /<%=(.+?)%>/g
|
620 |
-
}
|
621 |
-
|
622 |
-
|
623 |
-
# JavaScript templating a-la **ERB**, pilfered from John Resig's
|
624 |
-
# *Secrets of the JavaScript Ninja*, page 83.
|
625 |
-
# Single-quote fix from Rick Strahl.
|
626 |
-
# With alterations for arbitrary delimiters, and to preserve whitespace.
|
627 |
-
_.template = (str, data) ->
|
628 |
-
c = _.templateSettings
|
629 |
-
endMatch = new RegExp("'(?=[^"+c.end.substr(0, 1)+"]*"+escapeRegExp(c.end)+")","g")
|
630 |
-
fn = new Function 'obj',
|
631 |
-
'var p=[],print=function(){p.push.apply(p,arguments);};' +
|
632 |
-
'with(obj||{}){p.push(\'' +
|
633 |
-
str.replace(/\r/g, '\\r')
|
634 |
-
.replace(/\n/g, '\\n')
|
635 |
-
.replace(/\t/g, '\\t')
|
636 |
-
.replace(endMatch,"���")
|
637 |
-
.split("'").join("\\'")
|
638 |
-
.split("���").join("'")
|
639 |
-
.replace(c.interpolate, "',$1,'")
|
640 |
-
.split(c.start).join("');")
|
641 |
-
.split(c.end).join("p.push('") +
|
642 |
-
"');}return p.join('');"
|
643 |
-
if data then fn(data) else fn
|
644 |
-
|
645 |
-
|
646 |
-
# Aliases
|
647 |
-
# -------
|
648 |
-
|
649 |
-
_.forEach = _.each
|
650 |
-
_.foldl = _.inject = _.reduce
|
651 |
-
_.foldr = _.reduceRight
|
652 |
-
_.select = _.filter
|
653 |
-
_.all = _.every
|
654 |
-
_.any = _.some
|
655 |
-
_.contains = _.include
|
656 |
-
_.head = _.first
|
657 |
-
_.tail = _.rest
|
658 |
-
_.methods = _.functions
|
659 |
-
|
660 |
-
|
661 |
-
# Setup the OOP Wrapper
|
662 |
-
# ---------------------
|
663 |
-
|
664 |
-
# If Underscore is called as a function, it returns a wrapped object that
|
665 |
-
# can be used OO-style. This wrapper holds altered versions of all the
|
666 |
-
# underscore functions. Wrapped objects may be chained.
|
667 |
-
wrapper = (obj) ->
|
668 |
-
this._wrapped = obj
|
669 |
-
this
|
670 |
-
|
671 |
-
|
672 |
-
# Helper function to continue chaining intermediate results.
|
673 |
-
result = (obj, chain) ->
|
674 |
-
if chain then _(obj).chain() else obj
|
675 |
-
|
676 |
-
|
677 |
-
# A method to easily add functions to the OOP wrapper.
|
678 |
-
addToWrapper = (name, func) ->
|
679 |
-
wrapper.prototype[name] = ->
|
680 |
-
args = _.toArray arguments
|
681 |
-
unshift.call args, this._wrapped
|
682 |
-
result func.apply(_, args), this._chain
|
683 |
-
|
684 |
-
|
685 |
-
# Add all ofthe Underscore functions to the wrapper object.
|
686 |
-
_.mixin _
|
687 |
-
|
688 |
-
|
689 |
-
# Add all mutator Array functions to the wrapper.
|
690 |
-
_.each ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (name) ->
|
691 |
-
method = Array.prototype[name]
|
692 |
-
wrapper.prototype[name] = ->
|
693 |
-
method.apply(this._wrapped, arguments)
|
694 |
-
result(this._wrapped, this._chain)
|
695 |
-
|
696 |
-
|
697 |
-
# Add all accessor Array functions to the wrapper.
|
698 |
-
_.each ['concat', 'join', 'slice'], (name) ->
|
699 |
-
method = Array.prototype[name]
|
700 |
-
wrapper.prototype[name] = ->
|
701 |
-
result(method.apply(this._wrapped, arguments), this._chain)
|
702 |
-
|
703 |
-
|
704 |
-
# Start chaining a wrapped Underscore object.
|
705 |
-
wrapper::chain = ->
|
706 |
-
this._chain = true
|
707 |
-
this
|
708 |
-
|
709 |
-
|
710 |
-
# Extracts the result from a wrapped and chained object.
|
711 |
-
wrapper::value = -> this._wrapped
|
712 |
-
</textarea></form>
|
713 |
-
<script>
|
714 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
715 |
-
</script>
|
716 |
-
|
717 |
-
<p><strong>MIME types defined:</strong> <code>text/x-coffeescript</code>.</p>
|
718 |
-
|
719 |
-
<p>The CoffeeScript mode was written by Jeff Pickhardt (<a href="LICENSE">license</a>).</p>
|
720 |
-
|
721 |
-
</body>
|
722 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/comlang/comlang.js
DELETED
@@ -1,108 +0,0 @@
|
|
1 |
-
(function() {
|
2 |
-
function keywords(str) {
|
3 |
-
var obj = {}, words = str.split(" ");
|
4 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
5 |
-
return obj;
|
6 |
-
}
|
7 |
-
function heredoc(delim) {
|
8 |
-
return function(stream, state) {
|
9 |
-
if (stream.match(delim)) state.tokenize = null;
|
10 |
-
else stream.skipToEnd();
|
11 |
-
return "string";
|
12 |
-
}
|
13 |
-
}
|
14 |
-
var comlangConfig = {
|
15 |
-
name: "clike",
|
16 |
-
keywords: keywords("else if while"),
|
17 |
-
blockKeywords: keywords("else if while"),
|
18 |
-
atoms: keywords("true false null"),
|
19 |
-
multiLineStrings: false,
|
20 |
-
hooks: {
|
21 |
-
"<": function(stream, state) {
|
22 |
-
if (stream.match(/<</)) {
|
23 |
-
stream.eatWhile(/[\w\.]/);
|
24 |
-
state.tokenize = heredoc(stream.current().slice(3));
|
25 |
-
return state.tokenize(stream, state);
|
26 |
-
}
|
27 |
-
return false;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
};
|
31 |
-
|
32 |
-
CodeMirror.defineMode("comlang", function(config, parserConfig) {
|
33 |
-
var htmlMode = CodeMirror.getMode(config, "text/html");
|
34 |
-
var jsMode = CodeMirror.getMode(config, "text/javascript");
|
35 |
-
var cssMode = CodeMirror.getMode(config, "text/css");
|
36 |
-
var comlangMode = CodeMirror.getMode(config, comlangConfig);
|
37 |
-
|
38 |
-
function dispatch(stream, state) { // TODO open comlang inside text/css
|
39 |
-
if (state.curMode == htmlMode) {
|
40 |
-
var style = htmlMode.token(stream, state.curState);
|
41 |
-
if (style == "meta" && /^<\#/.test(stream.current())) {
|
42 |
-
state.curMode = comlangMode;
|
43 |
-
state.curState = state.comlang;
|
44 |
-
state.curClose = /^\#>/;
|
45 |
-
state.mode = 'comlang';
|
46 |
-
}
|
47 |
-
else if (style == "tag" && stream.current() == ">" && state.curState.context) {
|
48 |
-
if (/^script$/i.test(state.curState.context.tagName)) {
|
49 |
-
state.curMode = jsMode;
|
50 |
-
state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
|
51 |
-
state.curClose = /^<\/\s*script\s*>/i;
|
52 |
-
state.mode = 'javascript';
|
53 |
-
}
|
54 |
-
else if (/^style$/i.test(state.curState.context.tagName)) {
|
55 |
-
state.curMode = cssMode;
|
56 |
-
state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
|
57 |
-
state.curClose = /^<\/\s*style\s*>/i;
|
58 |
-
state.mode = 'css';
|
59 |
-
}
|
60 |
-
}
|
61 |
-
return style;
|
62 |
-
}
|
63 |
-
else if (stream.match(state.curClose, false)) {
|
64 |
-
state.curMode = htmlMode;
|
65 |
-
state.curState = state.html;
|
66 |
-
state.curClose = null;
|
67 |
-
state.mode = 'html';
|
68 |
-
return dispatch(stream, state);
|
69 |
-
}
|
70 |
-
else return state.curMode.token(stream, state.curState);
|
71 |
-
}
|
72 |
-
|
73 |
-
return {
|
74 |
-
startState: function() {
|
75 |
-
var html = htmlMode.startState();
|
76 |
-
return {html: html,
|
77 |
-
comlang: comlangMode.startState(),
|
78 |
-
curMode: parserConfig.startOpen ? comlangMode : htmlMode,
|
79 |
-
curState: parserConfig.startOpen ? comlangMode.startState() : html,
|
80 |
-
curClose: parserConfig.startOpen ? /^\#>/ : null,
|
81 |
-
mode: parserConfig.startOpen ? 'comlang' : 'html'}
|
82 |
-
},
|
83 |
-
|
84 |
-
copyState: function(state) {
|
85 |
-
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
|
86 |
-
comlang = state.comlang, comlangNew = CodeMirror.copyState(comlangMode, comlang), cur;
|
87 |
-
if (state.curState == html) cur = htmlNew;
|
88 |
-
else if (state.curState == comlang) cur = comlangNew;
|
89 |
-
else cur = CodeMirror.copyState(state.curMode, state.curState);
|
90 |
-
return {html: htmlNew, comlang: comlangNew, curMode: state.curMode, curState: cur, curClose: state.curClose};
|
91 |
-
},
|
92 |
-
|
93 |
-
token: dispatch,
|
94 |
-
|
95 |
-
indent: function(state, textAfter) {
|
96 |
-
if ((state.curMode != comlangMode && /^\s*<\//.test(textAfter)) ||
|
97 |
-
(state.curMode == comlangMode && /^\#>/.test(textAfter)))
|
98 |
-
return htmlMode.indent(state.html, textAfter);
|
99 |
-
return state.curMode.indent(state.curState, textAfter);
|
100 |
-
},
|
101 |
-
|
102 |
-
electricChars: "/{}:"
|
103 |
-
}
|
104 |
-
});
|
105 |
-
CodeMirror.defineMIME("application/x-httpd-comlang", "comlang");
|
106 |
-
CodeMirror.defineMIME("application/x-httpd-comlang-open", {name: "comlang", startOpen: true});
|
107 |
-
CodeMirror.defineMIME("text/x-comlang", comlangConfig);
|
108 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/comlang/index.html
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: PHP mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="../xml/xml.js"></script>
|
8 |
-
<script src="../javascript/javascript.js"></script>
|
9 |
-
<script src="../css/css.js"></script>
|
10 |
-
<script src="../clike/clike.js"></script>
|
11 |
-
<script src="php.js"></script>
|
12 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
13 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: PHP mode</h1>
|
18 |
-
|
19 |
-
<form><textarea id="code" name="code">
|
20 |
-
<?php
|
21 |
-
function hello($who) {
|
22 |
-
return "Hello " . $who;
|
23 |
-
}
|
24 |
-
?>
|
25 |
-
<p>The program says <?= hello("World") ?>.</p>
|
26 |
-
<script>
|
27 |
-
alert("And here is some JS code"); // also colored
|
28 |
-
</script>
|
29 |
-
</textarea></form>
|
30 |
-
|
31 |
-
<script>
|
32 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
33 |
-
lineNumbers: true,
|
34 |
-
matchBrackets: true,
|
35 |
-
mode: "application/x-httpd-php",
|
36 |
-
indentUnit: 8,
|
37 |
-
indentWithTabs: true,
|
38 |
-
enterMode: "keep",
|
39 |
-
tabMode: "shift"
|
40 |
-
});
|
41 |
-
</script>
|
42 |
-
|
43 |
-
<p>Simple HTML/PHP mode based on
|
44 |
-
the <a href="../clike/">C-like</a> mode. Depends on XML,
|
45 |
-
JavaScript, CSS, and C-like modes.</p>
|
46 |
-
|
47 |
-
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
|
48 |
-
</body>
|
49 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/css/css.js
DELETED
@@ -1,124 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("css", function(config) {
|
2 |
-
var indentUnit = config.indentUnit, type;
|
3 |
-
function ret(style, tp) {type = tp; return style;}
|
4 |
-
|
5 |
-
function tokenBase(stream, state) {
|
6 |
-
var ch = stream.next();
|
7 |
-
if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
|
8 |
-
else if (ch == "/" && stream.eat("*")) {
|
9 |
-
state.tokenize = tokenCComment;
|
10 |
-
return tokenCComment(stream, state);
|
11 |
-
}
|
12 |
-
else if (ch == "<" && stream.eat("!")) {
|
13 |
-
state.tokenize = tokenSGMLComment;
|
14 |
-
return tokenSGMLComment(stream, state);
|
15 |
-
}
|
16 |
-
else if (ch == "=") ret(null, "compare");
|
17 |
-
else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
|
18 |
-
else if (ch == "\"" || ch == "'") {
|
19 |
-
state.tokenize = tokenString(ch);
|
20 |
-
return state.tokenize(stream, state);
|
21 |
-
}
|
22 |
-
else if (ch == "#") {
|
23 |
-
stream.eatWhile(/[\w\\\-]/);
|
24 |
-
return ret("atom", "hash");
|
25 |
-
}
|
26 |
-
else if (ch == "!") {
|
27 |
-
stream.match(/^\s*\w*/);
|
28 |
-
return ret("keyword", "important");
|
29 |
-
}
|
30 |
-
else if (/\d/.test(ch)) {
|
31 |
-
stream.eatWhile(/[\w.%]/);
|
32 |
-
return ret("number", "unit");
|
33 |
-
}
|
34 |
-
else if (/[,.+>*\/]/.test(ch)) {
|
35 |
-
return ret(null, "select-op");
|
36 |
-
}
|
37 |
-
else if (/[;{}:\[\]]/.test(ch)) {
|
38 |
-
return ret(null, ch);
|
39 |
-
}
|
40 |
-
else {
|
41 |
-
stream.eatWhile(/[\w\\\-]/);
|
42 |
-
return ret("variable", "variable");
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
function tokenCComment(stream, state) {
|
47 |
-
var maybeEnd = false, ch;
|
48 |
-
while ((ch = stream.next()) != null) {
|
49 |
-
if (maybeEnd && ch == "/") {
|
50 |
-
state.tokenize = tokenBase;
|
51 |
-
break;
|
52 |
-
}
|
53 |
-
maybeEnd = (ch == "*");
|
54 |
-
}
|
55 |
-
return ret("comment", "comment");
|
56 |
-
}
|
57 |
-
|
58 |
-
function tokenSGMLComment(stream, state) {
|
59 |
-
var dashes = 0, ch;
|
60 |
-
while ((ch = stream.next()) != null) {
|
61 |
-
if (dashes >= 2 && ch == ">") {
|
62 |
-
state.tokenize = tokenBase;
|
63 |
-
break;
|
64 |
-
}
|
65 |
-
dashes = (ch == "-") ? dashes + 1 : 0;
|
66 |
-
}
|
67 |
-
return ret("comment", "comment");
|
68 |
-
}
|
69 |
-
|
70 |
-
function tokenString(quote) {
|
71 |
-
return function(stream, state) {
|
72 |
-
var escaped = false, ch;
|
73 |
-
while ((ch = stream.next()) != null) {
|
74 |
-
if (ch == quote && !escaped)
|
75 |
-
break;
|
76 |
-
escaped = !escaped && ch == "\\";
|
77 |
-
}
|
78 |
-
if (!escaped) state.tokenize = tokenBase;
|
79 |
-
return ret("string", "string");
|
80 |
-
};
|
81 |
-
}
|
82 |
-
|
83 |
-
return {
|
84 |
-
startState: function(base) {
|
85 |
-
return {tokenize: tokenBase,
|
86 |
-
baseIndent: base || 0,
|
87 |
-
stack: []};
|
88 |
-
},
|
89 |
-
|
90 |
-
token: function(stream, state) {
|
91 |
-
if (stream.eatSpace()) return null;
|
92 |
-
var style = state.tokenize(stream, state);
|
93 |
-
|
94 |
-
var context = state.stack[state.stack.length-1];
|
95 |
-
if (type == "hash" && context == "rule") style = "atom";
|
96 |
-
else if (style == "variable") {
|
97 |
-
if (context == "rule") style = "number";
|
98 |
-
else if (!context || context == "@media{") style = "tag";
|
99 |
-
}
|
100 |
-
|
101 |
-
if (context == "rule" && /^[\{\};]$/.test(type))
|
102 |
-
state.stack.pop();
|
103 |
-
if (type == "{") {
|
104 |
-
if (context == "@media") state.stack[state.stack.length-1] = "@media{";
|
105 |
-
else state.stack.push("{");
|
106 |
-
}
|
107 |
-
else if (type == "}") state.stack.pop();
|
108 |
-
else if (type == "@media") state.stack.push("@media");
|
109 |
-
else if (context == "{" && type != "comment") state.stack.push("rule");
|
110 |
-
return style;
|
111 |
-
},
|
112 |
-
|
113 |
-
indent: function(state, textAfter) {
|
114 |
-
var n = state.stack.length;
|
115 |
-
if (/^\}/.test(textAfter))
|
116 |
-
n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
|
117 |
-
return state.baseIndent + n * indentUnit;
|
118 |
-
},
|
119 |
-
|
120 |
-
electricChars: "}"
|
121 |
-
};
|
122 |
-
});
|
123 |
-
|
124 |
-
CodeMirror.defineMIME("text/css", "css");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/css/index.html
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: CSS mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="css.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>.CodeMirror {background: #f8f8f8;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: CSS mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
/* Some example CSS */
|
16 |
-
|
17 |
-
@import url("something.css");
|
18 |
-
|
19 |
-
body {
|
20 |
-
margin: 0;
|
21 |
-
padding: 3em 6em;
|
22 |
-
font-family: tahoma, arial, sans-serif;
|
23 |
-
color: #000;
|
24 |
-
}
|
25 |
-
|
26 |
-
#navigation a {
|
27 |
-
font-weight: bold;
|
28 |
-
text-decoration: none !important;
|
29 |
-
}
|
30 |
-
|
31 |
-
h1 {
|
32 |
-
font-size: 2.5em;
|
33 |
-
}
|
34 |
-
|
35 |
-
h2 {
|
36 |
-
font-size: 1.7em;
|
37 |
-
}
|
38 |
-
|
39 |
-
h1:before, h2:before {
|
40 |
-
content: "::";
|
41 |
-
}
|
42 |
-
|
43 |
-
code {
|
44 |
-
font-family: courier, monospace;
|
45 |
-
font-size: 80%;
|
46 |
-
color: #418A8A;
|
47 |
-
}
|
48 |
-
</textarea></form>
|
49 |
-
<script>
|
50 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
51 |
-
</script>
|
52 |
-
|
53 |
-
<p><strong>MIME types defined:</strong> <code>text/css</code>.</p>
|
54 |
-
|
55 |
-
</body>
|
56 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/diff/diff.css
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
.cm-s-default span.cm-rangeinfo {color: #a0b;}
|
2 |
-
.cm-s-default span.cm-minus {color: #a22;}
|
3 |
-
.cm-s-default span.cm-plus {color: #2b2;}
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/diff/diff.js
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("diff", function() {
|
2 |
-
return {
|
3 |
-
token: function(stream) {
|
4 |
-
var ch = stream.next();
|
5 |
-
stream.skipToEnd();
|
6 |
-
if (ch == "+") return "plus";
|
7 |
-
if (ch == "-") return "minus";
|
8 |
-
if (ch == "@") return "rangeinfo";
|
9 |
-
}
|
10 |
-
};
|
11 |
-
});
|
12 |
-
|
13 |
-
CodeMirror.defineMIME("text/x-diff", "diff");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/diff/index.html
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Diff mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="diff.js"></script>
|
8 |
-
<link rel="stylesheet" href="diff.css">
|
9 |
-
<style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Diff mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
diff --git a/index.html b/index.html
|
16 |
-
index c1d9156..7764744 100644
|
17 |
-
--- a/index.html
|
18 |
-
+++ b/index.html
|
19 |
-
@@ -95,7 +95,8 @@ StringStream.prototype = {
|
20 |
-
<script>
|
21 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
22 |
-
lineNumbers: true,
|
23 |
-
- autoMatchBrackets: true
|
24 |
-
+ autoMatchBrackets: true,
|
25 |
-
+ onGutterClick: function(x){console.log(x);}
|
26 |
-
});
|
27 |
-
</script>
|
28 |
-
</body>
|
29 |
-
diff --git a/lib/codemirror.js b/lib/codemirror.js
|
30 |
-
index 04646a9..9a39cc7 100644
|
31 |
-
--- a/lib/codemirror.js
|
32 |
-
+++ b/lib/codemirror.js
|
33 |
-
@@ -399,10 +399,16 @@ var CodeMirror = (function() {
|
34 |
-
}
|
35 |
-
|
36 |
-
function onMouseDown(e) {
|
37 |
-
- var start = posFromMouse(e), last = start;
|
38 |
-
+ var start = posFromMouse(e), last = start, target = e.target();
|
39 |
-
if (!start) return;
|
40 |
-
setCursor(start.line, start.ch, false);
|
41 |
-
if (e.button() != 1) return;
|
42 |
-
+ if (target.parentNode == gutter) {
|
43 |
-
+ if (options.onGutterClick)
|
44 |
-
+ options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom);
|
45 |
-
+ return;
|
46 |
-
+ }
|
47 |
-
+
|
48 |
-
if (!focused) onFocus();
|
49 |
-
|
50 |
-
e.stop();
|
51 |
-
@@ -808,7 +814,7 @@ var CodeMirror = (function() {
|
52 |
-
for (var i = showingFrom; i < showingTo; ++i) {
|
53 |
-
var marker = lines[i].gutterMarker;
|
54 |
-
if (marker) html.push('<div class="' + marker.style + '">' + htmlEscape(marker.text) + '</div>');
|
55 |
-
- else html.push("<div>" + (options.lineNumbers ? i + 1 : "\u00a0") + "</div>");
|
56 |
-
+ else html.push("<div>" + (options.lineNumbers ? i + options.firstLineNumber : "\u00a0") + "</div>");
|
57 |
-
}
|
58 |
-
gutter.style.display = "none"; // TODO test whether this actually helps
|
59 |
-
gutter.innerHTML = html.join("");
|
60 |
-
@@ -1371,10 +1377,8 @@ var CodeMirror = (function() {
|
61 |
-
if (option == "parser") setParser(value);
|
62 |
-
else if (option === "lineNumbers") setLineNumbers(value);
|
63 |
-
else if (option === "gutter") setGutter(value);
|
64 |
-
- else if (option === "readOnly") options.readOnly = value;
|
65 |
-
- else if (option === "indentUnit") {options.indentUnit = indentUnit = value; setParser(options.parser);}
|
66 |
-
- else if (/^(?:enterMode|tabMode|indentWithTabs|readOnly|autoMatchBrackets|undoDepth)$/.test(option)) options[option] = value;
|
67 |
-
- else throw new Error("Can't set option " + option);
|
68 |
-
+ else if (option === "indentUnit") {options.indentUnit = value; setParser(options.parser);}
|
69 |
-
+ else options[option] = value;
|
70 |
-
},
|
71 |
-
cursorCoords: cursorCoords,
|
72 |
-
undo: operation(undo),
|
73 |
-
@@ -1402,7 +1406,8 @@ var CodeMirror = (function() {
|
74 |
-
replaceRange: operation(replaceRange),
|
75 |
-
|
76 |
-
operation: function(f){return operation(f)();},
|
77 |
-
- refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}
|
78 |
-
+ refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
|
79 |
-
+ getInputField: function(){return input;}
|
80 |
-
};
|
81 |
-
return instance;
|
82 |
-
}
|
83 |
-
@@ -1420,6 +1425,7 @@ var CodeMirror = (function() {
|
84 |
-
readOnly: false,
|
85 |
-
onChange: null,
|
86 |
-
onCursorActivity: null,
|
87 |
-
+ onGutterClick: null,
|
88 |
-
autoMatchBrackets: false,
|
89 |
-
workTime: 200,
|
90 |
-
workDelay: 300,
|
91 |
-
</textarea></form>
|
92 |
-
<script>
|
93 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
94 |
-
</script>
|
95 |
-
|
96 |
-
<p><strong>MIME types defined:</strong> <code>text/x-diff</code>.</p>
|
97 |
-
|
98 |
-
</body>
|
99 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/gfm/gfm.js
DELETED
@@ -1,108 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("gfm", function(config, parserConfig) {
|
2 |
-
var mdMode = CodeMirror.getMode(config, "markdown");
|
3 |
-
var aliases = {
|
4 |
-
html: "htmlmixed",
|
5 |
-
js: "javascript",
|
6 |
-
json: "application/json",
|
7 |
-
c: "text/x-csrc",
|
8 |
-
"c++": "text/x-c++src",
|
9 |
-
java: "text/x-java",
|
10 |
-
csharp: "text/x-csharp",
|
11 |
-
"c#": "text/x-csharp",
|
12 |
-
};
|
13 |
-
|
14 |
-
// make this lazy so that we don't need to load GFM last
|
15 |
-
var getMode = (function () {
|
16 |
-
var i, modes = {}, mimes = {}, mime;
|
17 |
-
|
18 |
-
var list = CodeMirror.listModes();
|
19 |
-
for (i = 0; i < list.length; i++) {
|
20 |
-
modes[list[i]] = list[i];
|
21 |
-
}
|
22 |
-
var mimesList = CodeMirror.listMIMEs();
|
23 |
-
for (i = 0; i < mimesList.length; i++) {
|
24 |
-
mime = mimesList[i].mime;
|
25 |
-
mimes[mime] = mimesList[i].mime;
|
26 |
-
}
|
27 |
-
|
28 |
-
for (var a in aliases) {
|
29 |
-
if (aliases[a] in modes || aliases[a] in mimes)
|
30 |
-
modes[a] = aliases[a];
|
31 |
-
}
|
32 |
-
|
33 |
-
return function (lang) {
|
34 |
-
return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
|
35 |
-
}
|
36 |
-
}());
|
37 |
-
|
38 |
-
function markdown(stream, state) {
|
39 |
-
// intercept fenced code blocks
|
40 |
-
if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
|
41 |
-
// try switching mode
|
42 |
-
state.localMode = getMode(RegExp.$1)
|
43 |
-
if (state.localMode)
|
44 |
-
state.localState = state.localMode.startState();
|
45 |
-
|
46 |
-
state.token = local;
|
47 |
-
return 'code';
|
48 |
-
}
|
49 |
-
|
50 |
-
return mdMode.token(stream, state.mdState);
|
51 |
-
}
|
52 |
-
|
53 |
-
function local(stream, state) {
|
54 |
-
if (stream.sol() && stream.match(/^```/)) {
|
55 |
-
state.localMode = state.localState = null;
|
56 |
-
state.token = markdown;
|
57 |
-
return 'code';
|
58 |
-
}
|
59 |
-
else if (state.localMode) {
|
60 |
-
return state.localMode.token(stream, state.localState);
|
61 |
-
} else {
|
62 |
-
stream.skipToEnd();
|
63 |
-
return 'code';
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
// custom handleText to prevent emphasis in the middle of a word
|
68 |
-
// and add autolinking
|
69 |
-
function handleText(stream, mdState) {
|
70 |
-
var match;
|
71 |
-
if (stream.match(/^\w+:\/\/\S+/)) {
|
72 |
-
return 'linkhref';
|
73 |
-
}
|
74 |
-
if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
|
75 |
-
return mdMode.getType(mdState);
|
76 |
-
}
|
77 |
-
if (match = stream.match(/^[^\[*\\<>` ]+/)) {
|
78 |
-
var word = match[0];
|
79 |
-
if (word[0] === '_' && word[word.length-1] === '_') {
|
80 |
-
stream.backUp(word.length);
|
81 |
-
return undefined;
|
82 |
-
}
|
83 |
-
return mdMode.getType(mdState);
|
84 |
-
}
|
85 |
-
if (stream.eatSpace()) {
|
86 |
-
return null;
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
return {
|
91 |
-
startState: function() {
|
92 |
-
var mdState = mdMode.startState();
|
93 |
-
mdState.text = handleText;
|
94 |
-
return {token: markdown, mode: "markdown", mdState: mdState,
|
95 |
-
localMode: null, localState: null};
|
96 |
-
},
|
97 |
-
|
98 |
-
copyState: function(state) {
|
99 |
-
return {token: state.token, mode: state.mode, mdState: CodeMirror.copyState(mdMode, state.mdState),
|
100 |
-
localMode: state.localMode,
|
101 |
-
localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null};
|
102 |
-
},
|
103 |
-
|
104 |
-
token: function(stream, state) {
|
105 |
-
return state.token(stream, state);
|
106 |
-
}
|
107 |
-
}
|
108 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/gfm/index.html
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: GFM mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="../xml/xml.js"></script>
|
8 |
-
<script src="../markdown/markdown.js"></script>
|
9 |
-
<script src="gfm.js"></script>
|
10 |
-
<script src="../javascript/javascript.js"></script>
|
11 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
12 |
-
<link rel="stylesheet" href="../markdown/markdown.css">
|
13 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: GFM mode</h1>
|
18 |
-
|
19 |
-
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
|
20 |
-
<form><textarea id="code" name="code">
|
21 |
-
Github Flavored Markdown
|
22 |
-
========================
|
23 |
-
|
24 |
-
Everything from markdown plus GFM features:
|
25 |
-
|
26 |
-
## Fenced code blocks
|
27 |
-
|
28 |
-
```javascript
|
29 |
-
for (var i = 0; i < items.length; i++) {
|
30 |
-
console.log(items[i], i); // log them
|
31 |
-
}
|
32 |
-
```
|
33 |
-
|
34 |
-
See http://github.github.com/github-flavored-markdown/
|
35 |
-
|
36 |
-
</textarea></form>
|
37 |
-
|
38 |
-
<script>
|
39 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
40 |
-
mode: 'gfm',
|
41 |
-
lineNumbers: true,
|
42 |
-
matchBrackets: true,
|
43 |
-
theme: "default"
|
44 |
-
});
|
45 |
-
</script>
|
46 |
-
|
47 |
-
</body>
|
48 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/groovy/groovy.js
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("groovy", function(config, parserConfig) {
|
2 |
-
function words(str) {
|
3 |
-
var obj = {}, words = str.split(" ");
|
4 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
5 |
-
return obj;
|
6 |
-
}
|
7 |
-
var keywords = words(
|
8 |
-
"abstract as assert boolean break byte case catch char class const continue def default " +
|
9 |
-
"do double else enum extends final finally float for goto if implements import in " +
|
10 |
-
"instanceof int interface long native new package private protected public return " +
|
11 |
-
"short static strictfp super switch synchronized threadsafe throw throws transient " +
|
12 |
-
"try void volatile while");
|
13 |
-
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
|
14 |
-
var atoms = words("null true false this");
|
15 |
-
|
16 |
-
var curPunc;
|
17 |
-
function tokenBase(stream, state) {
|
18 |
-
var ch = stream.next();
|
19 |
-
if (ch == '"' || ch == "'") {
|
20 |
-
return startString(ch, stream, state);
|
21 |
-
}
|
22 |
-
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
23 |
-
curPunc = ch;
|
24 |
-
return null
|
25 |
-
}
|
26 |
-
if (/\d/.test(ch)) {
|
27 |
-
stream.eatWhile(/[\w\.]/);
|
28 |
-
if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
|
29 |
-
return "number";
|
30 |
-
}
|
31 |
-
if (ch == "/") {
|
32 |
-
if (stream.eat("*")) {
|
33 |
-
state.tokenize.push(tokenComment);
|
34 |
-
return tokenComment(stream, state);
|
35 |
-
}
|
36 |
-
if (stream.eat("/")) {
|
37 |
-
stream.skipToEnd();
|
38 |
-
return "comment";
|
39 |
-
}
|
40 |
-
if (expectExpression(state.lastToken)) {
|
41 |
-
return startString(ch, stream, state);
|
42 |
-
}
|
43 |
-
}
|
44 |
-
if (ch == "-" && stream.eat(">")) {
|
45 |
-
curPunc = "->";
|
46 |
-
return null;
|
47 |
-
}
|
48 |
-
if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
|
49 |
-
stream.eatWhile(/[+\-*&%=<>|~]/);
|
50 |
-
return "operator";
|
51 |
-
}
|
52 |
-
stream.eatWhile(/[\w\$_]/);
|
53 |
-
if (ch == "@") return "meta";
|
54 |
-
if (state.lastToken == ".") return "property";
|
55 |
-
if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
|
56 |
-
var cur = stream.current();
|
57 |
-
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
|
58 |
-
if (keywords.propertyIsEnumerable(cur)) {
|
59 |
-
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
60 |
-
return "keyword";
|
61 |
-
}
|
62 |
-
return "word";
|
63 |
-
}
|
64 |
-
tokenBase.isBase = true;
|
65 |
-
|
66 |
-
function startString(quote, stream, state) {
|
67 |
-
var tripleQuoted = false;
|
68 |
-
if (quote != "/" && stream.eat(quote)) {
|
69 |
-
if (stream.eat(quote)) tripleQuoted = true;
|
70 |
-
else return "string";
|
71 |
-
}
|
72 |
-
function t(stream, state) {
|
73 |
-
var escaped = false, next, end = !tripleQuoted;
|
74 |
-
while ((next = stream.next()) != null) {
|
75 |
-
if (next == quote && !escaped) {
|
76 |
-
if (!tripleQuoted) { break; }
|
77 |
-
if (stream.match(quote + quote)) { end = true; break; }
|
78 |
-
}
|
79 |
-
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
|
80 |
-
state.tokenize.push(tokenBaseUntilBrace());
|
81 |
-
return "string";
|
82 |
-
}
|
83 |
-
escaped = !escaped && next == "\\";
|
84 |
-
}
|
85 |
-
if (end) state.tokenize.pop();
|
86 |
-
return "string";
|
87 |
-
}
|
88 |
-
state.tokenize.push(t);
|
89 |
-
return t(stream, state);
|
90 |
-
}
|
91 |
-
|
92 |
-
function tokenBaseUntilBrace() {
|
93 |
-
var depth = 1;
|
94 |
-
function t(stream, state) {
|
95 |
-
if (stream.peek() == "}") {
|
96 |
-
depth--;
|
97 |
-
if (depth == 0) {
|
98 |
-
state.tokenize.pop();
|
99 |
-
return state.tokenize[state.tokenize.length-1](stream, state);
|
100 |
-
}
|
101 |
-
} else if (stream.peek() == "{") {
|
102 |
-
depth++;
|
103 |
-
}
|
104 |
-
return tokenBase(stream, state);
|
105 |
-
}
|
106 |
-
t.isBase = true;
|
107 |
-
return t;
|
108 |
-
}
|
109 |
-
|
110 |
-
function tokenComment(stream, state) {
|
111 |
-
var maybeEnd = false, ch;
|
112 |
-
while (ch = stream.next()) {
|
113 |
-
if (ch == "/" && maybeEnd) {
|
114 |
-
state.tokenize.pop();
|
115 |
-
break;
|
116 |
-
}
|
117 |
-
maybeEnd = (ch == "*");
|
118 |
-
}
|
119 |
-
return "comment";
|
120 |
-
}
|
121 |
-
|
122 |
-
function expectExpression(last) {
|
123 |
-
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
|
124 |
-
last == "newstatement" || last == "keyword" || last == "proplabel";
|
125 |
-
}
|
126 |
-
|
127 |
-
function Context(indented, column, type, align, prev) {
|
128 |
-
this.indented = indented;
|
129 |
-
this.column = column;
|
130 |
-
this.type = type;
|
131 |
-
this.align = align;
|
132 |
-
this.prev = prev;
|
133 |
-
}
|
134 |
-
function pushContext(state, col, type) {
|
135 |
-
return state.context = new Context(state.indented, col, type, null, state.context);
|
136 |
-
}
|
137 |
-
function popContext(state) {
|
138 |
-
var t = state.context.type;
|
139 |
-
if (t == ")" || t == "]" || t == "}")
|
140 |
-
state.indented = state.context.indented;
|
141 |
-
return state.context = state.context.prev;
|
142 |
-
}
|
143 |
-
|
144 |
-
// Interface
|
145 |
-
|
146 |
-
return {
|
147 |
-
startState: function(basecolumn) {
|
148 |
-
return {
|
149 |
-
tokenize: [tokenBase],
|
150 |
-
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
|
151 |
-
indented: 0,
|
152 |
-
startOfLine: true,
|
153 |
-
lastToken: null
|
154 |
-
};
|
155 |
-
},
|
156 |
-
|
157 |
-
token: function(stream, state) {
|
158 |
-
var ctx = state.context;
|
159 |
-
if (stream.sol()) {
|
160 |
-
if (ctx.align == null) ctx.align = false;
|
161 |
-
state.indented = stream.indentation();
|
162 |
-
state.startOfLine = true;
|
163 |
-
// Automatic semicolon insertion
|
164 |
-
if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
|
165 |
-
popContext(state); ctx = state.context;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
if (stream.eatSpace()) return null;
|
169 |
-
curPunc = null;
|
170 |
-
var style = state.tokenize[state.tokenize.length-1](stream, state);
|
171 |
-
if (style == "comment") return style;
|
172 |
-
if (ctx.align == null) ctx.align = true;
|
173 |
-
|
174 |
-
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
175 |
-
// Handle indentation for {x -> \n ... }
|
176 |
-
else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
|
177 |
-
popContext(state);
|
178 |
-
state.context.align = false;
|
179 |
-
}
|
180 |
-
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
181 |
-
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
182 |
-
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
183 |
-
else if (curPunc == "}") {
|
184 |
-
while (ctx.type == "statement") ctx = popContext(state);
|
185 |
-
if (ctx.type == "}") ctx = popContext(state);
|
186 |
-
while (ctx.type == "statement") ctx = popContext(state);
|
187 |
-
}
|
188 |
-
else if (curPunc == ctx.type) popContext(state);
|
189 |
-
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
190 |
-
pushContext(state, stream.column(), "statement");
|
191 |
-
state.startOfLine = false;
|
192 |
-
state.lastToken = curPunc || style;
|
193 |
-
return style;
|
194 |
-
},
|
195 |
-
|
196 |
-
indent: function(state, textAfter) {
|
197 |
-
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
|
198 |
-
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
|
199 |
-
if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
|
200 |
-
var closing = firstChar == ctx.type;
|
201 |
-
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
|
202 |
-
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
203 |
-
else return ctx.indented + (closing ? 0 : config.indentUnit);
|
204 |
-
},
|
205 |
-
|
206 |
-
electricChars: "{}"
|
207 |
-
};
|
208 |
-
});
|
209 |
-
|
210 |
-
CodeMirror.defineMIME("text/x-groovy", "groovy");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/groovy/index.html
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Groovy mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="groovy.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Groovy mode</h1>
|
14 |
-
|
15 |
-
<form><textarea id="code" name="code">
|
16 |
-
//Pattern for groovy script
|
17 |
-
def p = ~/.*\.groovy/
|
18 |
-
new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
|
19 |
-
// imports list
|
20 |
-
def imports = []
|
21 |
-
f.eachLine {
|
22 |
-
// condition to detect an import instruction
|
23 |
-
ln -> if ( ln =~ '^import .*' ) {
|
24 |
-
imports << "${ln - 'import '}"
|
25 |
-
}
|
26 |
-
}
|
27 |
-
// print thmen
|
28 |
-
if ( ! imports.empty ) {
|
29 |
-
println f
|
30 |
-
imports.each{ println " $it" }
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
/* Coin changer demo code from http://groovy.codehaus.org */
|
35 |
-
|
36 |
-
enum UsCoin {
|
37 |
-
quarter(25), dime(10), nickel(5), penny(1)
|
38 |
-
UsCoin(v) { value = v }
|
39 |
-
final value
|
40 |
-
}
|
41 |
-
|
42 |
-
enum OzzieCoin {
|
43 |
-
fifty(50), twenty(20), ten(10), five(5)
|
44 |
-
OzzieCoin(v) { value = v }
|
45 |
-
final value
|
46 |
-
}
|
47 |
-
|
48 |
-
def plural(word, count) {
|
49 |
-
if (count == 1) return word
|
50 |
-
word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
|
51 |
-
}
|
52 |
-
|
53 |
-
def change(currency, amount) {
|
54 |
-
currency.values().inject([]){ list, coin ->
|
55 |
-
int count = amount / coin.value
|
56 |
-
amount = amount % coin.value
|
57 |
-
list += "$count ${plural(coin.toString(), count)}"
|
58 |
-
}
|
59 |
-
}
|
60 |
-
</textarea></form>
|
61 |
-
|
62 |
-
<script>
|
63 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
64 |
-
lineNumbers: true,
|
65 |
-
matchBrackets: true,
|
66 |
-
mode: "text/x-groovy"
|
67 |
-
});
|
68 |
-
</script>
|
69 |
-
|
70 |
-
<p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
|
71 |
-
</body>
|
72 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/haskell/haskell.js
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
2 |
-
|
3 |
-
function switchState(source, setState, f) {
|
4 |
-
setState(f);
|
5 |
-
return f(source, setState);
|
6 |
-
}
|
7 |
-
|
8 |
-
// These should all be Unicode extended, as per the Haskell 2010 report
|
9 |
-
var smallRE = /[a-z_]/;
|
10 |
-
var largeRE = /[A-Z]/;
|
11 |
-
var digitRE = /[0-9]/;
|
12 |
-
var hexitRE = /[0-9A-Fa-f]/;
|
13 |
-
var octitRE = /[0-7]/;
|
14 |
-
var idRE = /[a-z_A-Z0-9']/;
|
15 |
-
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
|
16 |
-
var specialRE = /[(),;[\]`{}]/;
|
17 |
-
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
18 |
-
|
19 |
-
function normal(source, setState) {
|
20 |
-
if (source.eatWhile(whiteCharRE)) {
|
21 |
-
return null;
|
22 |
-
}
|
23 |
-
|
24 |
-
var ch = source.next();
|
25 |
-
if (specialRE.test(ch)) {
|
26 |
-
if (ch == '{' && source.eat('-')) {
|
27 |
-
var t = "comment";
|
28 |
-
if (source.eat('#')) {
|
29 |
-
t = "meta";
|
30 |
-
}
|
31 |
-
return switchState(source, setState, ncomment(t, 1));
|
32 |
-
}
|
33 |
-
return null;
|
34 |
-
}
|
35 |
-
|
36 |
-
if (ch == '\'') {
|
37 |
-
if (source.eat('\\')) {
|
38 |
-
source.next(); // should handle other escapes here
|
39 |
-
}
|
40 |
-
else {
|
41 |
-
source.next();
|
42 |
-
}
|
43 |
-
if (source.eat('\'')) {
|
44 |
-
return "string";
|
45 |
-
}
|
46 |
-
return "error";
|
47 |
-
}
|
48 |
-
|
49 |
-
if (ch == '"') {
|
50 |
-
return switchState(source, setState, stringLiteral);
|
51 |
-
}
|
52 |
-
|
53 |
-
if (largeRE.test(ch)) {
|
54 |
-
source.eatWhile(idRE);
|
55 |
-
if (source.eat('.')) {
|
56 |
-
return "qualifier";
|
57 |
-
}
|
58 |
-
return "variable-2";
|
59 |
-
}
|
60 |
-
|
61 |
-
if (smallRE.test(ch)) {
|
62 |
-
source.eatWhile(idRE);
|
63 |
-
return "variable";
|
64 |
-
}
|
65 |
-
|
66 |
-
if (digitRE.test(ch)) {
|
67 |
-
if (ch == '0') {
|
68 |
-
if (source.eat(/[xX]/)) {
|
69 |
-
source.eatWhile(hexitRE); // should require at least 1
|
70 |
-
return "integer";
|
71 |
-
}
|
72 |
-
if (source.eat(/[oO]/)) {
|
73 |
-
source.eatWhile(octitRE); // should require at least 1
|
74 |
-
return "number";
|
75 |
-
}
|
76 |
-
}
|
77 |
-
source.eatWhile(digitRE);
|
78 |
-
var t = "number";
|
79 |
-
if (source.eat('.')) {
|
80 |
-
t = "number";
|
81 |
-
source.eatWhile(digitRE); // should require at least 1
|
82 |
-
}
|
83 |
-
if (source.eat(/[eE]/)) {
|
84 |
-
t = "number";
|
85 |
-
source.eat(/[-+]/);
|
86 |
-
source.eatWhile(digitRE); // should require at least 1
|
87 |
-
}
|
88 |
-
return t;
|
89 |
-
}
|
90 |
-
|
91 |
-
if (symbolRE.test(ch)) {
|
92 |
-
if (ch == '-' && source.eat(/-/)) {
|
93 |
-
source.eatWhile(/-/);
|
94 |
-
if (!source.eat(symbolRE)) {
|
95 |
-
source.skipToEnd();
|
96 |
-
return "comment";
|
97 |
-
}
|
98 |
-
}
|
99 |
-
var t = "variable";
|
100 |
-
if (ch == ':') {
|
101 |
-
t = "variable-2";
|
102 |
-
}
|
103 |
-
source.eatWhile(symbolRE);
|
104 |
-
return t;
|
105 |
-
}
|
106 |
-
|
107 |
-
return "error";
|
108 |
-
}
|
109 |
-
|
110 |
-
function ncomment(type, nest) {
|
111 |
-
if (nest == 0) {
|
112 |
-
return normal;
|
113 |
-
}
|
114 |
-
return function(source, setState) {
|
115 |
-
var currNest = nest;
|
116 |
-
while (!source.eol()) {
|
117 |
-
var ch = source.next();
|
118 |
-
if (ch == '{' && source.eat('-')) {
|
119 |
-
++currNest;
|
120 |
-
}
|
121 |
-
else if (ch == '-' && source.eat('}')) {
|
122 |
-
--currNest;
|
123 |
-
if (currNest == 0) {
|
124 |
-
setState(normal);
|
125 |
-
return type;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
setState(ncomment(type, currNest));
|
130 |
-
return type;
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
function stringLiteral(source, setState) {
|
135 |
-
while (!source.eol()) {
|
136 |
-
var ch = source.next();
|
137 |
-
if (ch == '"') {
|
138 |
-
setState(normal);
|
139 |
-
return "string";
|
140 |
-
}
|
141 |
-
if (ch == '\\') {
|
142 |
-
if (source.eol() || source.eat(whiteCharRE)) {
|
143 |
-
setState(stringGap);
|
144 |
-
return "string";
|
145 |
-
}
|
146 |
-
if (source.eat('&')) {
|
147 |
-
}
|
148 |
-
else {
|
149 |
-
source.next(); // should handle other escapes here
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
setState(normal);
|
154 |
-
return "error";
|
155 |
-
}
|
156 |
-
|
157 |
-
function stringGap(source, setState) {
|
158 |
-
if (source.eat('\\')) {
|
159 |
-
return switchState(source, setState, stringLiteral);
|
160 |
-
}
|
161 |
-
source.next();
|
162 |
-
setState(normal);
|
163 |
-
return "error";
|
164 |
-
}
|
165 |
-
|
166 |
-
|
167 |
-
var wellKnownWords = (function() {
|
168 |
-
var wkw = {};
|
169 |
-
function setType(t) {
|
170 |
-
return function () {
|
171 |
-
for (var i = 0; i < arguments.length; i++)
|
172 |
-
wkw[arguments[i]] = t;
|
173 |
-
}
|
174 |
-
}
|
175 |
-
|
176 |
-
setType("keyword")(
|
177 |
-
"case", "class", "data", "default", "deriving", "do", "else", "foreign",
|
178 |
-
"if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
|
179 |
-
"module", "newtype", "of", "then", "type", "where", "_");
|
180 |
-
|
181 |
-
setType("keyword")(
|
182 |
-
"\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
|
183 |
-
|
184 |
-
setType("builtin")(
|
185 |
-
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
|
186 |
-
"==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
|
187 |
-
|
188 |
-
setType("builtin")(
|
189 |
-
"Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
|
190 |
-
"False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
|
191 |
-
"IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
|
192 |
-
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
|
193 |
-
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
|
194 |
-
"String", "True");
|
195 |
-
|
196 |
-
setType("builtin")(
|
197 |
-
"abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
|
198 |
-
"asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
|
199 |
-
"compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
|
200 |
-
"cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
|
201 |
-
"elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
|
202 |
-
"enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
|
203 |
-
"flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
|
204 |
-
"foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
|
205 |
-
"fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
|
206 |
-
"getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
|
207 |
-
"isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
|
208 |
-
"lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
|
209 |
-
"mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
|
210 |
-
"minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
|
211 |
-
"otherwise", "pi", "pred", "print", "product", "properFraction",
|
212 |
-
"putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
|
213 |
-
"readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
|
214 |
-
"realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
|
215 |
-
"round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
|
216 |
-
"sequence", "sequence_", "show", "showChar", "showList", "showParen",
|
217 |
-
"showString", "shows", "showsPrec", "significand", "signum", "sin",
|
218 |
-
"sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
|
219 |
-
"tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
|
220 |
-
"toRational", "truncate", "uncurry", "undefined", "unlines", "until",
|
221 |
-
"unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
|
222 |
-
"zip3", "zipWith", "zipWith3");
|
223 |
-
|
224 |
-
return wkw;
|
225 |
-
})();
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
return {
|
230 |
-
startState: function () { return { f: normal }; },
|
231 |
-
copyState: function (s) { return { f: s.f }; },
|
232 |
-
|
233 |
-
token: function(stream, state) {
|
234 |
-
var t = state.f(stream, function(s) { state.f = s; });
|
235 |
-
var w = stream.current();
|
236 |
-
return (w in wellKnownWords) ? wellKnownWords[w] : t;
|
237 |
-
}
|
238 |
-
};
|
239 |
-
|
240 |
-
});
|
241 |
-
|
242 |
-
CodeMirror.defineMIME("text/x-haskell", "haskell");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/haskell/index.html
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Haskell mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="haskell.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/elegant.css">
|
9 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Haskell mode</h1>
|
14 |
-
|
15 |
-
<form><textarea id="code" name="code">
|
16 |
-
module UniquePerms (
|
17 |
-
uniquePerms
|
18 |
-
)
|
19 |
-
where
|
20 |
-
|
21 |
-
-- | Find all unique permutations of a list where there might be duplicates.
|
22 |
-
uniquePerms :: (Eq a) => [a] -> [[a]]
|
23 |
-
uniquePerms = permBag . makeBag
|
24 |
-
|
25 |
-
-- | An unordered collection where duplicate values are allowed,
|
26 |
-
-- but represented with a single value and a count.
|
27 |
-
type Bag a = [(a, Int)]
|
28 |
-
|
29 |
-
makeBag :: (Eq a) => [a] -> Bag a
|
30 |
-
makeBag [] = []
|
31 |
-
makeBag (a:as) = mix a $ makeBag as
|
32 |
-
where
|
33 |
-
mix a [] = [(a,1)]
|
34 |
-
mix a (bn@(b,n):bs) | a == b = (b,n+1):bs
|
35 |
-
| otherwise = bn : mix a bs
|
36 |
-
|
37 |
-
permBag :: Bag a -> [[a]]
|
38 |
-
permBag [] = [[]]
|
39 |
-
permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
|
40 |
-
where
|
41 |
-
oneOfEach [] = []
|
42 |
-
oneOfEach (an@(a,n):bs) =
|
43 |
-
let bs' = if n == 1 then bs else (a,n-1):bs
|
44 |
-
in (a,bs') : mapSnd (an:) (oneOfEach bs)
|
45 |
-
|
46 |
-
apSnd f (a,b) = (a, f b)
|
47 |
-
mapSnd = map . apSnd
|
48 |
-
</textarea></form>
|
49 |
-
|
50 |
-
<script>
|
51 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
52 |
-
lineNumbers: true,
|
53 |
-
matchBrackets: true,
|
54 |
-
theme: "elegant"
|
55 |
-
});
|
56 |
-
</script>
|
57 |
-
|
58 |
-
<p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
|
59 |
-
</body>
|
60 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/htmlmixed/htmlmixed.js
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
|
2 |
-
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
|
3 |
-
var jsMode = CodeMirror.getMode(config, "javascript");
|
4 |
-
var cssMode = CodeMirror.getMode(config, "css");
|
5 |
-
|
6 |
-
function html(stream, state) {
|
7 |
-
var style = htmlMode.token(stream, state.htmlState);
|
8 |
-
if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
|
9 |
-
if (/^script$/i.test(state.htmlState.context.tagName)) {
|
10 |
-
state.token = javascript;
|
11 |
-
state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
|
12 |
-
state.mode = "javascript";
|
13 |
-
}
|
14 |
-
else if (/^style$/i.test(state.htmlState.context.tagName)) {
|
15 |
-
state.token = css;
|
16 |
-
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
|
17 |
-
state.mode = "css";
|
18 |
-
}
|
19 |
-
}
|
20 |
-
return style;
|
21 |
-
}
|
22 |
-
function maybeBackup(stream, pat, style) {
|
23 |
-
var cur = stream.current();
|
24 |
-
var close = cur.search(pat);
|
25 |
-
if (close > -1) stream.backUp(cur.length - close);
|
26 |
-
return style;
|
27 |
-
}
|
28 |
-
function javascript(stream, state) {
|
29 |
-
if (stream.match(/^<\/\s*script\s*>/i, false)) {
|
30 |
-
state.token = html;
|
31 |
-
state.curState = null;
|
32 |
-
state.mode = "html";
|
33 |
-
return html(stream, state);
|
34 |
-
}
|
35 |
-
return maybeBackup(stream, /<\/\s*script\s*>/,
|
36 |
-
jsMode.token(stream, state.localState));
|
37 |
-
}
|
38 |
-
function css(stream, state) {
|
39 |
-
if (stream.match(/^<\/\s*style\s*>/i, false)) {
|
40 |
-
state.token = html;
|
41 |
-
state.localState = null;
|
42 |
-
state.mode = "html";
|
43 |
-
return html(stream, state);
|
44 |
-
}
|
45 |
-
return maybeBackup(stream, /<\/\s*style\s*>/,
|
46 |
-
cssMode.token(stream, state.localState));
|
47 |
-
}
|
48 |
-
|
49 |
-
return {
|
50 |
-
startState: function() {
|
51 |
-
var state = htmlMode.startState();
|
52 |
-
return {token: html, localState: null, mode: "html", htmlState: state};
|
53 |
-
},
|
54 |
-
|
55 |
-
copyState: function(state) {
|
56 |
-
if (state.localState)
|
57 |
-
var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
|
58 |
-
return {token: state.token, localState: local, mode: state.mode,
|
59 |
-
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
60 |
-
},
|
61 |
-
|
62 |
-
token: function(stream, state) {
|
63 |
-
return state.token(stream, state);
|
64 |
-
},
|
65 |
-
|
66 |
-
indent: function(state, textAfter) {
|
67 |
-
if (state.token == html || /^\s*<\//.test(textAfter))
|
68 |
-
return htmlMode.indent(state.htmlState, textAfter);
|
69 |
-
else if (state.token == javascript)
|
70 |
-
return jsMode.indent(state.localState, textAfter);
|
71 |
-
else
|
72 |
-
return cssMode.indent(state.localState, textAfter);
|
73 |
-
},
|
74 |
-
|
75 |
-
compareStates: function(a, b) {
|
76 |
-
return htmlMode.compareStates(a.htmlState, b.htmlState);
|
77 |
-
},
|
78 |
-
|
79 |
-
electricChars: "/{}:"
|
80 |
-
}
|
81 |
-
});
|
82 |
-
|
83 |
-
CodeMirror.defineMIME("text/html", "htmlmixed");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/htmlmixed/index.html
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: HTML mixed mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="../xml/xml.js"></script>
|
8 |
-
<script src="../javascript/javascript.js"></script>
|
9 |
-
<script src="../css/css.js"></script>
|
10 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
11 |
-
<script src="htmlmixed.js"></script>
|
12 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
13 |
-
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14 |
-
</head>
|
15 |
-
<body>
|
16 |
-
<h1>CodeMirror 2: HTML mixed mode</h1>
|
17 |
-
<form><textarea id="code" name="code">
|
18 |
-
<html style="color: green">
|
19 |
-
<!-- this is a comment -->
|
20 |
-
<head>
|
21 |
-
<title>Mixed HTML Example</title>
|
22 |
-
<style type="text/css">
|
23 |
-
h1 {font-family: comic sans; color: #f0f;}
|
24 |
-
div {background: yellow !important;}
|
25 |
-
body {
|
26 |
-
max-width: 50em;
|
27 |
-
margin: 1em 2em 1em 5em;
|
28 |
-
}
|
29 |
-
</style>
|
30 |
-
</head>
|
31 |
-
<body>
|
32 |
-
<h1>Mixed HTML Example</h1>
|
33 |
-
<script>
|
34 |
-
function jsFunc(arg1, arg2) {
|
35 |
-
if (arg1 && arg2) document.body.innerHTML = "achoo";
|
36 |
-
}
|
37 |
-
</script>
|
38 |
-
</body>
|
39 |
-
</html>
|
40 |
-
</textarea></form>
|
41 |
-
<script>
|
42 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", tabMode: "indent"});
|
43 |
-
</script>
|
44 |
-
|
45 |
-
<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
|
46 |
-
|
47 |
-
<p><strong>MIME types defined:</strong> <code>text/html</code>
|
48 |
-
(redefined, only takes effect if you load this parser after the
|
49 |
-
XML parser).</p>
|
50 |
-
|
51 |
-
</body>
|
52 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/javascript/index.html
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: JavaScript mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="javascript.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: JavaScript mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
// Demo code (the actual new parser character stream implementation)
|
17 |
-
|
18 |
-
function StringStream(string) {
|
19 |
-
this.pos = 0;
|
20 |
-
this.string = string;
|
21 |
-
}
|
22 |
-
|
23 |
-
StringStream.prototype = {
|
24 |
-
done: function() {return this.pos >= this.string.length;},
|
25 |
-
peek: function() {return this.string.charAt(this.pos);},
|
26 |
-
next: function() {
|
27 |
-
if (this.pos < this.string.length)
|
28 |
-
return this.string.charAt(this.pos++);
|
29 |
-
},
|
30 |
-
eat: function(match) {
|
31 |
-
var ch = this.string.charAt(this.pos);
|
32 |
-
if (typeof match == "string") var ok = ch == match;
|
33 |
-
else var ok = ch && match.test ? match.test(ch) : match(ch);
|
34 |
-
if (ok) {this.pos++; return ch;}
|
35 |
-
},
|
36 |
-
eatWhile: function(match) {
|
37 |
-
var start = this.pos;
|
38 |
-
while (this.eat(match));
|
39 |
-
if (this.pos > start) return this.string.slice(start, this.pos);
|
40 |
-
},
|
41 |
-
backUp: function(n) {this.pos -= n;},
|
42 |
-
column: function() {return this.pos;},
|
43 |
-
eatSpace: function() {
|
44 |
-
var start = this.pos;
|
45 |
-
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
|
46 |
-
return this.pos - start;
|
47 |
-
},
|
48 |
-
match: function(pattern, consume, caseInsensitive) {
|
49 |
-
if (typeof pattern == "string") {
|
50 |
-
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
51 |
-
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
52 |
-
if (consume !== false) this.pos += str.length;
|
53 |
-
return true;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
else {
|
57 |
-
var match = this.string.slice(this.pos).match(pattern);
|
58 |
-
if (match && consume !== false) this.pos += match[0].length;
|
59 |
-
return match;
|
60 |
-
}
|
61 |
-
}
|
62 |
-
};
|
63 |
-
</textarea></div>
|
64 |
-
|
65 |
-
<script>
|
66 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
67 |
-
lineNumbers: true,
|
68 |
-
matchBrackets: true
|
69 |
-
});
|
70 |
-
</script>
|
71 |
-
|
72 |
-
<p>JavaScript mode supports a single configuration
|
73 |
-
option, <code>json</code>, which will set the mode to expect JSON
|
74 |
-
data rather than a JavaScript program.</p>
|
75 |
-
|
76 |
-
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
|
77 |
-
</body>
|
78 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/javascript/javascript.js
DELETED
@@ -1,358 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
2 |
-
var indentUnit = config.indentUnit;
|
3 |
-
var jsonMode = parserConfig.json;
|
4 |
-
|
5 |
-
// Tokenizer
|
6 |
-
|
7 |
-
var keywords = function(){
|
8 |
-
function kw(type) {return {type: type, style: "keyword"};}
|
9 |
-
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
10 |
-
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
11 |
-
return {
|
12 |
-
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
13 |
-
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
14 |
-
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
15 |
-
"function": kw("function"), "catch": kw("catch"),
|
16 |
-
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
17 |
-
"in": operator, "typeof": operator, "instanceof": operator,
|
18 |
-
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
|
19 |
-
};
|
20 |
-
}();
|
21 |
-
|
22 |
-
var isOperatorChar = /[+\-*&%=<>!?|]/;
|
23 |
-
|
24 |
-
function chain(stream, state, f) {
|
25 |
-
state.tokenize = f;
|
26 |
-
return f(stream, state);
|
27 |
-
}
|
28 |
-
|
29 |
-
function nextUntilUnescaped(stream, end) {
|
30 |
-
var escaped = false, next;
|
31 |
-
while ((next = stream.next()) != null) {
|
32 |
-
if (next == end && !escaped)
|
33 |
-
return false;
|
34 |
-
escaped = !escaped && next == "\\";
|
35 |
-
}
|
36 |
-
return escaped;
|
37 |
-
}
|
38 |
-
|
39 |
-
// Used as scratch variables to communicate multiple values without
|
40 |
-
// consing up tons of objects.
|
41 |
-
var type, content;
|
42 |
-
function ret(tp, style, cont) {
|
43 |
-
type = tp; content = cont;
|
44 |
-
return style;
|
45 |
-
}
|
46 |
-
|
47 |
-
function jsTokenBase(stream, state) {
|
48 |
-
var ch = stream.next();
|
49 |
-
if (ch == '"' || ch == "'")
|
50 |
-
return chain(stream, state, jsTokenString(ch));
|
51 |
-
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
52 |
-
return ret(ch);
|
53 |
-
else if (ch == "0" && stream.eat(/x/i)) {
|
54 |
-
stream.eatWhile(/[\da-f]/i);
|
55 |
-
return ret("number", "number");
|
56 |
-
}
|
57 |
-
else if (/\d/.test(ch)) {
|
58 |
-
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
59 |
-
return ret("number", "number");
|
60 |
-
}
|
61 |
-
else if (ch == "/") {
|
62 |
-
if (stream.eat("*")) {
|
63 |
-
return chain(stream, state, jsTokenComment);
|
64 |
-
}
|
65 |
-
else if (stream.eat("/")) {
|
66 |
-
stream.skipToEnd();
|
67 |
-
return ret("comment", "comment");
|
68 |
-
}
|
69 |
-
else if (state.reAllowed) {
|
70 |
-
nextUntilUnescaped(stream, "/");
|
71 |
-
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
72 |
-
return ret("regexp", "string");
|
73 |
-
}
|
74 |
-
else {
|
75 |
-
stream.eatWhile(isOperatorChar);
|
76 |
-
return ret("operator", null, stream.current());
|
77 |
-
}
|
78 |
-
}
|
79 |
-
else if (ch == "#") {
|
80 |
-
stream.skipToEnd();
|
81 |
-
return ret("error", "error");
|
82 |
-
}
|
83 |
-
else if (isOperatorChar.test(ch)) {
|
84 |
-
stream.eatWhile(isOperatorChar);
|
85 |
-
return ret("operator", null, stream.current());
|
86 |
-
}
|
87 |
-
else {
|
88 |
-
stream.eatWhile(/[\w\$_]/);
|
89 |
-
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
90 |
-
return known ? ret(known.type, known.style, word) :
|
91 |
-
ret("variable", "variable", word);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
function jsTokenString(quote) {
|
96 |
-
return function(stream, state) {
|
97 |
-
if (!nextUntilUnescaped(stream, quote))
|
98 |
-
state.tokenize = jsTokenBase;
|
99 |
-
return ret("string", "string");
|
100 |
-
};
|
101 |
-
}
|
102 |
-
|
103 |
-
function jsTokenComment(stream, state) {
|
104 |
-
var maybeEnd = false, ch;
|
105 |
-
while (ch = stream.next()) {
|
106 |
-
if (ch == "/" && maybeEnd) {
|
107 |
-
state.tokenize = jsTokenBase;
|
108 |
-
break;
|
109 |
-
}
|
110 |
-
maybeEnd = (ch == "*");
|
111 |
-
}
|
112 |
-
return ret("comment", "comment");
|
113 |
-
}
|
114 |
-
|
115 |
-
// Parser
|
116 |
-
|
117 |
-
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
|
118 |
-
|
119 |
-
function JSLexical(indented, column, type, align, prev, info) {
|
120 |
-
this.indented = indented;
|
121 |
-
this.column = column;
|
122 |
-
this.type = type;
|
123 |
-
this.prev = prev;
|
124 |
-
this.info = info;
|
125 |
-
if (align != null) this.align = align;
|
126 |
-
}
|
127 |
-
|
128 |
-
function inScope(state, varname) {
|
129 |
-
for (var v = state.localVars; v; v = v.next)
|
130 |
-
if (v.name == varname) return true;
|
131 |
-
}
|
132 |
-
|
133 |
-
function parseJS(state, style, type, content, stream) {
|
134 |
-
var cc = state.cc;
|
135 |
-
// Communicate our context to the combinators.
|
136 |
-
// (Less wasteful than consing up a hundred closures on every call.)
|
137 |
-
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
138 |
-
|
139 |
-
if (!state.lexical.hasOwnProperty("align"))
|
140 |
-
state.lexical.align = true;
|
141 |
-
|
142 |
-
while(true) {
|
143 |
-
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
144 |
-
if (combinator(type, content)) {
|
145 |
-
while(cc.length && cc[cc.length - 1].lex)
|
146 |
-
cc.pop()();
|
147 |
-
if (cx.marked) return cx.marked;
|
148 |
-
if (type == "variable" && inScope(state, content)) return "variable-2";
|
149 |
-
return style;
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
// Combinator utils
|
155 |
-
|
156 |
-
var cx = {state: null, column: null, marked: null, cc: null};
|
157 |
-
function pass() {
|
158 |
-
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
159 |
-
}
|
160 |
-
function cont() {
|
161 |
-
pass.apply(null, arguments);
|
162 |
-
return true;
|
163 |
-
}
|
164 |
-
function register(varname) {
|
165 |
-
var state = cx.state;
|
166 |
-
if (state.context) {
|
167 |
-
cx.marked = "def";
|
168 |
-
for (var v = state.localVars; v; v = v.next)
|
169 |
-
if (v.name == varname) return;
|
170 |
-
state.localVars = {name: varname, next: state.localVars};
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
// Combinators
|
175 |
-
|
176 |
-
var defaultVars = {name: "this", next: {name: "arguments"}};
|
177 |
-
function pushcontext() {
|
178 |
-
if (!cx.state.context) cx.state.localVars = defaultVars;
|
179 |
-
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
180 |
-
}
|
181 |
-
function popcontext() {
|
182 |
-
cx.state.localVars = cx.state.context.vars;
|
183 |
-
cx.state.context = cx.state.context.prev;
|
184 |
-
}
|
185 |
-
function pushlex(type, info) {
|
186 |
-
var result = function() {
|
187 |
-
var state = cx.state;
|
188 |
-
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
|
189 |
-
};
|
190 |
-
result.lex = true;
|
191 |
-
return result;
|
192 |
-
}
|
193 |
-
function poplex() {
|
194 |
-
var state = cx.state;
|
195 |
-
if (state.lexical.prev) {
|
196 |
-
if (state.lexical.type == ")")
|
197 |
-
state.indented = state.lexical.indented;
|
198 |
-
state.lexical = state.lexical.prev;
|
199 |
-
}
|
200 |
-
}
|
201 |
-
poplex.lex = true;
|
202 |
-
|
203 |
-
function expect(wanted) {
|
204 |
-
return function expecting(type) {
|
205 |
-
if (type == wanted) return cont();
|
206 |
-
else if (wanted == ";") return pass();
|
207 |
-
else return cont(arguments.callee);
|
208 |
-
};
|
209 |
-
}
|
210 |
-
|
211 |
-
function statement(type) {
|
212 |
-
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
|
213 |
-
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
214 |
-
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
215 |
-
if (type == "{") return cont(pushlex("}"), block, poplex);
|
216 |
-
if (type == ";") return cont();
|
217 |
-
if (type == "function") return cont(functiondef);
|
218 |
-
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
|
219 |
-
poplex, statement, poplex);
|
220 |
-
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
221 |
-
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
222 |
-
block, poplex, poplex);
|
223 |
-
if (type == "case") return cont(expression, expect(":"));
|
224 |
-
if (type == "default") return cont(expect(":"));
|
225 |
-
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
226 |
-
statement, poplex, popcontext);
|
227 |
-
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
228 |
-
}
|
229 |
-
function expression(type) {
|
230 |
-
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
|
231 |
-
if (type == "function") return cont(functiondef);
|
232 |
-
if (type == "keyword c") return cont(maybeexpression);
|
233 |
-
if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
|
234 |
-
if (type == "operator") return cont(expression);
|
235 |
-
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
|
236 |
-
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
|
237 |
-
return cont();
|
238 |
-
}
|
239 |
-
function maybeexpression(type) {
|
240 |
-
if (type.match(/[;\}\)\],]/)) return pass();
|
241 |
-
return pass(expression);
|
242 |
-
}
|
243 |
-
|
244 |
-
function maybeoperator(type, value) {
|
245 |
-
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
246 |
-
if (type == "operator") return cont(expression);
|
247 |
-
if (type == ";") return;
|
248 |
-
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
|
249 |
-
if (type == ".") return cont(property, maybeoperator);
|
250 |
-
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
|
251 |
-
}
|
252 |
-
function maybelabel(type) {
|
253 |
-
if (type == ":") return cont(poplex, statement);
|
254 |
-
return pass(maybeoperator, expect(";"), poplex);
|
255 |
-
}
|
256 |
-
function property(type) {
|
257 |
-
if (type == "variable") {cx.marked = "property"; return cont();}
|
258 |
-
}
|
259 |
-
function objprop(type) {
|
260 |
-
if (type == "variable") cx.marked = "property";
|
261 |
-
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
|
262 |
-
}
|
263 |
-
function commasep(what, end) {
|
264 |
-
function proceed(type) {
|
265 |
-
if (type == ",") return cont(what, proceed);
|
266 |
-
if (type == end) return cont();
|
267 |
-
return cont(expect(end));
|
268 |
-
}
|
269 |
-
return function commaSeparated(type) {
|
270 |
-
if (type == end) return cont();
|
271 |
-
else return pass(what, proceed);
|
272 |
-
};
|
273 |
-
}
|
274 |
-
function block(type) {
|
275 |
-
if (type == "}") return cont();
|
276 |
-
return pass(statement, block);
|
277 |
-
}
|
278 |
-
function vardef1(type, value) {
|
279 |
-
if (type == "variable"){register(value); return cont(vardef2);}
|
280 |
-
return cont();
|
281 |
-
}
|
282 |
-
function vardef2(type, value) {
|
283 |
-
if (value == "=") return cont(expression, vardef2);
|
284 |
-
if (type == ",") return cont(vardef1);
|
285 |
-
}
|
286 |
-
function forspec1(type) {
|
287 |
-
if (type == "var") return cont(vardef1, forspec2);
|
288 |
-
if (type == ";") return pass(forspec2);
|
289 |
-
if (type == "variable") return cont(formaybein);
|
290 |
-
return pass(forspec2);
|
291 |
-
}
|
292 |
-
function formaybein(type, value) {
|
293 |
-
if (value == "in") return cont(expression);
|
294 |
-
return cont(maybeoperator, forspec2);
|
295 |
-
}
|
296 |
-
function forspec2(type, value) {
|
297 |
-
if (type == ";") return cont(forspec3);
|
298 |
-
if (value == "in") return cont(expression);
|
299 |
-
return cont(expression, expect(";"), forspec3);
|
300 |
-
}
|
301 |
-
function forspec3(type) {
|
302 |
-
if (type != ")") cont(expression);
|
303 |
-
}
|
304 |
-
function functiondef(type, value) {
|
305 |
-
if (type == "variable") {register(value); return cont(functiondef);}
|
306 |
-
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
|
307 |
-
}
|
308 |
-
function funarg(type, value) {
|
309 |
-
if (type == "variable") {register(value); return cont();}
|
310 |
-
}
|
311 |
-
|
312 |
-
// Interface
|
313 |
-
|
314 |
-
return {
|
315 |
-
startState: function(basecolumn) {
|
316 |
-
return {
|
317 |
-
tokenize: jsTokenBase,
|
318 |
-
reAllowed: true,
|
319 |
-
cc: [],
|
320 |
-
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
321 |
-
localVars: null,
|
322 |
-
context: null,
|
323 |
-
indented: 0
|
324 |
-
};
|
325 |
-
},
|
326 |
-
|
327 |
-
token: function(stream, state) {
|
328 |
-
if (stream.sol()) {
|
329 |
-
if (!state.lexical.hasOwnProperty("align"))
|
330 |
-
state.lexical.align = false;
|
331 |
-
state.indented = stream.indentation();
|
332 |
-
}
|
333 |
-
if (stream.eatSpace()) return null;
|
334 |
-
var style = state.tokenize(stream, state);
|
335 |
-
if (type == "comment") return style;
|
336 |
-
state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
|
337 |
-
return parseJS(state, style, type, content, stream);
|
338 |
-
},
|
339 |
-
|
340 |
-
indent: function(state, textAfter) {
|
341 |
-
if (state.tokenize != jsTokenBase) return 0;
|
342 |
-
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
|
343 |
-
type = lexical.type, closing = firstChar == type;
|
344 |
-
if (type == "vardef") return lexical.indented + 4;
|
345 |
-
else if (type == "form" && firstChar == "{") return lexical.indented;
|
346 |
-
else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
|
347 |
-
else if (lexical.info == "switch" && !closing)
|
348 |
-
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
349 |
-
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
350 |
-
else return lexical.indented + (closing ? 0 : indentUnit);
|
351 |
-
},
|
352 |
-
|
353 |
-
electricChars: ":{}"
|
354 |
-
};
|
355 |
-
});
|
356 |
-
|
357 |
-
CodeMirror.defineMIME("text/javascript", "javascript");
|
358 |
-
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/jinja2/index.html
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Jinja2 mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="jinja2.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Jinja2 mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
<html style="color: green">
|
16 |
-
<!-- this is a comment -->
|
17 |
-
<head>
|
18 |
-
<title>Jinja2 Example</title>
|
19 |
-
</head>
|
20 |
-
<body>
|
21 |
-
<ul>
|
22 |
-
{# this is a comment #}
|
23 |
-
{%- for item in li -%}
|
24 |
-
<li>
|
25 |
-
{{ item.label }}
|
26 |
-
</li>
|
27 |
-
{% endfor -%}
|
28 |
-
</ul>
|
29 |
-
</body>
|
30 |
-
</html>
|
31 |
-
</textarea></form>
|
32 |
-
<script>
|
33 |
-
var editor =
|
34 |
-
CodeMirror.fromTextArea(document.getElementById("code"), {mode:
|
35 |
-
{name: "jinja2", htmlMode: true}});
|
36 |
-
</script>
|
37 |
-
</body>
|
38 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/jinja2/jinja2.js
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("jinja2", function(config, parserConf) {
|
2 |
-
var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
|
3 |
-
"loop", "none", "self", "super", "if", "as", "not", "and",
|
4 |
-
"else", "import", "with", "without", "context"];
|
5 |
-
keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
|
6 |
-
|
7 |
-
function tokenBase (stream, state) {
|
8 |
-
var ch = stream.next();
|
9 |
-
if (ch == "{") {
|
10 |
-
if (ch = stream.eat(/\{|%|#/)) {
|
11 |
-
stream.eat("-");
|
12 |
-
state.tokenize = inTag(ch);
|
13 |
-
return "tag";
|
14 |
-
}
|
15 |
-
}
|
16 |
-
}
|
17 |
-
function inTag (close) {
|
18 |
-
if (close == "{") {
|
19 |
-
close = "}";
|
20 |
-
}
|
21 |
-
return function (stream, state) {
|
22 |
-
var ch = stream.next();
|
23 |
-
if ((ch == close || (ch == "-" && stream.eat(close)))
|
24 |
-
&& stream.eat("}")) {
|
25 |
-
state.tokenize = tokenBase;
|
26 |
-
return "tag";
|
27 |
-
}
|
28 |
-
if (stream.match(keywords)) {
|
29 |
-
return "keyword";
|
30 |
-
}
|
31 |
-
return close == "#" ? "comment" : "string";
|
32 |
-
};
|
33 |
-
}
|
34 |
-
return {
|
35 |
-
startState: function () {
|
36 |
-
return {tokenize: tokenBase};
|
37 |
-
},
|
38 |
-
token: function (stream, state) {
|
39 |
-
return state.tokenize(stream, state);
|
40 |
-
}
|
41 |
-
};
|
42 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/lua/index.html
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Lua mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="lua.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/neat.css">
|
9 |
-
<style>.CodeMirror {border: 1px solid black;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Lua mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
--[[
|
16 |
-
example useless code to show lua syntax highlighting
|
17 |
-
this is multiline comment
|
18 |
-
]]
|
19 |
-
|
20 |
-
function blahblahblah(x)
|
21 |
-
|
22 |
-
local table = {
|
23 |
-
"asd" = 123,
|
24 |
-
"x" = 0.34,
|
25 |
-
}
|
26 |
-
if x ~= 3 then
|
27 |
-
print( x )
|
28 |
-
elseif x == "string"
|
29 |
-
my_custom_function( 0x34 )
|
30 |
-
else
|
31 |
-
unknown_function( "some string" )
|
32 |
-
end
|
33 |
-
|
34 |
-
--single line comment
|
35 |
-
|
36 |
-
end
|
37 |
-
|
38 |
-
function blablabla3()
|
39 |
-
|
40 |
-
for k,v in ipairs( table ) do
|
41 |
-
--abcde..
|
42 |
-
y=[=[
|
43 |
-
x=[[
|
44 |
-
x is a multi line string
|
45 |
-
]]
|
46 |
-
but its definition is iside a highest level string!
|
47 |
-
]=]
|
48 |
-
print(" \"\" ")
|
49 |
-
|
50 |
-
s = math.sin( x )
|
51 |
-
end
|
52 |
-
|
53 |
-
end
|
54 |
-
</textarea></form>
|
55 |
-
<script>
|
56 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
57 |
-
tabMode: "indent",
|
58 |
-
matchBrackets: true,
|
59 |
-
theme: "neat"
|
60 |
-
});
|
61 |
-
</script>
|
62 |
-
|
63 |
-
<p>Loosely based on Franciszek
|
64 |
-
Wawrzak's <a href="http://codemirror.net/1/contrib/lua">CodeMirror
|
65 |
-
1 mode</a>. One configuration parameter is
|
66 |
-
supported, <code>specials</code>, to which you can provide an
|
67 |
-
array of strings to have those identifiers highlighted with
|
68 |
-
the <code>lua-special</code> style.</p>
|
69 |
-
<p><strong>MIME types defined:</strong> <code>text/x-lua</code>.</p>
|
70 |
-
|
71 |
-
</body>
|
72 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/lua/lua.js
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
|
2 |
-
// CodeMirror 1 mode.
|
3 |
-
// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
|
4 |
-
|
5 |
-
CodeMirror.defineMode("lua", function(config, parserConfig) {
|
6 |
-
var indentUnit = config.indentUnit;
|
7 |
-
|
8 |
-
function prefixRE(words) {
|
9 |
-
return new RegExp("^(?:" + words.join("|") + ")", "i");
|
10 |
-
}
|
11 |
-
function wordRE(words) {
|
12 |
-
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
13 |
-
}
|
14 |
-
var specials = wordRE(parserConfig.specials || []);
|
15 |
-
|
16 |
-
// long list of standard functions from lua manual
|
17 |
-
var builtins = wordRE([
|
18 |
-
"_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
|
19 |
-
"loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require",
|
20 |
-
"select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall",
|
21 |
-
|
22 |
-
"coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
|
23 |
-
|
24 |
-
"debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
|
25 |
-
"debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
|
26 |
-
"debug.setupvalue","debug.traceback",
|
27 |
-
|
28 |
-
"close","flush","lines","read","seek","setvbuf","write",
|
29 |
-
|
30 |
-
"io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin",
|
31 |
-
"io.stdout","io.tmpfile","io.type","io.write",
|
32 |
-
|
33 |
-
"math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
|
34 |
-
"math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
|
35 |
-
"math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
|
36 |
-
"math.sqrt","math.tan","math.tanh",
|
37 |
-
|
38 |
-
"os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
|
39 |
-
"os.time","os.tmpname",
|
40 |
-
|
41 |
-
"package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload",
|
42 |
-
"package.seeall",
|
43 |
-
|
44 |
-
"string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
|
45 |
-
"string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
|
46 |
-
|
47 |
-
"table.concat","table.insert","table.maxn","table.remove","table.sort"
|
48 |
-
]);
|
49 |
-
var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
|
50 |
-
"true","function", "end", "if", "then", "else", "do",
|
51 |
-
"while", "repeat", "until", "for", "in", "local" ]);
|
52 |
-
|
53 |
-
var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
|
54 |
-
var dedentTokens = wordRE(["end", "until", "\\)", "}"]);
|
55 |
-
var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]);
|
56 |
-
|
57 |
-
function readBracket(stream) {
|
58 |
-
var level = 0;
|
59 |
-
while (stream.eat("=")) ++level;
|
60 |
-
stream.eat("[");
|
61 |
-
return level;
|
62 |
-
}
|
63 |
-
|
64 |
-
function normal(stream, state) {
|
65 |
-
var ch = stream.next();
|
66 |
-
if (ch == "-" && stream.eat("-")) {
|
67 |
-
if (stream.eat("["))
|
68 |
-
return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
|
69 |
-
stream.skipToEnd();
|
70 |
-
return "comment";
|
71 |
-
}
|
72 |
-
if (ch == "\"" || ch == "'")
|
73 |
-
return (state.cur = string(ch))(stream, state);
|
74 |
-
if (ch == "[" && /[\[=]/.test(stream.peek()))
|
75 |
-
return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
|
76 |
-
if (/\d/.test(ch)) {
|
77 |
-
stream.eatWhile(/[\w.%]/);
|
78 |
-
return "number";
|
79 |
-
}
|
80 |
-
if (/[\w_]/.test(ch)) {
|
81 |
-
stream.eatWhile(/[\w\\\-_.]/);
|
82 |
-
return "variable";
|
83 |
-
}
|
84 |
-
return null;
|
85 |
-
}
|
86 |
-
|
87 |
-
function bracketed(level, style) {
|
88 |
-
return function(stream, state) {
|
89 |
-
var curlev = null, ch;
|
90 |
-
while ((ch = stream.next()) != null) {
|
91 |
-
if (curlev == null) {if (ch == "]") curlev = 0;}
|
92 |
-
else if (ch == "=") ++curlev;
|
93 |
-
else if (ch == "]" && curlev == level) { state.cur = normal; break; }
|
94 |
-
else curlev = null;
|
95 |
-
}
|
96 |
-
return style;
|
97 |
-
};
|
98 |
-
}
|
99 |
-
|
100 |
-
function string(quote) {
|
101 |
-
return function(stream, state) {
|
102 |
-
var escaped = false, ch;
|
103 |
-
while ((ch = stream.next()) != null) {
|
104 |
-
if (ch == quote && !escaped) break;
|
105 |
-
escaped = !escaped && ch == "\\";
|
106 |
-
}
|
107 |
-
if (!escaped) state.cur = normal;
|
108 |
-
return "string";
|
109 |
-
};
|
110 |
-
}
|
111 |
-
|
112 |
-
return {
|
113 |
-
startState: function(basecol) {
|
114 |
-
return {basecol: basecol || 0, indentDepth: 0, cur: normal};
|
115 |
-
},
|
116 |
-
|
117 |
-
token: function(stream, state) {
|
118 |
-
if (stream.eatSpace()) return null;
|
119 |
-
var style = state.cur(stream, state);
|
120 |
-
var word = stream.current();
|
121 |
-
if (style == "variable") {
|
122 |
-
if (keywords.test(word)) style = "keyword";
|
123 |
-
else if (builtins.test(word)) style = "builtin";
|
124 |
-
else if (specials.test(word)) style = "variable-2";
|
125 |
-
}
|
126 |
-
if ((style != "comment") && (style != "string")){
|
127 |
-
if (indentTokens.test(word)) ++state.indentDepth;
|
128 |
-
else if (dedentTokens.test(word)) --state.indentDepth;
|
129 |
-
}
|
130 |
-
return style;
|
131 |
-
},
|
132 |
-
|
133 |
-
indent: function(state, textAfter) {
|
134 |
-
var closing = dedentPartial.test(textAfter);
|
135 |
-
return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));
|
136 |
-
}
|
137 |
-
};
|
138 |
-
});
|
139 |
-
|
140 |
-
CodeMirror.defineMIME("text/x-lua", "lua");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/markdown/index.html
DELETED
@@ -1,340 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Markdown mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="../xml/xml.js"></script>
|
8 |
-
<script src="markdown.js"></script>
|
9 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
10 |
-
<link rel="stylesheet" href="markdown.css">
|
11 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
12 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
13 |
-
</head>
|
14 |
-
<body>
|
15 |
-
<h1>CodeMirror 2: Markdown mode</h1>
|
16 |
-
|
17 |
-
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
|
18 |
-
<form><textarea id="code" name="code">
|
19 |
-
Markdown: Basics
|
20 |
-
================
|
21 |
-
|
22 |
-
<ul id="ProjectSubmenu">
|
23 |
-
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
|
24 |
-
<li><a class="selected" title="Markdown Basics">Basics</a></li>
|
25 |
-
<li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
|
26 |
-
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
|
27 |
-
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
|
28 |
-
</ul>
|
29 |
-
|
30 |
-
|
31 |
-
Getting the Gist of Markdown's Formatting Syntax
|
32 |
-
------------------------------------------------
|
33 |
-
|
34 |
-
This page offers a brief overview of what it's like to use Markdown.
|
35 |
-
The [syntax page] [s] provides complete, detailed documentation for
|
36 |
-
every feature, but Markdown should be very easy to pick up simply by
|
37 |
-
looking at a few examples of it in action. The examples on this page
|
38 |
-
are written in a before/after style, showing example syntax and the
|
39 |
-
HTML output produced by Markdown.
|
40 |
-
|
41 |
-
It's also helpful to simply try Markdown out; the [Dingus] [d] is a
|
42 |
-
web application that allows you type your own Markdown-formatted text
|
43 |
-
and translate it to XHTML.
|
44 |
-
|
45 |
-
**Note:** This document is itself written using Markdown; you
|
46 |
-
can [see the source for it by adding '.text' to the URL] [src].
|
47 |
-
|
48 |
-
[s]: /projects/markdown/syntax "Markdown Syntax"
|
49 |
-
[d]: /projects/markdown/dingus "Markdown Dingus"
|
50 |
-
[src]: /projects/markdown/basics.text
|
51 |
-
|
52 |
-
|
53 |
-
## Paragraphs, Headers, Blockquotes ##
|
54 |
-
|
55 |
-
A paragraph is simply one or more consecutive lines of text, separated
|
56 |
-
by one or more blank lines. (A blank line is any line that looks like
|
57 |
-
a blank line -- a line containing nothing but spaces or tabs is
|
58 |
-
considered blank.) Normal paragraphs should not be indented with
|
59 |
-
spaces or tabs.
|
60 |
-
|
61 |
-
Markdown offers two styles of headers: *Setext* and *atx*.
|
62 |
-
Setext-style headers for `<h1>` and `<h2>` are created by
|
63 |
-
"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
|
64 |
-
To create an atx-style header, you put 1-6 hash marks (`#`) at the
|
65 |
-
beginning of the line -- the number of hashes equals the resulting
|
66 |
-
HTML header level.
|
67 |
-
|
68 |
-
Blockquotes are indicated using email-style '`>`' angle brackets.
|
69 |
-
|
70 |
-
Markdown:
|
71 |
-
|
72 |
-
A First Level Header
|
73 |
-
====================
|
74 |
-
|
75 |
-
A Second Level Header
|
76 |
-
---------------------
|
77 |
-
|
78 |
-
Now is the time for all good men to come to
|
79 |
-
the aid of their country. This is just a
|
80 |
-
regular paragraph.
|
81 |
-
|
82 |
-
The quick brown fox jumped over the lazy
|
83 |
-
dog's back.
|
84 |
-
|
85 |
-
### Header 3
|
86 |
-
|
87 |
-
> This is a blockquote.
|
88 |
-
>
|
89 |
-
> This is the second paragraph in the blockquote.
|
90 |
-
>
|
91 |
-
> ## This is an H2 in a blockquote
|
92 |
-
|
93 |
-
|
94 |
-
Output:
|
95 |
-
|
96 |
-
<h1>A First Level Header</h1>
|
97 |
-
|
98 |
-
<h2>A Second Level Header</h2>
|
99 |
-
|
100 |
-
<p>Now is the time for all good men to come to
|
101 |
-
the aid of their country. This is just a
|
102 |
-
regular paragraph.</p>
|
103 |
-
|
104 |
-
<p>The quick brown fox jumped over the lazy
|
105 |
-
dog's back.</p>
|
106 |
-
|
107 |
-
<h3>Header 3</h3>
|
108 |
-
|
109 |
-
<blockquote>
|
110 |
-
<p>This is a blockquote.</p>
|
111 |
-
|
112 |
-
<p>This is the second paragraph in the blockquote.</p>
|
113 |
-
|
114 |
-
<h2>This is an H2 in a blockquote</h2>
|
115 |
-
</blockquote>
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
### Phrase Emphasis ###
|
120 |
-
|
121 |
-
Markdown uses asterisks and underscores to indicate spans of emphasis.
|
122 |
-
|
123 |
-
Markdown:
|
124 |
-
|
125 |
-
Some of these words *are emphasized*.
|
126 |
-
Some of these words _are emphasized also_.
|
127 |
-
|
128 |
-
Use two asterisks for **strong emphasis**.
|
129 |
-
Or, if you prefer, __use two underscores instead__.
|
130 |
-
|
131 |
-
Output:
|
132 |
-
|
133 |
-
<p>Some of these words <em>are emphasized</em>.
|
134 |
-
Some of these words <em>are emphasized also</em>.</p>
|
135 |
-
|
136 |
-
<p>Use two asterisks for <strong>strong emphasis</strong>.
|
137 |
-
Or, if you prefer, <strong>use two underscores instead</strong>.</p>
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
## Lists ##
|
142 |
-
|
143 |
-
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
|
144 |
-
`+`, and `-`) as list markers. These three markers are
|
145 |
-
interchangable; this:
|
146 |
-
|
147 |
-
* Candy.
|
148 |
-
* Gum.
|
149 |
-
* Booze.
|
150 |
-
|
151 |
-
this:
|
152 |
-
|
153 |
-
+ Candy.
|
154 |
-
+ Gum.
|
155 |
-
+ Booze.
|
156 |
-
|
157 |
-
and this:
|
158 |
-
|
159 |
-
- Candy.
|
160 |
-
- Gum.
|
161 |
-
- Booze.
|
162 |
-
|
163 |
-
all produce the same output:
|
164 |
-
|
165 |
-
<ul>
|
166 |
-
<li>Candy.</li>
|
167 |
-
<li>Gum.</li>
|
168 |
-
<li>Booze.</li>
|
169 |
-
</ul>
|
170 |
-
|
171 |
-
Ordered (numbered) lists use regular numbers, followed by periods, as
|
172 |
-
list markers:
|
173 |
-
|
174 |
-
1. Red
|
175 |
-
2. Green
|
176 |
-
3. Blue
|
177 |
-
|
178 |
-
Output:
|
179 |
-
|
180 |
-
<ol>
|
181 |
-
<li>Red</li>
|
182 |
-
<li>Green</li>
|
183 |
-
<li>Blue</li>
|
184 |
-
</ol>
|
185 |
-
|
186 |
-
If you put blank lines between items, you'll get `<p>` tags for the
|
187 |
-
list item text. You can create multi-paragraph list items by indenting
|
188 |
-
the paragraphs by 4 spaces or 1 tab:
|
189 |
-
|
190 |
-
* A list item.
|
191 |
-
|
192 |
-
With multiple paragraphs.
|
193 |
-
|
194 |
-
* Another item in the list.
|
195 |
-
|
196 |
-
Output:
|
197 |
-
|
198 |
-
<ul>
|
199 |
-
<li><p>A list item.</p>
|
200 |
-
<p>With multiple paragraphs.</p></li>
|
201 |
-
<li><p>Another item in the list.</p></li>
|
202 |
-
</ul>
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
### Links ###
|
207 |
-
|
208 |
-
Markdown supports two styles for creating links: *inline* and
|
209 |
-
*reference*. With both styles, you use square brackets to delimit the
|
210 |
-
text you want to turn into a link.
|
211 |
-
|
212 |
-
Inline-style links use parentheses immediately after the link text.
|
213 |
-
For example:
|
214 |
-
|
215 |
-
This is an [example link](http://example.com/).
|
216 |
-
|
217 |
-
Output:
|
218 |
-
|
219 |
-
<p>This is an <a href="http://example.com/">
|
220 |
-
example link</a>.</p>
|
221 |
-
|
222 |
-
Optionally, you may include a title attribute in the parentheses:
|
223 |
-
|
224 |
-
This is an [example link](http://example.com/ "With a Title").
|
225 |
-
|
226 |
-
Output:
|
227 |
-
|
228 |
-
<p>This is an <a href="http://example.com/" title="With a Title">
|
229 |
-
example link</a>.</p>
|
230 |
-
|
231 |
-
Reference-style links allow you to refer to your links by names, which
|
232 |
-
you define elsewhere in your document:
|
233 |
-
|
234 |
-
I get 10 times more traffic from [Google][1] than from
|
235 |
-
[Yahoo][2] or [MSN][3].
|
236 |
-
|
237 |
-
[1]: http://google.com/ "Google"
|
238 |
-
[2]: http://search.yahoo.com/ "Yahoo Search"
|
239 |
-
[3]: http://search.msn.com/ "MSN Search"
|
240 |
-
|
241 |
-
Output:
|
242 |
-
|
243 |
-
<p>I get 10 times more traffic from <a href="http://google.com/"
|
244 |
-
title="Google">Google</a> than from <a href="http://search.yahoo.com/"
|
245 |
-
title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
|
246 |
-
title="MSN Search">MSN</a>.</p>
|
247 |
-
|
248 |
-
The title attribute is optional. Link names may contain letters,
|
249 |
-
numbers and spaces, but are *not* case sensitive:
|
250 |
-
|
251 |
-
I start my morning with a cup of coffee and
|
252 |
-
[The New York Times][NY Times].
|
253 |
-
|
254 |
-
[ny times]: http://www.nytimes.com/
|
255 |
-
|
256 |
-
Output:
|
257 |
-
|
258 |
-
<p>I start my morning with a cup of coffee and
|
259 |
-
<a href="http://www.nytimes.com/">The New York Times</a>.</p>
|
260 |
-
|
261 |
-
|
262 |
-
### Images ###
|
263 |
-
|
264 |
-
Image syntax is very much like link syntax.
|
265 |
-
|
266 |
-
Inline (titles are optional):
|
267 |
-
|
268 |
-
![alt text](/path/to/img.jpg "Title")
|
269 |
-
|
270 |
-
Reference-style:
|
271 |
-
|
272 |
-
![alt text][id]
|
273 |
-
|
274 |
-
[id]: /path/to/img.jpg "Title"
|
275 |
-
|
276 |
-
Both of the above examples produce the same output:
|
277 |
-
|
278 |
-
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
### Code ###
|
283 |
-
|
284 |
-
In a regular paragraph, you can create code span by wrapping text in
|
285 |
-
backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
|
286 |
-
`>`) will automatically be translated into HTML entities. This makes
|
287 |
-
it easy to use Markdown to write about HTML example code:
|
288 |
-
|
289 |
-
I strongly recommend against using any `<blink>` tags.
|
290 |
-
|
291 |
-
I wish SmartyPants used named entities like `&mdash;`
|
292 |
-
instead of decimal-encoded entites like `&#8212;`.
|
293 |
-
|
294 |
-
Output:
|
295 |
-
|
296 |
-
<p>I strongly recommend against using any
|
297 |
-
<code>&lt;blink&gt;</code> tags.</p>
|
298 |
-
|
299 |
-
<p>I wish SmartyPants used named entities like
|
300 |
-
<code>&amp;mdash;</code> instead of decimal-encoded
|
301 |
-
entites like <code>&amp;#8212;</code>.</p>
|
302 |
-
|
303 |
-
|
304 |
-
To specify an entire block of pre-formatted code, indent every line of
|
305 |
-
the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
|
306 |
-
and `>` characters will be escaped automatically.
|
307 |
-
|
308 |
-
Markdown:
|
309 |
-
|
310 |
-
If you want your page to validate under XHTML 1.0 Strict,
|
311 |
-
you've got to put paragraph tags in your blockquotes:
|
312 |
-
|
313 |
-
<blockquote>
|
314 |
-
<p>For example.</p>
|
315 |
-
</blockquote>
|
316 |
-
|
317 |
-
Output:
|
318 |
-
|
319 |
-
<p>If you want your page to validate under XHTML 1.0 Strict,
|
320 |
-
you've got to put paragraph tags in your blockquotes:</p>
|
321 |
-
|
322 |
-
<pre><code>&lt;blockquote&gt;
|
323 |
-
&lt;p&gt;For example.&lt;/p&gt;
|
324 |
-
&lt;/blockquote&gt;
|
325 |
-
</code></pre>
|
326 |
-
</textarea></form>
|
327 |
-
|
328 |
-
<script>
|
329 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
330 |
-
mode: 'markdown',
|
331 |
-
lineNumbers: true,
|
332 |
-
matchBrackets: true,
|
333 |
-
theme: "default"
|
334 |
-
});
|
335 |
-
</script>
|
336 |
-
|
337 |
-
<p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
|
338 |
-
|
339 |
-
</body>
|
340 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/markdown/markdown.css
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
.cm-s-default span.cm-header {color: #2f2f4f; font-weight:bold;}
|
2 |
-
.cm-s-default span.cm-code {color: #666;}
|
3 |
-
.cm-s-default span.cm-quote {color: #090;}
|
4 |
-
.cm-s-default span.cm-list {color: #a50;}
|
5 |
-
.cm-s-default span.cm-hr {color: #999;}
|
6 |
-
.cm-s-default span.cm-linktext {color: #00c; text-decoration: underline;}
|
7 |
-
.cm-s-default span.cm-linkhref {color: #00c;}
|
8 |
-
.cm-s-default span.cm-em {font-style: italic;}
|
9 |
-
.cm-s-default span.cm-strong {font-weight: bold;}
|
10 |
-
.cm-s-default span.cm-emstrong {font-style: italic; font-weight: bold;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/markdown/markdown.js
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
2 |
-
|
3 |
-
var htmlMode = CodeMirror.getMode(cmCfg, { name: 'xml', htmlMode: true });
|
4 |
-
|
5 |
-
var header = 'header'
|
6 |
-
, code = 'code'
|
7 |
-
, quote = 'quote'
|
8 |
-
, list = 'list'
|
9 |
-
, hr = 'hr'
|
10 |
-
, linktext = 'linktext'
|
11 |
-
, linkhref = 'linkhref'
|
12 |
-
, em = 'em'
|
13 |
-
, strong = 'strong'
|
14 |
-
, emstrong = 'emstrong';
|
15 |
-
|
16 |
-
var hrRE = /^[*-=_]/
|
17 |
-
, ulRE = /^[*-+]\s+/
|
18 |
-
, olRE = /^[0-9]\.\s+/
|
19 |
-
, headerRE = /^(?:\={3,}|-{3,})$/
|
20 |
-
, codeRE = /^(k:\t|\s{4,})/
|
21 |
-
, textRE = /^[^\[*_\\<>`]+/;
|
22 |
-
|
23 |
-
function switchInline(stream, state, f) {
|
24 |
-
state.f = state.inline = f;
|
25 |
-
return f(stream, state);
|
26 |
-
}
|
27 |
-
|
28 |
-
function switchBlock(stream, state, f) {
|
29 |
-
state.f = state.block = f;
|
30 |
-
return f(stream, state);
|
31 |
-
}
|
32 |
-
|
33 |
-
|
34 |
-
// Blocks
|
35 |
-
|
36 |
-
function blockNormal(stream, state) {
|
37 |
-
if (stream.match(codeRE)) {
|
38 |
-
stream.skipToEnd();
|
39 |
-
return code;
|
40 |
-
}
|
41 |
-
|
42 |
-
if (stream.eatSpace()) {
|
43 |
-
return null;
|
44 |
-
}
|
45 |
-
|
46 |
-
if (stream.peek() === '#' || stream.match(headerRE)) {
|
47 |
-
stream.skipToEnd();
|
48 |
-
return header;
|
49 |
-
}
|
50 |
-
if (stream.eat('>')) {
|
51 |
-
state.indentation++;
|
52 |
-
return quote;
|
53 |
-
}
|
54 |
-
if (stream.peek() === '[') {
|
55 |
-
return switchInline(stream, state, footnoteLink);
|
56 |
-
}
|
57 |
-
if (hrRE.test(stream.peek())) {
|
58 |
-
var re = new RegExp('(?:\s*['+stream.peek()+']){3,}$');
|
59 |
-
if (stream.match(re, true)) {
|
60 |
-
return hr;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
var match;
|
65 |
-
if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
|
66 |
-
state.indentation += match[0].length;
|
67 |
-
return list;
|
68 |
-
}
|
69 |
-
|
70 |
-
return switchInline(stream, state, state.inline);
|
71 |
-
}
|
72 |
-
|
73 |
-
function htmlBlock(stream, state) {
|
74 |
-
var style = htmlMode.token(stream, state.htmlState);
|
75 |
-
if (style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
|
76 |
-
state.f = inlineNormal;
|
77 |
-
state.block = blockNormal;
|
78 |
-
}
|
79 |
-
return style;
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
// Inline
|
84 |
-
function getType(state) {
|
85 |
-
return state.strong ? (state.em ? emstrong : strong)
|
86 |
-
: (state.em ? em : null);
|
87 |
-
}
|
88 |
-
|
89 |
-
function handleText(stream, state) {
|
90 |
-
if (stream.match(textRE, true)) {
|
91 |
-
return getType(state);
|
92 |
-
}
|
93 |
-
return undefined;
|
94 |
-
}
|
95 |
-
|
96 |
-
function inlineNormal(stream, state) {
|
97 |
-
var style = state.text(stream, state)
|
98 |
-
if (typeof style !== 'undefined')
|
99 |
-
return style;
|
100 |
-
|
101 |
-
var ch = stream.next();
|
102 |
-
|
103 |
-
if (ch === '\\') {
|
104 |
-
stream.next();
|
105 |
-
return getType(state);
|
106 |
-
}
|
107 |
-
if (ch === '`') {
|
108 |
-
return switchInline(stream, state, inlineElement(code, '`'));
|
109 |
-
}
|
110 |
-
if (ch === '[') {
|
111 |
-
return switchInline(stream, state, linkText);
|
112 |
-
}
|
113 |
-
if (ch === '<' && stream.match(/^\w/, false)) {
|
114 |
-
stream.backUp(1);
|
115 |
-
return switchBlock(stream, state, htmlBlock);
|
116 |
-
}
|
117 |
-
|
118 |
-
var t = getType(state);
|
119 |
-
if (ch === '*' || ch === '_') {
|
120 |
-
if (stream.eat(ch)) {
|
121 |
-
return (state.strong = !state.strong) ? getType(state) : t;
|
122 |
-
}
|
123 |
-
return (state.em = !state.em) ? getType(state) : t;
|
124 |
-
}
|
125 |
-
|
126 |
-
return getType(state);
|
127 |
-
}
|
128 |
-
|
129 |
-
function linkText(stream, state) {
|
130 |
-
while (!stream.eol()) {
|
131 |
-
var ch = stream.next();
|
132 |
-
if (ch === '\\') stream.next();
|
133 |
-
if (ch === ']') {
|
134 |
-
state.inline = state.f = linkHref;
|
135 |
-
return linktext;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
return linktext;
|
139 |
-
}
|
140 |
-
|
141 |
-
function linkHref(stream, state) {
|
142 |
-
stream.eatSpace();
|
143 |
-
var ch = stream.next();
|
144 |
-
if (ch === '(' || ch === '[') {
|
145 |
-
return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
|
146 |
-
}
|
147 |
-
return 'error';
|
148 |
-
}
|
149 |
-
|
150 |
-
function footnoteLink(stream, state) {
|
151 |
-
if (stream.match(/^[^\]]*\]:/, true)) {
|
152 |
-
state.f = footnoteUrl;
|
153 |
-
return linktext;
|
154 |
-
}
|
155 |
-
return switchInline(stream, state, inlineNormal);
|
156 |
-
}
|
157 |
-
|
158 |
-
function footnoteUrl(stream, state) {
|
159 |
-
stream.eatSpace();
|
160 |
-
stream.match(/^[^\s]+/, true);
|
161 |
-
state.f = state.inline = inlineNormal;
|
162 |
-
return linkhref;
|
163 |
-
}
|
164 |
-
|
165 |
-
function inlineRE(endChar) {
|
166 |
-
if (!inlineRE[endChar]) {
|
167 |
-
// match any not-escaped-non-endChar and any escaped char
|
168 |
-
// then match endChar or eol
|
169 |
-
inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)');
|
170 |
-
}
|
171 |
-
return inlineRE[endChar];
|
172 |
-
}
|
173 |
-
|
174 |
-
function inlineElement(type, endChar, next) {
|
175 |
-
next = next || inlineNormal;
|
176 |
-
return function(stream, state) {
|
177 |
-
stream.match(inlineRE(endChar));
|
178 |
-
state.inline = state.f = next;
|
179 |
-
return type;
|
180 |
-
};
|
181 |
-
}
|
182 |
-
|
183 |
-
return {
|
184 |
-
startState: function() {
|
185 |
-
return {
|
186 |
-
f: blockNormal,
|
187 |
-
|
188 |
-
block: blockNormal,
|
189 |
-
htmlState: htmlMode.startState(),
|
190 |
-
indentation: 0,
|
191 |
-
|
192 |
-
inline: inlineNormal,
|
193 |
-
text: handleText,
|
194 |
-
em: false,
|
195 |
-
strong: false
|
196 |
-
};
|
197 |
-
},
|
198 |
-
|
199 |
-
copyState: function(s) {
|
200 |
-
return {
|
201 |
-
f: s.f,
|
202 |
-
|
203 |
-
block: s.block,
|
204 |
-
htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
|
205 |
-
indentation: s.indentation,
|
206 |
-
|
207 |
-
inline: s.inline,
|
208 |
-
text: s.text,
|
209 |
-
em: s.em,
|
210 |
-
strong: s.strong
|
211 |
-
};
|
212 |
-
},
|
213 |
-
|
214 |
-
token: function(stream, state) {
|
215 |
-
if (stream.sol()) {
|
216 |
-
state.f = state.block;
|
217 |
-
var previousIndentation = state.indentation
|
218 |
-
, currentIndentation = 0;
|
219 |
-
while (previousIndentation > 0) {
|
220 |
-
if (stream.eat(' ')) {
|
221 |
-
previousIndentation--;
|
222 |
-
currentIndentation++;
|
223 |
-
} else if (previousIndentation >= 4 && stream.eat('\t')) {
|
224 |
-
previousIndentation -= 4;
|
225 |
-
currentIndentation += 4;
|
226 |
-
} else {
|
227 |
-
break;
|
228 |
-
}
|
229 |
-
}
|
230 |
-
state.indentation = currentIndentation;
|
231 |
-
|
232 |
-
if (currentIndentation > 0) return null;
|
233 |
-
}
|
234 |
-
return state.f(stream, state);
|
235 |
-
},
|
236 |
-
|
237 |
-
getType: getType
|
238 |
-
};
|
239 |
-
|
240 |
-
});
|
241 |
-
|
242 |
-
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ntriples/index.html
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: NTriples mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="ntriples.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">
|
11 |
-
.CodeMirror {
|
12 |
-
border: 1px solid #eee;
|
13 |
-
}
|
14 |
-
</style>
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: NTriples mode</h1>
|
18 |
-
<form>
|
19 |
-
<textarea id="ntriples" name="ntriples">
|
20 |
-
<http://Sub1> <http://pred1> <http://obj> .
|
21 |
-
<http://Sub2> <http://pred2#an2> "literal 1" .
|
22 |
-
<http://Sub3#an3> <http://pred3> _:bnode3 .
|
23 |
-
_:bnode4 <http://pred4> "literal 2"@lang .
|
24 |
-
_:bnode5 <http://pred5> "literal 3"^^<http://type> .
|
25 |
-
</textarea>
|
26 |
-
</form>
|
27 |
-
|
28 |
-
<script>
|
29 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("ntriples"), {});
|
30 |
-
</script>
|
31 |
-
<p><strong>MIME types defined:</strong> <code>text/n-triples</code>.</p>
|
32 |
-
</body>
|
33 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ntriples/ntriples.js
DELETED
@@ -1,172 +0,0 @@
|
|
1 |
-
/**********************************************************
|
2 |
-
* This script provides syntax highlighting support for
|
3 |
-
* the Ntriples format.
|
4 |
-
* Ntriples format specification:
|
5 |
-
* http://www.w3.org/TR/rdf-testcases/#ntriples
|
6 |
-
***********************************************************/
|
7 |
-
|
8 |
-
/*
|
9 |
-
The following expression defines the defined ASF grammar transitions.
|
10 |
-
|
11 |
-
pre_subject ->
|
12 |
-
{
|
13 |
-
( writing_subject_uri | writing_bnode_uri )
|
14 |
-
-> pre_predicate
|
15 |
-
-> writing_predicate_uri
|
16 |
-
-> pre_object
|
17 |
-
-> writing_object_uri | writing_object_bnode |
|
18 |
-
(
|
19 |
-
writing_object_literal
|
20 |
-
-> writing_literal_lang | writing_literal_type
|
21 |
-
)
|
22 |
-
-> post_object
|
23 |
-
-> BEGIN
|
24 |
-
} otherwise {
|
25 |
-
-> ERROR
|
26 |
-
}
|
27 |
-
*/
|
28 |
-
CodeMirror.defineMode("ntriples", function() {
|
29 |
-
|
30 |
-
Location = {
|
31 |
-
PRE_SUBJECT : 0,
|
32 |
-
WRITING_SUB_URI : 1,
|
33 |
-
WRITING_BNODE_URI : 2,
|
34 |
-
PRE_PRED : 3,
|
35 |
-
WRITING_PRED_URI : 4,
|
36 |
-
PRE_OBJ : 5,
|
37 |
-
WRITING_OBJ_URI : 6,
|
38 |
-
WRITING_OBJ_BNODE : 7,
|
39 |
-
WRITING_OBJ_LITERAL : 8,
|
40 |
-
WRITING_LIT_LANG : 9,
|
41 |
-
WRITING_LIT_TYPE : 10,
|
42 |
-
POST_OBJ : 11,
|
43 |
-
ERROR : 12
|
44 |
-
};
|
45 |
-
function transitState(currState, c) {
|
46 |
-
var currLocation = currState.location;
|
47 |
-
var ret;
|
48 |
-
|
49 |
-
// Opening.
|
50 |
-
if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI;
|
51 |
-
else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI;
|
52 |
-
else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI;
|
53 |
-
else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI;
|
54 |
-
else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE;
|
55 |
-
else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL;
|
56 |
-
|
57 |
-
// Closing.
|
58 |
-
else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED;
|
59 |
-
else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED;
|
60 |
-
else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ;
|
61 |
-
else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ;
|
62 |
-
else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ;
|
63 |
-
else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ;
|
64 |
-
else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ;
|
65 |
-
else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ;
|
66 |
-
|
67 |
-
// Closing typed and language literal.
|
68 |
-
else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG;
|
69 |
-
else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE;
|
70 |
-
|
71 |
-
// Spaces.
|
72 |
-
else if( c == ' ' &&
|
73 |
-
(
|
74 |
-
currLocation == Location.PRE_SUBJECT ||
|
75 |
-
currLocation == Location.PRE_PRED ||
|
76 |
-
currLocation == Location.PRE_OBJ ||
|
77 |
-
currLocation == Location.POST_OBJ
|
78 |
-
)
|
79 |
-
) ret = currLocation;
|
80 |
-
|
81 |
-
// Reset.
|
82 |
-
else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT;
|
83 |
-
|
84 |
-
// Error
|
85 |
-
else ret = Location.ERROR;
|
86 |
-
|
87 |
-
currState.location=ret;
|
88 |
-
}
|
89 |
-
|
90 |
-
untilSpace = function(c) { return c != ' '; };
|
91 |
-
untilEndURI = function(c) { return c != '>'; };
|
92 |
-
return {
|
93 |
-
startState: function() {
|
94 |
-
return {
|
95 |
-
location : Location.PRE_SUBJECT,
|
96 |
-
uris : [],
|
97 |
-
anchors : [],
|
98 |
-
bnodes : [],
|
99 |
-
langs : [],
|
100 |
-
types : []
|
101 |
-
};
|
102 |
-
},
|
103 |
-
token: function(stream, state) {
|
104 |
-
var ch = stream.next();
|
105 |
-
if(ch == '<') {
|
106 |
-
transitState(state, ch);
|
107 |
-
var parsedURI = '';
|
108 |
-
stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} );
|
109 |
-
state.uris.push(parsedURI);
|
110 |
-
if( stream.match('#', false) ) return 'variable';
|
111 |
-
stream.next();
|
112 |
-
transitState(state, '>');
|
113 |
-
return 'variable';
|
114 |
-
}
|
115 |
-
if(ch == '#') {
|
116 |
-
var parsedAnchor = '';
|
117 |
-
stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false});
|
118 |
-
state.anchors.push(parsedAnchor);
|
119 |
-
return 'variable-2';
|
120 |
-
}
|
121 |
-
if(ch == '>') {
|
122 |
-
transitState(state, '>');
|
123 |
-
return 'variable';
|
124 |
-
}
|
125 |
-
if(ch == '_') {
|
126 |
-
transitState(state, ch);
|
127 |
-
var parsedBNode = '';
|
128 |
-
stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;});
|
129 |
-
state.bnodes.push(parsedBNode);
|
130 |
-
stream.next();
|
131 |
-
transitState(state, ' ');
|
132 |
-
return 'builtin';
|
133 |
-
}
|
134 |
-
if(ch == '"') {
|
135 |
-
transitState(state, ch);
|
136 |
-
stream.eatWhile( function(c) { return c != '"'; } );
|
137 |
-
stream.next();
|
138 |
-
if( stream.peek() != '@' && stream.peek() != '^' ) {
|
139 |
-
transitState(state, '"');
|
140 |
-
}
|
141 |
-
return 'string';
|
142 |
-
}
|
143 |
-
if( ch == '@' ) {
|
144 |
-
transitState(state, '@');
|
145 |
-
var parsedLang = '';
|
146 |
-
stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;});
|
147 |
-
state.langs.push(parsedLang);
|
148 |
-
stream.next();
|
149 |
-
transitState(state, ' ');
|
150 |
-
return 'string-2';
|
151 |
-
}
|
152 |
-
if( ch == '^' ) {
|
153 |
-
stream.next();
|
154 |
-
transitState(state, '^');
|
155 |
-
var parsedType = '';
|
156 |
-
stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} );
|
157 |
-
state.types.push(parsedType);
|
158 |
-
stream.next();
|
159 |
-
transitState(state, '>');
|
160 |
-
return 'variable';
|
161 |
-
}
|
162 |
-
if( ch == ' ' ) {
|
163 |
-
transitState(state, ch);
|
164 |
-
}
|
165 |
-
if( ch == '.' ) {
|
166 |
-
transitState(state, ch);
|
167 |
-
}
|
168 |
-
}
|
169 |
-
};
|
170 |
-
});
|
171 |
-
|
172 |
-
CodeMirror.defineMIME("text/n-triples", "ntriples");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/pascal/LICENSE
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
Copyright (c) 2011 souceLair <support@sourcelair.com>
|
2 |
-
|
3 |
-
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:
|
4 |
-
|
5 |
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6 |
-
|
7 |
-
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/pascal/index.html
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Pascal mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="pascal.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Pascal mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
(* Example Pascal code *)
|
17 |
-
|
18 |
-
while a <> b do writeln('Waiting');
|
19 |
-
|
20 |
-
if a > b then
|
21 |
-
writeln('Condition met')
|
22 |
-
else
|
23 |
-
writeln('Condition not met');
|
24 |
-
|
25 |
-
for i := 1 to 10 do
|
26 |
-
writeln('Iteration: ', i:1);
|
27 |
-
|
28 |
-
repeat
|
29 |
-
a := a + 1
|
30 |
-
until a = 10;
|
31 |
-
|
32 |
-
case i of
|
33 |
-
0: write('zero');
|
34 |
-
1: write('one');
|
35 |
-
2: write('two')
|
36 |
-
end;
|
37 |
-
</textarea></div>
|
38 |
-
|
39 |
-
<script>
|
40 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
41 |
-
lineNumbers: true,
|
42 |
-
matchBrackets: true,
|
43 |
-
mode: "text/x-pascal"
|
44 |
-
});
|
45 |
-
</script>
|
46 |
-
|
47 |
-
<p><strong>MIME types defined:</strong> <code>text/x-pascal</code>.</p>
|
48 |
-
</body>
|
49 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/pascal/pascal.js
DELETED
@@ -1,138 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("pascal", function(config) {
|
2 |
-
function words(str) {
|
3 |
-
var obj = {}, words = str.split(" ");
|
4 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
5 |
-
return obj;
|
6 |
-
}
|
7 |
-
var keywords = words("and array begin case const div do downto else end file for forward integer " +
|
8 |
-
"boolean char function goto if in label mod nil not of or packed procedure " +
|
9 |
-
"program record repeat set string then to type until var while with");
|
10 |
-
var blockKeywords = words("case do else for if switch while struct then of");
|
11 |
-
var atoms = {"null": true};
|
12 |
-
|
13 |
-
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
14 |
-
var curPunc;
|
15 |
-
|
16 |
-
function tokenBase(stream, state) {
|
17 |
-
var ch = stream.next();
|
18 |
-
if (ch == "#" && state.startOfLine) {
|
19 |
-
stream.skipToEnd();
|
20 |
-
return "meta";
|
21 |
-
}
|
22 |
-
if (ch == '"' || ch == "'") {
|
23 |
-
state.tokenize = tokenString(ch);
|
24 |
-
return state.tokenize(stream, state);
|
25 |
-
}
|
26 |
-
if (ch == "(" && stream.eat("*")) {
|
27 |
-
state.tokenize = tokenComment;
|
28 |
-
return tokenComment(stream, state);
|
29 |
-
}
|
30 |
-
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
31 |
-
curPunc = ch;
|
32 |
-
return null
|
33 |
-
}
|
34 |
-
if (/\d/.test(ch)) {
|
35 |
-
stream.eatWhile(/[\w\.]/);
|
36 |
-
return "number";
|
37 |
-
}
|
38 |
-
if (ch == "/") {
|
39 |
-
if (stream.eat("/")) {
|
40 |
-
stream.skipToEnd();
|
41 |
-
return "comment";
|
42 |
-
}
|
43 |
-
}
|
44 |
-
if (isOperatorChar.test(ch)) {
|
45 |
-
stream.eatWhile(isOperatorChar);
|
46 |
-
return "operator";
|
47 |
-
}
|
48 |
-
stream.eatWhile(/[\w\$_]/);
|
49 |
-
var cur = stream.current();
|
50 |
-
if (keywords.propertyIsEnumerable(cur)) {
|
51 |
-
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
52 |
-
return "keyword";
|
53 |
-
}
|
54 |
-
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
55 |
-
return "word";
|
56 |
-
}
|
57 |
-
|
58 |
-
function tokenString(quote) {
|
59 |
-
return function(stream, state) {
|
60 |
-
var escaped = false, next, end = false;
|
61 |
-
while ((next = stream.next()) != null) {
|
62 |
-
if (next == quote && !escaped) {end = true; break;}
|
63 |
-
escaped = !escaped && next == "\\";
|
64 |
-
}
|
65 |
-
if (end || !escaped) state.tokenize = null;
|
66 |
-
return "string";
|
67 |
-
};
|
68 |
-
}
|
69 |
-
|
70 |
-
function tokenComment(stream, state) {
|
71 |
-
var maybeEnd = false, ch;
|
72 |
-
while (ch = stream.next()) {
|
73 |
-
if (ch == ")" && maybeEnd) {
|
74 |
-
state.tokenize = null;
|
75 |
-
break;
|
76 |
-
}
|
77 |
-
maybeEnd = (ch == "*");
|
78 |
-
}
|
79 |
-
return "comment";
|
80 |
-
}
|
81 |
-
|
82 |
-
function Context(indented, column, type, align, prev) {
|
83 |
-
this.indented = indented;
|
84 |
-
this.column = column;
|
85 |
-
this.type = type;
|
86 |
-
this.align = align;
|
87 |
-
this.prev = prev;
|
88 |
-
}
|
89 |
-
function pushContext(state, col, type) {
|
90 |
-
return state.context = new Context(state.indented, col, type, null, state.context);
|
91 |
-
}
|
92 |
-
function popContext(state) {
|
93 |
-
var t = state.context.type;
|
94 |
-
if (t == ")" || t == "]" )
|
95 |
-
state.indented = state.context.indented;
|
96 |
-
return state.context = state.context.prev;
|
97 |
-
}
|
98 |
-
|
99 |
-
// Interface
|
100 |
-
|
101 |
-
return {
|
102 |
-
startState: function(basecolumn) {
|
103 |
-
return {
|
104 |
-
tokenize: null,
|
105 |
-
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
|
106 |
-
indented: 0,
|
107 |
-
startOfLine: true
|
108 |
-
};
|
109 |
-
},
|
110 |
-
|
111 |
-
token: function(stream, state) {
|
112 |
-
var ctx = state.context;
|
113 |
-
if (stream.sol()) {
|
114 |
-
if (ctx.align == null) ctx.align = false;
|
115 |
-
state.indented = stream.indentation();
|
116 |
-
state.startOfLine = true;
|
117 |
-
}
|
118 |
-
if (stream.eatSpace()) return null;
|
119 |
-
curPunc = null;
|
120 |
-
var style = (state.tokenize || tokenBase)(stream, state);
|
121 |
-
if (style == "comment" || style == "meta") return style;
|
122 |
-
if (ctx.align == null) ctx.align = true;
|
123 |
-
|
124 |
-
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
125 |
-
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
126 |
-
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
127 |
-
else if (curPunc == ctx.type) popContext(state);
|
128 |
-
else if ( ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
129 |
-
pushContext(state, stream.column(), "statement");
|
130 |
-
state.startOfLine = false;
|
131 |
-
return style;
|
132 |
-
},
|
133 |
-
|
134 |
-
electricChars: "{}"
|
135 |
-
};
|
136 |
-
});
|
137 |
-
|
138 |
-
CodeMirror.defineMIME("text/x-pascal", "pascal");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/perl/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (C) 2011 by Sabaca <mail@sabaca.com> under the MIT license.
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/perl/index.html
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Perl mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="perl.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Perl mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
#!/usr/bin/perl
|
17 |
-
|
18 |
-
use Something qw(func1 func2);
|
19 |
-
|
20 |
-
# strings
|
21 |
-
my $s1 = qq'single line';
|
22 |
-
our $s2 = q(multi-
|
23 |
-
line);
|
24 |
-
|
25 |
-
=item Something
|
26 |
-
Example.
|
27 |
-
=cut
|
28 |
-
|
29 |
-
my $html=<<'HTML'
|
30 |
-
<html>
|
31 |
-
<title>hi!</title>
|
32 |
-
</html>
|
33 |
-
HTML
|
34 |
-
|
35 |
-
print "first,".join(',', 'second', qq~third~);
|
36 |
-
|
37 |
-
if($s1 =~ m[(?<!\s)(l.ne)\z]o) {
|
38 |
-
$h->{$1}=$$.' predefined variables';
|
39 |
-
$s2 =~ s/\-line//ox;
|
40 |
-
$s1 =~ s[
|
41 |
-
line ]
|
42 |
-
[
|
43 |
-
block
|
44 |
-
]ox;
|
45 |
-
}
|
46 |
-
|
47 |
-
1; # numbers and comments
|
48 |
-
|
49 |
-
__END__
|
50 |
-
something...
|
51 |
-
|
52 |
-
</textarea></div>
|
53 |
-
|
54 |
-
<script>
|
55 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
56 |
-
lineNumbers: true,
|
57 |
-
matchBrackets: true
|
58 |
-
});
|
59 |
-
</script>
|
60 |
-
|
61 |
-
<p><strong>MIME types defined:</strong> <code>text/x-perl</code>.</p>
|
62 |
-
</body>
|
63 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/perl/perl.js
DELETED
@@ -1,816 +0,0 @@
|
|
1 |
-
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
|
2 |
-
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
|
3 |
-
CodeMirror.defineMode("perl",function(config,parserConfig){
|
4 |
-
// http://perldoc.perl.org
|
5 |
-
var PERL={ // null - magic touch
|
6 |
-
// 1 - keyword
|
7 |
-
// 2 - def
|
8 |
-
// 3 - atom
|
9 |
-
// 4 - operator
|
10 |
-
// 5 - variable-2 (predefined)
|
11 |
-
// [x,y] - x=1,2,3; y=must be defined if x{...}
|
12 |
-
// PERL operators
|
13 |
-
'->' : 4,
|
14 |
-
'++' : 4,
|
15 |
-
'--' : 4,
|
16 |
-
'**' : 4,
|
17 |
-
// ! ~ \ and unary + and -
|
18 |
-
'=~' : 4,
|
19 |
-
'!~' : 4,
|
20 |
-
'*' : 4,
|
21 |
-
'/' : 4,
|
22 |
-
'%' : 4,
|
23 |
-
'x' : 4,
|
24 |
-
'+' : 4,
|
25 |
-
'-' : 4,
|
26 |
-
'.' : 4,
|
27 |
-
'<<' : 4,
|
28 |
-
'>>' : 4,
|
29 |
-
// named unary operators
|
30 |
-
'<' : 4,
|
31 |
-
'>' : 4,
|
32 |
-
'<=' : 4,
|
33 |
-
'>=' : 4,
|
34 |
-
'lt' : 4,
|
35 |
-
'gt' : 4,
|
36 |
-
'le' : 4,
|
37 |
-
'ge' : 4,
|
38 |
-
'==' : 4,
|
39 |
-
'!=' : 4,
|
40 |
-
'<=>' : 4,
|
41 |
-
'eq' : 4,
|
42 |
-
'ne' : 4,
|
43 |
-
'cmp' : 4,
|
44 |
-
'~~' : 4,
|
45 |
-
'&' : 4,
|
46 |
-
'|' : 4,
|
47 |
-
'^' : 4,
|
48 |
-
'&&' : 4,
|
49 |
-
'||' : 4,
|
50 |
-
'//' : 4,
|
51 |
-
'..' : 4,
|
52 |
-
'...' : 4,
|
53 |
-
'?' : 4,
|
54 |
-
':' : 4,
|
55 |
-
'=' : 4,
|
56 |
-
'+=' : 4,
|
57 |
-
'-=' : 4,
|
58 |
-
'*=' : 4, // etc. ???
|
59 |
-
',' : 4,
|
60 |
-
'=>' : 4,
|
61 |
-
'::' : 4,
|
62 |
-
// list operators (rightward)
|
63 |
-
'not' : 4,
|
64 |
-
'and' : 4,
|
65 |
-
'or' : 4,
|
66 |
-
'xor' : 4,
|
67 |
-
// PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;)
|
68 |
-
'BEGIN' : [5,1],
|
69 |
-
'END' : [5,1],
|
70 |
-
'PRINT' : [5,1],
|
71 |
-
'PRINTF' : [5,1],
|
72 |
-
'GETC' : [5,1],
|
73 |
-
'READ' : [5,1],
|
74 |
-
'READLINE' : [5,1],
|
75 |
-
'DESTROY' : [5,1],
|
76 |
-
'TIE' : [5,1],
|
77 |
-
'TIEHANDLE' : [5,1],
|
78 |
-
'UNTIE' : [5,1],
|
79 |
-
'STDIN' : 5,
|
80 |
-
'STDIN_TOP' : 5,
|
81 |
-
'STDOUT' : 5,
|
82 |
-
'STDOUT_TOP' : 5,
|
83 |
-
'STDERR' : 5,
|
84 |
-
'STDERR_TOP' : 5,
|
85 |
-
'$ARG' : 5,
|
86 |
-
'$_' : 5,
|
87 |
-
'@ARG' : 5,
|
88 |
-
'@_' : 5,
|
89 |
-
'$LIST_SEPARATOR' : 5,
|
90 |
-
'$"' : 5,
|
91 |
-
'$PROCESS_ID' : 5,
|
92 |
-
'$PID' : 5,
|
93 |
-
'$$' : 5,
|
94 |
-
'$REAL_GROUP_ID' : 5,
|
95 |
-
'$GID' : 5,
|
96 |
-
'$(' : 5,
|
97 |
-
'$EFFECTIVE_GROUP_ID' : 5,
|
98 |
-
'$EGID' : 5,
|
99 |
-
'$)' : 5,
|
100 |
-
'$PROGRAM_NAME' : 5,
|
101 |
-
'$0' : 5,
|
102 |
-
'$SUBSCRIPT_SEPARATOR' : 5,
|
103 |
-
'$SUBSEP' : 5,
|
104 |
-
'$;' : 5,
|
105 |
-
'$REAL_USER_ID' : 5,
|
106 |
-
'$UID' : 5,
|
107 |
-
'$<' : 5,
|
108 |
-
'$EFFECTIVE_USER_ID' : 5,
|
109 |
-
'$EUID' : 5,
|
110 |
-
'$>' : 5,
|
111 |
-
'$a' : 5,
|
112 |
-
'$b' : 5,
|
113 |
-
'$COMPILING' : 5,
|
114 |
-
'$^C' : 5,
|
115 |
-
'$DEBUGGING' : 5,
|
116 |
-
'$^D' : 5,
|
117 |
-
'${^ENCODING}' : 5,
|
118 |
-
'$ENV' : 5,
|
119 |
-
'%ENV' : 5,
|
120 |
-
'$SYSTEM_FD_MAX' : 5,
|
121 |
-
'$^F' : 5,
|
122 |
-
'@F' : 5,
|
123 |
-
'${^GLOBAL_PHASE}' : 5,
|
124 |
-
'$^H' : 5,
|
125 |
-
'%^H' : 5,
|
126 |
-
'@INC' : 5,
|
127 |
-
'%INC' : 5,
|
128 |
-
'$INPLACE_EDIT' : 5,
|
129 |
-
'$^I' : 5,
|
130 |
-
'$^M' : 5,
|
131 |
-
'$OSNAME' : 5,
|
132 |
-
'$^O' : 5,
|
133 |
-
'${^OPEN}' : 5,
|
134 |
-
'$PERLDB' : 5,
|
135 |
-
'$^P' : 5,
|
136 |
-
'$SIG' : 5,
|
137 |
-
'%SIG' : 5,
|
138 |
-
'$BASETIME' : 5,
|
139 |
-
'$^T' : 5,
|
140 |
-
'${^TAINT}' : 5,
|
141 |
-
'${^UNICODE}' : 5,
|
142 |
-
'${^UTF8CACHE}' : 5,
|
143 |
-
'${^UTF8LOCALE}' : 5,
|
144 |
-
'$PERL_VERSION' : 5,
|
145 |
-
'$^V' : 5,
|
146 |
-
'${^WIN32_SLOPPY_STAT}' : 5,
|
147 |
-
'$EXECUTABLE_NAME' : 5,
|
148 |
-
'$^X' : 5,
|
149 |
-
'$1' : 5, // - regexp $1, $2...
|
150 |
-
'$MATCH' : 5,
|
151 |
-
'$&' : 5,
|
152 |
-
'${^MATCH}' : 5,
|
153 |
-
'$PREMATCH' : 5,
|
154 |
-
'$`' : 5,
|
155 |
-
'${^PREMATCH}' : 5,
|
156 |
-
'$POSTMATCH' : 5,
|
157 |
-
"$'" : 5,
|
158 |
-
'${^POSTMATCH}' : 5,
|
159 |
-
'$LAST_PAREN_MATCH' : 5,
|
160 |
-
'$+' : 5,
|
161 |
-
'$LAST_SUBMATCH_RESULT' : 5,
|
162 |
-
'$^N' : 5,
|
163 |
-
'@LAST_MATCH_END' : 5,
|
164 |
-
'@+' : 5,
|
165 |
-
'%LAST_PAREN_MATCH' : 5,
|
166 |
-
'%+' : 5,
|
167 |
-
'@LAST_MATCH_START' : 5,
|
168 |
-
'@-' : 5,
|
169 |
-
'%LAST_MATCH_START' : 5,
|
170 |
-
'%-' : 5,
|
171 |
-
'$LAST_REGEXP_CODE_RESULT' : 5,
|
172 |
-
'$^R' : 5,
|
173 |
-
'${^RE_DEBUG_FLAGS}' : 5,
|
174 |
-
'${^RE_TRIE_MAXBUF}' : 5,
|
175 |
-
'$ARGV' : 5,
|
176 |
-
'@ARGV' : 5,
|
177 |
-
'ARGV' : 5,
|
178 |
-
'ARGVOUT' : 5,
|
179 |
-
'$OUTPUT_FIELD_SEPARATOR' : 5,
|
180 |
-
'$OFS' : 5,
|
181 |
-
'$,' : 5,
|
182 |
-
'$INPUT_LINE_NUMBER' : 5,
|
183 |
-
'$NR' : 5,
|
184 |
-
'$.' : 5,
|
185 |
-
'$INPUT_RECORD_SEPARATOR' : 5,
|
186 |
-
'$RS' : 5,
|
187 |
-
'$/' : 5,
|
188 |
-
'$OUTPUT_RECORD_SEPARATOR' : 5,
|
189 |
-
'$ORS' : 5,
|
190 |
-
'$\\' : 5,
|
191 |
-
'$OUTPUT_AUTOFLUSH' : 5,
|
192 |
-
'$|' : 5,
|
193 |
-
'$ACCUMULATOR' : 5,
|
194 |
-
'$^A' : 5,
|
195 |
-
'$FORMAT_FORMFEED' : 5,
|
196 |
-
'$^L' : 5,
|
197 |
-
'$FORMAT_PAGE_NUMBER' : 5,
|
198 |
-
'$%' : 5,
|
199 |
-
'$FORMAT_LINES_LEFT' : 5,
|
200 |
-
'$-' : 5,
|
201 |
-
'$FORMAT_LINE_BREAK_CHARACTERS' : 5,
|
202 |
-
'$:' : 5,
|
203 |
-
'$FORMAT_LINES_PER_PAGE' : 5,
|
204 |
-
'$=' : 5,
|
205 |
-
'$FORMAT_TOP_NAME' : 5,
|
206 |
-
'$^' : 5,
|
207 |
-
'$FORMAT_NAME' : 5,
|
208 |
-
'$~' : 5,
|
209 |
-
'${^CHILD_ERROR_NATIVE}' : 5,
|
210 |
-
'$EXTENDED_OS_ERROR' : 5,
|
211 |
-
'$^E' : 5,
|
212 |
-
'$EXCEPTIONS_BEING_CAUGHT' : 5,
|
213 |
-
'$^S' : 5,
|
214 |
-
'$WARNING' : 5,
|
215 |
-
'$^W' : 5,
|
216 |
-
'${^WARNING_BITS}' : 5,
|
217 |
-
'$OS_ERROR' : 5,
|
218 |
-
'$ERRNO' : 5,
|
219 |
-
'$!' : 5,
|
220 |
-
'%OS_ERROR' : 5,
|
221 |
-
'%ERRNO' : 5,
|
222 |
-
'%!' : 5,
|
223 |
-
'$CHILD_ERROR' : 5,
|
224 |
-
'$?' : 5,
|
225 |
-
'$EVAL_ERROR' : 5,
|
226 |
-
'$@' : 5,
|
227 |
-
'$OFMT' : 5,
|
228 |
-
'$#' : 5,
|
229 |
-
'$*' : 5,
|
230 |
-
'$ARRAY_BASE' : 5,
|
231 |
-
'$[' : 5,
|
232 |
-
'$OLD_PERL_VERSION' : 5,
|
233 |
-
'$]' : 5,
|
234 |
-
// PERL blocks
|
235 |
-
'if' :[1,1],
|
236 |
-
elsif :[1,1],
|
237 |
-
'else' :[1,1],
|
238 |
-
'while' :[1,1],
|
239 |
-
unless :[1,1],
|
240 |
-
'for' :[1,1],
|
241 |
-
foreach :[1,1],
|
242 |
-
// PERL functions
|
243 |
-
'abs' :1, // - absolute value function
|
244 |
-
accept :1, // - accept an incoming socket connect
|
245 |
-
alarm :1, // - schedule a SIGALRM
|
246 |
-
'atan2' :1, // - arctangent of Y/X in the range -PI to PI
|
247 |
-
bind :1, // - binds an address to a socket
|
248 |
-
binmode :1, // - prepare binary files for I/O
|
249 |
-
bless :1, // - create an object
|
250 |
-
bootstrap :1, //
|
251 |
-
'break' :1, // - break out of a "given" block
|
252 |
-
caller :1, // - get context of the current subroutine call
|
253 |
-
chdir :1, // - change your current working directory
|
254 |
-
chmod :1, // - changes the permissions on a list of files
|
255 |
-
chomp :1, // - remove a trailing record separator from a string
|
256 |
-
chop :1, // - remove the last character from a string
|
257 |
-
chown :1, // - change the owership on a list of files
|
258 |
-
chr :1, // - get character this number represents
|
259 |
-
chroot :1, // - make directory new root for path lookups
|
260 |
-
close :1, // - close file (or pipe or socket) handle
|
261 |
-
closedir :1, // - close directory handle
|
262 |
-
connect :1, // - connect to a remote socket
|
263 |
-
'continue' :[1,1], // - optional trailing block in a while or foreach
|
264 |
-
'cos' :1, // - cosine function
|
265 |
-
crypt :1, // - one-way passwd-style encryption
|
266 |
-
dbmclose :1, // - breaks binding on a tied dbm file
|
267 |
-
dbmopen :1, // - create binding on a tied dbm file
|
268 |
-
'default' :1, //
|
269 |
-
defined :1, // - test whether a value, variable, or function is defined
|
270 |
-
'delete' :1, // - deletes a value from a hash
|
271 |
-
die :1, // - raise an exception or bail out
|
272 |
-
'do' :1, // - turn a BLOCK into a TERM
|
273 |
-
dump :1, // - create an immediate core dump
|
274 |
-
each :1, // - retrieve the next key/value pair from a hash
|
275 |
-
endgrent :1, // - be done using group file
|
276 |
-
endhostent :1, // - be done using hosts file
|
277 |
-
endnetent :1, // - be done using networks file
|
278 |
-
endprotoent :1, // - be done using protocols file
|
279 |
-
endpwent :1, // - be done using passwd file
|
280 |
-
endservent :1, // - be done using services file
|
281 |
-
eof :1, // - test a filehandle for its end
|
282 |
-
'eval' :1, // - catch exceptions or compile and run code
|
283 |
-
'exec' :1, // - abandon this program to run another
|
284 |
-
exists :1, // - test whether a hash key is present
|
285 |
-
exit :1, // - terminate this program
|
286 |
-
'exp' :1, // - raise I to a power
|
287 |
-
fcntl :1, // - file control system call
|
288 |
-
fileno :1, // - return file descriptor from filehandle
|
289 |
-
flock :1, // - lock an entire file with an advisory lock
|
290 |
-
fork :1, // - create a new process just like this one
|
291 |
-
format :1, // - declare a picture format with use by the write() function
|
292 |
-
formline :1, // - internal function used for formats
|
293 |
-
getc :1, // - get the next character from the filehandle
|
294 |
-
getgrent :1, // - get next group record
|
295 |
-
getgrgid :1, // - get group record given group user ID
|
296 |
-
getgrnam :1, // - get group record given group name
|
297 |
-
gethostbyaddr :1, // - get host record given its address
|
298 |
-
gethostbyname :1, // - get host record given name
|
299 |
-
gethostent :1, // - get next hosts record
|
300 |
-
getlogin :1, // - return who logged in at this tty
|
301 |
-
getnetbyaddr :1, // - get network record given its address
|
302 |
-
getnetbyname :1, // - get networks record given name
|
303 |
-
getnetent :1, // - get next networks record
|
304 |
-
getpeername :1, // - find the other end of a socket connection
|
305 |
-
getpgrp :1, // - get process group
|
306 |
-
getppid :1, // - get parent process ID
|
307 |
-
getpriority :1, // - get current nice value
|
308 |
-
getprotobyname :1, // - get protocol record given name
|
309 |
-
getprotobynumber :1, // - get protocol record numeric protocol
|
310 |
-
getprotoent :1, // - get next protocols record
|
311 |
-
getpwent :1, // - get next passwd record
|
312 |
-
getpwnam :1, // - get passwd record given user login name
|
313 |
-
getpwuid :1, // - get passwd record given user ID
|
314 |
-
getservbyname :1, // - get services record given its name
|
315 |
-
getservbyport :1, // - get services record given numeric port
|
316 |
-
getservent :1, // - get next services record
|
317 |
-
getsockname :1, // - retrieve the sockaddr for a given socket
|
318 |
-
getsockopt :1, // - get socket options on a given socket
|
319 |
-
given :1, //
|
320 |
-
glob :1, // - expand filenames using wildcards
|
321 |
-
gmtime :1, // - convert UNIX time into record or string using Greenwich time
|
322 |
-
'goto' :1, // - create spaghetti code
|
323 |
-
grep :1, // - locate elements in a list test true against a given criterion
|
324 |
-
hex :1, // - convert a string to a hexadecimal number
|
325 |
-
'import' :1, // - patch a module's namespace into your own
|
326 |
-
index :1, // - find a substring within a string
|
327 |
-
int :1, // - get the integer portion of a number
|
328 |
-
ioctl :1, // - system-dependent device control system call
|
329 |
-
'join' :1, // - join a list into a string using a separator
|
330 |
-
keys :1, // - retrieve list of indices from a hash
|
331 |
-
kill :1, // - send a signal to a process or process group
|
332 |
-
last :1, // - exit a block prematurely
|
333 |
-
lc :1, // - return lower-case version of a string
|
334 |
-
lcfirst :1, // - return a string with just the next letter in lower case
|
335 |
-
length :1, // - return the number of bytes in a string
|
336 |
-
'link' :1, // - create a hard link in the filesytem
|
337 |
-
listen :1, // - register your socket as a server
|
338 |
-
local : 2, // - create a temporary value for a global variable (dynamic scoping)
|
339 |
-
localtime :1, // - convert UNIX time into record or string using local time
|
340 |
-
lock :1, // - get a thread lock on a variable, subroutine, or method
|
341 |
-
'log' :1, // - retrieve the natural logarithm for a number
|
342 |
-
lstat :1, // - stat a symbolic link
|
343 |
-
m :null, // - match a string with a regular expression pattern
|
344 |
-
map :1, // - apply a change to a list to get back a new list with the changes
|
345 |
-
mkdir :1, // - create a directory
|
346 |
-
msgctl :1, // - SysV IPC message control operations
|
347 |
-
msgget :1, // - get SysV IPC message queue
|
348 |
-
msgrcv :1, // - receive a SysV IPC message from a message queue
|
349 |
-
msgsnd :1, // - send a SysV IPC message to a message queue
|
350 |
-
my : 2, // - declare and assign a local variable (lexical scoping)
|
351 |
-
'new' :1, //
|
352 |
-
next :1, // - iterate a block prematurely
|
353 |
-
no :1, // - unimport some module symbols or semantics at compile time
|
354 |
-
oct :1, // - convert a string to an octal number
|
355 |
-
open :1, // - open a file, pipe, or descriptor
|
356 |
-
opendir :1, // - open a directory
|
357 |
-
ord :1, // - find a character's numeric representation
|
358 |
-
our : 2, // - declare and assign a package variable (lexical scoping)
|
359 |
-
pack :1, // - convert a list into a binary representation
|
360 |
-
'package' :1, // - declare a separate global namespace
|
361 |
-
pipe :1, // - open a pair of connected filehandles
|
362 |
-
pop :1, // - remove the last element from an array and return it
|
363 |
-
pos :1, // - find or set the offset for the last/next m//g search
|
364 |
-
print :1, // - output a list to a filehandle
|
365 |
-
printf :1, // - output a formatted list to a filehandle
|
366 |
-
prototype :1, // - get the prototype (if any) of a subroutine
|
367 |
-
push :1, // - append one or more elements to an array
|
368 |
-
q :null, // - singly quote a string
|
369 |
-
qq :null, // - doubly quote a string
|
370 |
-
qr :null, // - Compile pattern
|
371 |
-
quotemeta :null, // - quote regular expression magic characters
|
372 |
-
qw :null, // - quote a list of words
|
373 |
-
qx :null, // - backquote quote a string
|
374 |
-
rand :1, // - retrieve the next pseudorandom number
|
375 |
-
read :1, // - fixed-length buffered input from a filehandle
|
376 |
-
readdir :1, // - get a directory from a directory handle
|
377 |
-
readline :1, // - fetch a record from a file
|
378 |
-
readlink :1, // - determine where a symbolic link is pointing
|
379 |
-
readpipe :1, // - execute a system command and collect standard output
|
380 |
-
recv :1, // - receive a message over a Socket
|
381 |
-
redo :1, // - start this loop iteration over again
|
382 |
-
ref :1, // - find out the type of thing being referenced
|
383 |
-
rename :1, // - change a filename
|
384 |
-
require :1, // - load in external functions from a library at runtime
|
385 |
-
reset :1, // - clear all variables of a given name
|
386 |
-
'return' :1, // - get out of a function early
|
387 |
-
reverse :1, // - flip a string or a list
|
388 |
-
rewinddir :1, // - reset directory handle
|
389 |
-
rindex :1, // - right-to-left substring search
|
390 |
-
rmdir :1, // - remove a directory
|
391 |
-
s :null, // - replace a pattern with a string
|
392 |
-
say :1, // - print with newline
|
393 |
-
scalar :1, // - force a scalar context
|
394 |
-
seek :1, // - reposition file pointer for random-access I/O
|
395 |
-
seekdir :1, // - reposition directory pointer
|
396 |
-
select :1, // - reset default output or do I/O multiplexing
|
397 |
-
semctl :1, // - SysV semaphore control operations
|
398 |
-
semget :1, // - get set of SysV semaphores
|
399 |
-
semop :1, // - SysV semaphore operations
|
400 |
-
send :1, // - send a message over a socket
|
401 |
-
setgrent :1, // - prepare group file for use
|
402 |
-
sethostent :1, // - prepare hosts file for use
|
403 |
-
setnetent :1, // - prepare networks file for use
|
404 |
-
setpgrp :1, // - set the process group of a process
|
405 |
-
setpriority :1, // - set a process's nice value
|
406 |
-
setprotoent :1, // - prepare protocols file for use
|
407 |
-
setpwent :1, // - prepare passwd file for use
|
408 |
-
setservent :1, // - prepare services file for use
|
409 |
-
setsockopt :1, // - set some socket options
|
410 |
-
shift :1, // - remove the first element of an array, and return it
|
411 |
-
shmctl :1, // - SysV shared memory operations
|
412 |
-
shmget :1, // - get SysV shared memory segment identifier
|
413 |
-
shmread :1, // - read SysV shared memory
|
414 |
-
shmwrite :1, // - write SysV shared memory
|
415 |
-
shutdown :1, // - close down just half of a socket connection
|
416 |
-
'sin' :1, // - return the sine of a number
|
417 |
-
sleep :1, // - block for some number of seconds
|
418 |
-
socket :1, // - create a socket
|
419 |
-
socketpair :1, // - create a pair of sockets
|
420 |
-
'sort' :1, // - sort a list of values
|
421 |
-
splice :1, // - add or remove elements anywhere in an array
|
422 |
-
'split' :1, // - split up a string using a regexp delimiter
|
423 |
-
sprintf :1, // - formatted print into a string
|
424 |
-
'sqrt' :1, // - square root function
|
425 |
-
srand :1, // - seed the random number generator
|
426 |
-
stat :1, // - get a file's status information
|
427 |
-
state :1, // - declare and assign a state variable (persistent lexical scoping)
|
428 |
-
study :1, // - optimize input data for repeated searches
|
429 |
-
'sub' :1, // - declare a subroutine, possibly anonymously
|
430 |
-
'substr' :1, // - get or alter a portion of a stirng
|
431 |
-
symlink :1, // - create a symbolic link to a file
|
432 |
-
syscall :1, // - execute an arbitrary system call
|
433 |
-
sysopen :1, // - open a file, pipe, or descriptor
|
434 |
-
sysread :1, // - fixed-length unbuffered input from a filehandle
|
435 |
-
sysseek :1, // - position I/O pointer on handle used with sysread and syswrite
|
436 |
-
system :1, // - run a separate program
|
437 |
-
syswrite :1, // - fixed-length unbuffered output to a filehandle
|
438 |
-
tell :1, // - get current seekpointer on a filehandle
|
439 |
-
telldir :1, // - get current seekpointer on a directory handle
|
440 |
-
tie :1, // - bind a variable to an object class
|
441 |
-
tied :1, // - get a reference to the object underlying a tied variable
|
442 |
-
time :1, // - return number of seconds since 1970
|
443 |
-
times :1, // - return elapsed time for self and child processes
|
444 |
-
tr :null, // - transliterate a string
|
445 |
-
truncate :1, // - shorten a file
|
446 |
-
uc :1, // - return upper-case version of a string
|
447 |
-
ucfirst :1, // - return a string with just the next letter in upper case
|
448 |
-
umask :1, // - set file creation mode mask
|
449 |
-
undef :1, // - remove a variable or function definition
|
450 |
-
unlink :1, // - remove one link to a file
|
451 |
-
unpack :1, // - convert binary structure into normal perl variables
|
452 |
-
unshift :1, // - prepend more elements to the beginning of a list
|
453 |
-
untie :1, // - break a tie binding to a variable
|
454 |
-
use :1, // - load in a module at compile time
|
455 |
-
utime :1, // - set a file's last access and modify times
|
456 |
-
values :1, // - return a list of the values in a hash
|
457 |
-
vec :1, // - test or set particular bits in a string
|
458 |
-
wait :1, // - wait for any child process to die
|
459 |
-
waitpid :1, // - wait for a particular child process to die
|
460 |
-
wantarray :1, // - get void vs scalar vs list context of current subroutine call
|
461 |
-
warn :1, // - print debugging info
|
462 |
-
when :1, //
|
463 |
-
write :1, // - print a picture record
|
464 |
-
y :null}; // - transliterate a string
|
465 |
-
|
466 |
-
var RXstyle="string-2";
|
467 |
-
var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type
|
468 |
-
|
469 |
-
function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;)
|
470 |
-
state.chain=null; // 12 3tail
|
471 |
-
state.style=null;
|
472 |
-
state.tail=null;
|
473 |
-
state.tokenize=function(stream,state){
|
474 |
-
var e=false,c,i=0;
|
475 |
-
while(c=stream.next()){
|
476 |
-
if(c===chain[i]&&!e){
|
477 |
-
if(chain[++i]!==undefined){
|
478 |
-
state.chain=chain[i];
|
479 |
-
state.style=style;
|
480 |
-
state.tail=tail}
|
481 |
-
else if(tail)
|
482 |
-
stream.eatWhile(tail);
|
483 |
-
state.tokenize=tokenPerl;
|
484 |
-
return style}
|
485 |
-
e=!e&&c=="\\"}
|
486 |
-
return style};
|
487 |
-
return state.tokenize(stream,state)}
|
488 |
-
|
489 |
-
function tokenSOMETHING(stream,state,string){
|
490 |
-
state.tokenize=function(stream,state){
|
491 |
-
if(stream.string==string)
|
492 |
-
state.tokenize=tokenPerl;
|
493 |
-
stream.skipToEnd();
|
494 |
-
return "string"};
|
495 |
-
return state.tokenize(stream,state)}
|
496 |
-
|
497 |
-
function tokenPerl(stream,state){
|
498 |
-
if(stream.eatSpace())
|
499 |
-
return null;
|
500 |
-
if(state.chain)
|
501 |
-
return tokenChain(stream,state,state.chain,state.style,state.tail);
|
502 |
-
if(stream.match(/^\-?[\d\.]/,false))
|
503 |
-
if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))
|
504 |
-
return 'number';
|
505 |
-
if(stream.match(/^<<(?=\w)/)){ // NOTE: <<SOMETHING\n...\nSOMETHING\n
|
506 |
-
stream.eatWhile(/\w/);
|
507 |
-
return tokenSOMETHING(stream,state,stream.current().substr(2))}
|
508 |
-
if(stream.sol()&&stream.match(/^\=item(?!\w)/)){// NOTE: \n=item...\n=cut\n
|
509 |
-
return tokenSOMETHING(stream,state,'=cut')}
|
510 |
-
var ch=stream.next();
|
511 |
-
if(ch=='"'||ch=="'"){ // NOTE: ' or " or <<'SOMETHING'\n...\nSOMETHING\n or <<"SOMETHING"\n...\nSOMETHING\n
|
512 |
-
if(stream.prefix(3)=="<<"+ch){
|
513 |
-
var p=stream.pos;
|
514 |
-
stream.eatWhile(/\w/);
|
515 |
-
var n=stream.current().substr(1);
|
516 |
-
if(n&&stream.eat(ch))
|
517 |
-
return tokenSOMETHING(stream,state,n);
|
518 |
-
stream.pos=p}
|
519 |
-
return tokenChain(stream,state,[ch],"string")}
|
520 |
-
if(ch=="q"){
|
521 |
-
var c=stream.look(-2);
|
522 |
-
if(!(c&&/\w/.test(c))){
|
523 |
-
c=stream.look(0);
|
524 |
-
if(c=="x"){
|
525 |
-
c=stream.look(1);
|
526 |
-
if(c=="("){
|
527 |
-
stream.eatSuffix(2);
|
528 |
-
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)}
|
529 |
-
if(c=="["){
|
530 |
-
stream.eatSuffix(2);
|
531 |
-
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)}
|
532 |
-
if(c=="{"){
|
533 |
-
stream.eatSuffix(2);
|
534 |
-
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)}
|
535 |
-
if(c=="<"){
|
536 |
-
stream.eatSuffix(2);
|
537 |
-
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}
|
538 |
-
if(/[\^'"!~\/]/.test(c)){
|
539 |
-
stream.eatSuffix(1);
|
540 |
-
return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}}
|
541 |
-
else if(c=="q"){
|
542 |
-
c=stream.look(1);
|
543 |
-
if(c=="("){
|
544 |
-
stream.eatSuffix(2);
|
545 |
-
return tokenChain(stream,state,[")"],"string")}
|
546 |
-
if(c=="["){
|
547 |
-
stream.eatSuffix(2);
|
548 |
-
return tokenChain(stream,state,["]"],"string")}
|
549 |
-
if(c=="{"){
|
550 |
-
stream.eatSuffix(2);
|
551 |
-
return tokenChain(stream,state,["}"],"string")}
|
552 |
-
if(c=="<"){
|
553 |
-
stream.eatSuffix(2);
|
554 |
-
return tokenChain(stream,state,[">"],"string")}
|
555 |
-
if(/[\^'"!~\/]/.test(c)){
|
556 |
-
stream.eatSuffix(1);
|
557 |
-
return tokenChain(stream,state,[stream.eat(c)],"string")}}
|
558 |
-
else if(c=="w"){
|
559 |
-
c=stream.look(1);
|
560 |
-
if(c=="("){
|
561 |
-
stream.eatSuffix(2);
|
562 |
-
return tokenChain(stream,state,[")"],"bracket")}
|
563 |
-
if(c=="["){
|
564 |
-
stream.eatSuffix(2);
|
565 |
-
return tokenChain(stream,state,["]"],"bracket")}
|
566 |
-
if(c=="{"){
|
567 |
-
stream.eatSuffix(2);
|
568 |
-
return tokenChain(stream,state,["}"],"bracket")}
|
569 |
-
if(c=="<"){
|
570 |
-
stream.eatSuffix(2);
|
571 |
-
return tokenChain(stream,state,[">"],"bracket")}
|
572 |
-
if(/[\^'"!~\/]/.test(c)){
|
573 |
-
stream.eatSuffix(1);
|
574 |
-
return tokenChain(stream,state,[stream.eat(c)],"bracket")}}
|
575 |
-
else if(c=="r"){
|
576 |
-
c=stream.look(1);
|
577 |
-
if(c=="("){
|
578 |
-
stream.eatSuffix(2);
|
579 |
-
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)}
|
580 |
-
if(c=="["){
|
581 |
-
stream.eatSuffix(2);
|
582 |
-
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)}
|
583 |
-
if(c=="{"){
|
584 |
-
stream.eatSuffix(2);
|
585 |
-
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)}
|
586 |
-
if(c=="<"){
|
587 |
-
stream.eatSuffix(2);
|
588 |
-
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}
|
589 |
-
if(/[\^'"!~\/]/.test(c)){
|
590 |
-
stream.eatSuffix(1);
|
591 |
-
return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}}
|
592 |
-
else if(/[\^'"!~\/(\[{<]/.test(c)){
|
593 |
-
if(c=="("){
|
594 |
-
stream.eatSuffix(1);
|
595 |
-
return tokenChain(stream,state,[")"],"string")}
|
596 |
-
if(c=="["){
|
597 |
-
stream.eatSuffix(1);
|
598 |
-
return tokenChain(stream,state,["]"],"string")}
|
599 |
-
if(c=="{"){
|
600 |
-
stream.eatSuffix(1);
|
601 |
-
return tokenChain(stream,state,["}"],"string")}
|
602 |
-
if(c=="<"){
|
603 |
-
stream.eatSuffix(1);
|
604 |
-
return tokenChain(stream,state,[">"],"string")}
|
605 |
-
if(/[\^'"!~\/]/.test(c)){
|
606 |
-
return tokenChain(stream,state,[stream.eat(c)],"string")}}}}
|
607 |
-
if(ch=="m"){
|
608 |
-
var c=stream.look(-2);
|
609 |
-
if(!(c&&/\w/.test(c))){
|
610 |
-
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
611 |
-
if(c){
|
612 |
-
if(/[\^'"!~\/]/.test(c)){
|
613 |
-
return tokenChain(stream,state,[c],RXstyle,RXmodifiers)}
|
614 |
-
if(c=="("){
|
615 |
-
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)}
|
616 |
-
if(c=="["){
|
617 |
-
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)}
|
618 |
-
if(c=="{"){
|
619 |
-
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)}
|
620 |
-
if(c=="<"){
|
621 |
-
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}}}}
|
622 |
-
if(ch=="s"){
|
623 |
-
var c=/[\/>\]})\w]/.test(stream.look(-2));
|
624 |
-
if(!c){
|
625 |
-
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
626 |
-
if(c){
|
627 |
-
if(c=="[")
|
628 |
-
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
|
629 |
-
if(c=="{")
|
630 |
-
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
|
631 |
-
if(c=="<")
|
632 |
-
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
|
633 |
-
if(c=="(")
|
634 |
-
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
|
635 |
-
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}
|
636 |
-
if(ch=="y"){
|
637 |
-
var c=/[\/>\]})\w]/.test(stream.look(-2));
|
638 |
-
if(!c){
|
639 |
-
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
640 |
-
if(c){
|
641 |
-
if(c=="[")
|
642 |
-
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
|
643 |
-
if(c=="{")
|
644 |
-
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
|
645 |
-
if(c=="<")
|
646 |
-
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
|
647 |
-
if(c=="(")
|
648 |
-
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
|
649 |
-
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}
|
650 |
-
if(ch=="t"){
|
651 |
-
var c=/[\/>\]})\w]/.test(stream.look(-2));
|
652 |
-
if(!c){
|
653 |
-
c=stream.eat("r");if(c){
|
654 |
-
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
655 |
-
if(c){
|
656 |
-
if(c=="[")
|
657 |
-
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
|
658 |
-
if(c=="{")
|
659 |
-
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
|
660 |
-
if(c=="<")
|
661 |
-
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
|
662 |
-
if(c=="(")
|
663 |
-
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
|
664 |
-
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}}
|
665 |
-
if(ch=="`"){
|
666 |
-
return tokenChain(stream,state,[ch],"variable-2")}
|
667 |
-
if(ch=="/"){
|
668 |
-
if(!/~\s*$/.test(stream.prefix()))
|
669 |
-
return "operator";
|
670 |
-
else
|
671 |
-
return tokenChain(stream,state,[ch],RXstyle,RXmodifiers)}
|
672 |
-
if(ch=="$"){
|
673 |
-
var p=stream.pos;
|
674 |
-
if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}"))
|
675 |
-
return "variable-2";
|
676 |
-
else
|
677 |
-
stream.pos=p}
|
678 |
-
if(/[$@%]/.test(ch)){
|
679 |
-
var p=stream.pos;
|
680 |
-
if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(stream.look(-2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
|
681 |
-
var c=stream.current();
|
682 |
-
if(PERL[c])
|
683 |
-
return "variable-2"}
|
684 |
-
stream.pos=p}
|
685 |
-
if(/[$@%&]/.test(ch)){
|
686 |
-
if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){
|
687 |
-
var c=stream.current();
|
688 |
-
if(PERL[c])
|
689 |
-
return "variable-2";
|
690 |
-
else
|
691 |
-
return "variable"}}
|
692 |
-
if(ch=="#"){
|
693 |
-
if(stream.look(-2)!="$"){
|
694 |
-
stream.skipToEnd();
|
695 |
-
return "comment"}}
|
696 |
-
if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){
|
697 |
-
var p=stream.pos;
|
698 |
-
stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/);
|
699 |
-
if(PERL[stream.current()])
|
700 |
-
return "operator";
|
701 |
-
else
|
702 |
-
stream.pos=p}
|
703 |
-
if(ch=="_"){
|
704 |
-
if(stream.pos==1){
|
705 |
-
if(stream.suffix(6)=="_END__"){
|
706 |
-
return tokenChain(stream,state,['\0'],"comment")}
|
707 |
-
else if(stream.suffix(7)=="_DATA__"){
|
708 |
-
return tokenChain(stream,state,['\0'],"variable-2")}
|
709 |
-
else if(stream.suffix(7)=="_C__"){
|
710 |
-
return tokenChain(stream,state,['\0'],"string")}}}
|
711 |
-
if(/\w/.test(ch)){
|
712 |
-
var p=stream.pos;
|
713 |
-
if(stream.look(-2)=="{"&&(stream.look(0)=="}"||stream.eatWhile(/\w/)&&stream.look(0)=="}"))
|
714 |
-
return "string";
|
715 |
-
else
|
716 |
-
stream.pos=p}
|
717 |
-
if(/[A-Z]/.test(ch)){
|
718 |
-
var l=stream.look(-2);
|
719 |
-
var p=stream.pos;
|
720 |
-
stream.eatWhile(/[A-Z_]/);
|
721 |
-
if(/[\da-z]/.test(stream.look(0))){
|
722 |
-
stream.pos=p}
|
723 |
-
else{
|
724 |
-
var c=PERL[stream.current()];
|
725 |
-
if(!c)
|
726 |
-
return "meta";
|
727 |
-
if(c[1])
|
728 |
-
c=c[0];
|
729 |
-
if(l!=":"){
|
730 |
-
if(c==1)
|
731 |
-
return "keyword";
|
732 |
-
else if(c==2)
|
733 |
-
return "def";
|
734 |
-
else if(c==3)
|
735 |
-
return "atom";
|
736 |
-
else if(c==4)
|
737 |
-
return "operator";
|
738 |
-
else if(c==5)
|
739 |
-
return "variable-2";
|
740 |
-
else
|
741 |
-
return "meta"}
|
742 |
-
else
|
743 |
-
return "meta"}}
|
744 |
-
if(/[a-zA-Z_]/.test(ch)){
|
745 |
-
var l=stream.look(-2);
|
746 |
-
stream.eatWhile(/\w/);
|
747 |
-
var c=PERL[stream.current()];
|
748 |
-
if(!c)
|
749 |
-
return "meta";
|
750 |
-
if(c[1])
|
751 |
-
c=c[0];
|
752 |
-
if(l!=":"){
|
753 |
-
if(c==1)
|
754 |
-
return "keyword";
|
755 |
-
else if(c==2)
|
756 |
-
return "def";
|
757 |
-
else if(c==3)
|
758 |
-
return "atom";
|
759 |
-
else if(c==4)
|
760 |
-
return "operator";
|
761 |
-
else if(c==5)
|
762 |
-
return "variable-2";
|
763 |
-
else
|
764 |
-
return "meta"}
|
765 |
-
else
|
766 |
-
return "meta"}
|
767 |
-
return null}
|
768 |
-
|
769 |
-
return{
|
770 |
-
startState:function(){
|
771 |
-
return{
|
772 |
-
tokenize:tokenPerl,
|
773 |
-
chain:null,
|
774 |
-
style:null,
|
775 |
-
tail:null}},
|
776 |
-
token:function(stream,state){
|
777 |
-
return (state.tokenize||tokenPerl)(stream,state)},
|
778 |
-
electricChars:"{}"}});
|
779 |
-
|
780 |
-
CodeMirror.defineMIME("text/x-perl", "perl");
|
781 |
-
|
782 |
-
// it's like "peek", but need for look-ahead or look-behind if index < 0
|
783 |
-
CodeMirror.StringStream.prototype.look=function(c){
|
784 |
-
return this.string.charAt(this.pos+(c||0))};
|
785 |
-
|
786 |
-
// return a part of prefix of current stream from current position
|
787 |
-
CodeMirror.StringStream.prototype.prefix=function(c){
|
788 |
-
if(c){
|
789 |
-
var x=this.pos-c;
|
790 |
-
return this.string.substr((x>=0?x:0),c)}
|
791 |
-
else{
|
792 |
-
return this.string.substr(0,this.pos-1)}};
|
793 |
-
|
794 |
-
// return a part of suffix of current stream from current position
|
795 |
-
CodeMirror.StringStream.prototype.suffix=function(c){
|
796 |
-
var y=this.string.length;
|
797 |
-
var x=y-this.pos+1;
|
798 |
-
return this.string.substr(this.pos,(c&&c<y?c:x))};
|
799 |
-
|
800 |
-
// return a part of suffix of current stream from current position and change current position
|
801 |
-
CodeMirror.StringStream.prototype.nsuffix=function(c){
|
802 |
-
var p=this.pos;
|
803 |
-
var l=c||(this.string.length-this.pos+1);
|
804 |
-
this.pos+=l;
|
805 |
-
return this.string.substr(p,l)};
|
806 |
-
|
807 |
-
// eating and vomiting a part of stream from current position
|
808 |
-
CodeMirror.StringStream.prototype.eatSuffix=function(c){
|
809 |
-
var x=this.pos+c;
|
810 |
-
var y;
|
811 |
-
if(x<=0)
|
812 |
-
this.pos=0;
|
813 |
-
else if(x>=(y=this.string.length-1))
|
814 |
-
this.pos=y;
|
815 |
-
else
|
816 |
-
this.pos=x};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/php/index.html
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: PHP mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="../xml/xml.js"></script>
|
8 |
-
<script src="../javascript/javascript.js"></script>
|
9 |
-
<script src="../css/css.js"></script>
|
10 |
-
<script src="../clike/clike.js"></script>
|
11 |
-
<script src="php.js"></script>
|
12 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
13 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: PHP mode</h1>
|
18 |
-
|
19 |
-
<form><textarea id="code" name="code">
|
20 |
-
<?php
|
21 |
-
function hello($who) {
|
22 |
-
return "Hello " . $who;
|
23 |
-
}
|
24 |
-
?>
|
25 |
-
<p>The program says <?= hello("World") ?>.</p>
|
26 |
-
<script>
|
27 |
-
alert("And here is some JS code"); // also colored
|
28 |
-
</script>
|
29 |
-
</textarea></form>
|
30 |
-
|
31 |
-
<script>
|
32 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
33 |
-
lineNumbers: true,
|
34 |
-
matchBrackets: true,
|
35 |
-
mode: "application/x-httpd-php",
|
36 |
-
indentUnit: 8,
|
37 |
-
indentWithTabs: true,
|
38 |
-
enterMode: "keep",
|
39 |
-
tabMode: "shift"
|
40 |
-
});
|
41 |
-
</script>
|
42 |
-
|
43 |
-
<p>Simple HTML/PHP mode based on
|
44 |
-
the <a href="../clike/">C-like</a> mode. Depends on XML,
|
45 |
-
JavaScript, CSS, and C-like modes.</p>
|
46 |
-
|
47 |
-
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
|
48 |
-
</body>
|
49 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/php/php.js
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
(function() {
|
2 |
-
function keywords(str) {
|
3 |
-
var obj = {}, words = str.split(" ");
|
4 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
5 |
-
return obj;
|
6 |
-
}
|
7 |
-
function heredoc(delim) {
|
8 |
-
return function(stream, state) {
|
9 |
-
if (stream.match(delim)) state.tokenize = null;
|
10 |
-
else stream.skipToEnd();
|
11 |
-
return "string";
|
12 |
-
}
|
13 |
-
}
|
14 |
-
var phpConfig = {
|
15 |
-
name: "clike",
|
16 |
-
keywords: keywords("abstract and array as break case catch cfunction class clone const continue declare " +
|
17 |
-
"default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends " +
|
18 |
-
"final for foreach function global goto if implements interface instanceof namespace " +
|
19 |
-
"new or private protected public static switch throw try use var while xor return" +
|
20 |
-
"die echo empty exit eval include include_once isset list require require_once print unset"),
|
21 |
-
blockKeywords: keywords("catch do else elseif for foreach if switch try while"),
|
22 |
-
atoms: keywords("true false null TRUE FALSE NULL"),
|
23 |
-
multiLineStrings: true,
|
24 |
-
hooks: {
|
25 |
-
"$": function(stream, state) {
|
26 |
-
stream.eatWhile(/[\w\$_]/);
|
27 |
-
return "variable-2";
|
28 |
-
},
|
29 |
-
"<": function(stream, state) {
|
30 |
-
if (stream.match(/<</)) {
|
31 |
-
stream.eatWhile(/[\w\.]/);
|
32 |
-
state.tokenize = heredoc(stream.current().slice(3));
|
33 |
-
return state.tokenize(stream, state);
|
34 |
-
}
|
35 |
-
return false;
|
36 |
-
},
|
37 |
-
"#": function(stream, state) {
|
38 |
-
stream.skipToEnd();
|
39 |
-
return "comment";
|
40 |
-
}
|
41 |
-
}
|
42 |
-
};
|
43 |
-
|
44 |
-
CodeMirror.defineMode("php", function(config, parserConfig) {
|
45 |
-
var htmlMode = CodeMirror.getMode(config, "text/html");
|
46 |
-
var jsMode = CodeMirror.getMode(config, "text/javascript");
|
47 |
-
var cssMode = CodeMirror.getMode(config, "text/css");
|
48 |
-
var phpMode = CodeMirror.getMode(config, phpConfig);
|
49 |
-
|
50 |
-
function dispatch(stream, state) { // TODO open PHP inside text/css
|
51 |
-
if (state.curMode == htmlMode) {
|
52 |
-
var style = htmlMode.token(stream, state.curState);
|
53 |
-
if (style == "meta" && /^<\?/.test(stream.current())) {
|
54 |
-
state.curMode = phpMode;
|
55 |
-
state.curState = state.php;
|
56 |
-
state.curClose = /^\?>/;
|
57 |
-
state.mode = 'php';
|
58 |
-
}
|
59 |
-
else if (style == "tag" && stream.current() == ">" && state.curState.context) {
|
60 |
-
if (/^script$/i.test(state.curState.context.tagName)) {
|
61 |
-
state.curMode = jsMode;
|
62 |
-
state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
|
63 |
-
state.curClose = /^<\/\s*script\s*>/i;
|
64 |
-
state.mode = 'javascript';
|
65 |
-
}
|
66 |
-
else if (/^style$/i.test(state.curState.context.tagName)) {
|
67 |
-
state.curMode = cssMode;
|
68 |
-
state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
|
69 |
-
state.curClose = /^<\/\s*style\s*>/i;
|
70 |
-
state.mode = 'css';
|
71 |
-
}
|
72 |
-
}
|
73 |
-
return style;
|
74 |
-
}
|
75 |
-
else if (stream.match(state.curClose, false)) {
|
76 |
-
state.curMode = htmlMode;
|
77 |
-
state.curState = state.html;
|
78 |
-
state.curClose = null;
|
79 |
-
state.mode = 'html';
|
80 |
-
return dispatch(stream, state);
|
81 |
-
}
|
82 |
-
else return state.curMode.token(stream, state.curState);
|
83 |
-
}
|
84 |
-
|
85 |
-
return {
|
86 |
-
startState: function() {
|
87 |
-
var html = htmlMode.startState();
|
88 |
-
return {html: html,
|
89 |
-
php: phpMode.startState(),
|
90 |
-
curMode: parserConfig.startOpen ? phpMode : htmlMode,
|
91 |
-
curState: parserConfig.startOpen ? phpMode.startState() : html,
|
92 |
-
curClose: parserConfig.startOpen ? /^\?>/ : null,
|
93 |
-
mode: parserConfig.startOpen ? 'php' : 'html'}
|
94 |
-
},
|
95 |
-
|
96 |
-
copyState: function(state) {
|
97 |
-
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
|
98 |
-
php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;
|
99 |
-
if (state.curState == html) cur = htmlNew;
|
100 |
-
else if (state.curState == php) cur = phpNew;
|
101 |
-
else cur = CodeMirror.copyState(state.curMode, state.curState);
|
102 |
-
return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, curClose: state.curClose};
|
103 |
-
},
|
104 |
-
|
105 |
-
token: dispatch,
|
106 |
-
|
107 |
-
indent: function(state, textAfter) {
|
108 |
-
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
|
109 |
-
(state.curMode == phpMode && /^\?>/.test(textAfter)))
|
110 |
-
return htmlMode.indent(state.html, textAfter);
|
111 |
-
return state.curMode.indent(state.curState, textAfter);
|
112 |
-
},
|
113 |
-
|
114 |
-
electricChars: "/{}:"
|
115 |
-
}
|
116 |
-
});
|
117 |
-
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
118 |
-
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
119 |
-
CodeMirror.defineMIME("text/x-php", phpConfig);
|
120 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/plsql/index.html
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Oracle PL/SQL mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="plsql.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style>.CodeMirror {border: 2px inset #dee;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Oracle PL/SQL mode</h1>
|
14 |
-
|
15 |
-
<form><textarea id="code" name="code">
|
16 |
-
-- Oracle PL/SQL Code Demo
|
17 |
-
/*
|
18 |
-
based on c-like mode, adapted to PL/SQL by Peter Raganitsch ( http://www.oracle-and-apex.com/ )
|
19 |
-
April 2011
|
20 |
-
*/
|
21 |
-
DECLARE
|
22 |
-
vIdx NUMBER;
|
23 |
-
vString VARCHAR2(100);
|
24 |
-
cText CONSTANT VARCHAR2(100) := 'That''s it! Have fun with CodeMirror 2';
|
25 |
-
BEGIN
|
26 |
-
vIdx := 0;
|
27 |
-
--
|
28 |
-
FOR rDATA IN
|
29 |
-
( SELECT *
|
30 |
-
FROM EMP
|
31 |
-
ORDER BY EMPNO
|
32 |
-
)
|
33 |
-
LOOP
|
34 |
-
vIdx := vIdx + 1;
|
35 |
-
vString := rDATA.EMPNO || ' - ' || rDATA.ENAME;
|
36 |
-
--
|
37 |
-
UPDATE EMP
|
38 |
-
SET SAL = SAL * 101/100
|
39 |
-
WHERE EMPNO = rDATA.EMPNO
|
40 |
-
;
|
41 |
-
END LOOP;
|
42 |
-
--
|
43 |
-
SYS.DBMS_OUTPUT.Put_Line (cText);
|
44 |
-
END;
|
45 |
-
--
|
46 |
-
</textarea></form>
|
47 |
-
|
48 |
-
<script>
|
49 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
50 |
-
lineNumbers: true,
|
51 |
-
matchBrackets: true,
|
52 |
-
indentUnit: 4,
|
53 |
-
mode: "text/x-plsql"
|
54 |
-
});
|
55 |
-
</script>
|
56 |
-
|
57 |
-
<p>
|
58 |
-
Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course).
|
59 |
-
</p>
|
60 |
-
|
61 |
-
<p><strong>MIME type defined:</strong> <code>text/x-plsql</code>
|
62 |
-
(PLSQL code)
|
63 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/plsql/plsql.js
DELETED
@@ -1,217 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("plsql", function(config, parserConfig) {
|
2 |
-
var indentUnit = config.indentUnit,
|
3 |
-
keywords = parserConfig.keywords,
|
4 |
-
functions = parserConfig.functions,
|
5 |
-
types = parserConfig.types,
|
6 |
-
sqlplus = parserConfig.sqlplus,
|
7 |
-
multiLineStrings = parserConfig.multiLineStrings;
|
8 |
-
var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
|
9 |
-
function chain(stream, state, f) {
|
10 |
-
state.tokenize = f;
|
11 |
-
return f(stream, state);
|
12 |
-
}
|
13 |
-
|
14 |
-
var type;
|
15 |
-
function ret(tp, style) {
|
16 |
-
type = tp;
|
17 |
-
return style;
|
18 |
-
}
|
19 |
-
|
20 |
-
function tokenBase(stream, state) {
|
21 |
-
var ch = stream.next();
|
22 |
-
// start of string?
|
23 |
-
if (ch == '"' || ch == "'")
|
24 |
-
return chain(stream, state, tokenString(ch));
|
25 |
-
// is it one of the special signs []{}().,;? Seperator?
|
26 |
-
else if (/[\[\]{}\(\),;\.]/.test(ch))
|
27 |
-
return ret(ch);
|
28 |
-
// start of a number value?
|
29 |
-
else if (/\d/.test(ch)) {
|
30 |
-
stream.eatWhile(/[\w\.]/);
|
31 |
-
return ret("number", "number");
|
32 |
-
}
|
33 |
-
// multi line comment or simple operator?
|
34 |
-
else if (ch == "/") {
|
35 |
-
if (stream.eat("*")) {
|
36 |
-
return chain(stream, state, tokenComment);
|
37 |
-
}
|
38 |
-
else {
|
39 |
-
stream.eatWhile(isOperatorChar);
|
40 |
-
return ret("operator", "operator");
|
41 |
-
}
|
42 |
-
}
|
43 |
-
// single line comment or simple operator?
|
44 |
-
else if (ch == "-") {
|
45 |
-
if (stream.eat("-")) {
|
46 |
-
stream.skipToEnd();
|
47 |
-
return ret("comment", "comment");
|
48 |
-
}
|
49 |
-
else {
|
50 |
-
stream.eatWhile(isOperatorChar);
|
51 |
-
return ret("operator", "operator");
|
52 |
-
}
|
53 |
-
}
|
54 |
-
// pl/sql variable?
|
55 |
-
else if (ch == "@" || ch == "$") {
|
56 |
-
stream.eatWhile(/[\w\d\$_]/);
|
57 |
-
return ret("word", "variable");
|
58 |
-
}
|
59 |
-
// is it a operator?
|
60 |
-
else if (isOperatorChar.test(ch)) {
|
61 |
-
stream.eatWhile(isOperatorChar);
|
62 |
-
return ret("operator", "operator");
|
63 |
-
}
|
64 |
-
else {
|
65 |
-
// get the whole word
|
66 |
-
stream.eatWhile(/[\w\$_]/);
|
67 |
-
// is it one of the listed keywords?
|
68 |
-
if (keywords && keywords.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "keyword");
|
69 |
-
// is it one of the listed functions?
|
70 |
-
if (functions && functions.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "builtin");
|
71 |
-
// is it one of the listed types?
|
72 |
-
if (types && types.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-2");
|
73 |
-
// is it one of the listed sqlplus keywords?
|
74 |
-
if (sqlplus && sqlplus.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-3");
|
75 |
-
// default: just a "word"
|
76 |
-
return ret("word", "plsql-word");
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
function tokenString(quote) {
|
81 |
-
return function(stream, state) {
|
82 |
-
var escaped = false, next, end = false;
|
83 |
-
while ((next = stream.next()) != null) {
|
84 |
-
if (next == quote && !escaped) {end = true; break;}
|
85 |
-
escaped = !escaped && next == "\\";
|
86 |
-
}
|
87 |
-
if (end || !(escaped || multiLineStrings))
|
88 |
-
state.tokenize = tokenBase;
|
89 |
-
return ret("string", "plsql-string");
|
90 |
-
};
|
91 |
-
}
|
92 |
-
|
93 |
-
function tokenComment(stream, state) {
|
94 |
-
var maybeEnd = false, ch;
|
95 |
-
while (ch = stream.next()) {
|
96 |
-
if (ch == "/" && maybeEnd) {
|
97 |
-
state.tokenize = tokenBase;
|
98 |
-
break;
|
99 |
-
}
|
100 |
-
maybeEnd = (ch == "*");
|
101 |
-
}
|
102 |
-
return ret("comment", "plsql-comment");
|
103 |
-
}
|
104 |
-
|
105 |
-
// Interface
|
106 |
-
|
107 |
-
return {
|
108 |
-
startState: function(basecolumn) {
|
109 |
-
return {
|
110 |
-
tokenize: tokenBase,
|
111 |
-
startOfLine: true
|
112 |
-
};
|
113 |
-
},
|
114 |
-
|
115 |
-
token: function(stream, state) {
|
116 |
-
if (stream.eatSpace()) return null;
|
117 |
-
var style = state.tokenize(stream, state);
|
118 |
-
return style;
|
119 |
-
}
|
120 |
-
};
|
121 |
-
});
|
122 |
-
|
123 |
-
(function() {
|
124 |
-
function keywords(str) {
|
125 |
-
var obj = {}, words = str.split(" ");
|
126 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
127 |
-
return obj;
|
128 |
-
}
|
129 |
-
var cKeywords = "abort accept access add all alter and any array arraylen as asc assert assign at attributes audit " +
|
130 |
-
"authorization avg " +
|
131 |
-
"base_table begin between binary_integer body boolean by " +
|
132 |
-
"case cast char char_base check close cluster clusters colauth column comment commit compress connect " +
|
133 |
-
"connected constant constraint crash create current currval cursor " +
|
134 |
-
"data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete " +
|
135 |
-
"desc digits dispose distinct do drop " +
|
136 |
-
"else elsif enable end entry escape exception exception_init exchange exclusive exists exit external " +
|
137 |
-
"fast fetch file for force form from function " +
|
138 |
-
"generic goto grant group " +
|
139 |
-
"having " +
|
140 |
-
"identified if immediate in increment index indexes indicator initial initrans insert interface intersect " +
|
141 |
-
"into is " +
|
142 |
-
"key " +
|
143 |
-
"level library like limited local lock log logging long loop " +
|
144 |
-
"master maxextents maxtrans member minextents minus mislabel mode modify multiset " +
|
145 |
-
"new next no noaudit nocompress nologging noparallel not nowait number_base " +
|
146 |
-
"object of off offline on online only open option or order out " +
|
147 |
-
"package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior " +
|
148 |
-
"private privileges procedure public " +
|
149 |
-
"raise range raw read rebuild record ref references refresh release rename replace resource restrict return " +
|
150 |
-
"returning reverse revoke rollback row rowid rowlabel rownum rows run " +
|
151 |
-
"savepoint schema segment select separate session set share snapshot some space split sql start statement " +
|
152 |
-
"storage subtype successful synonym " +
|
153 |
-
"tabauth table tables tablespace task terminate then to trigger truncate type " +
|
154 |
-
"union unique unlimited unrecoverable unusable update use using " +
|
155 |
-
"validate value values variable view views " +
|
156 |
-
"when whenever where while with work";
|
157 |
-
|
158 |
-
var cFunctions = "abs acos add_months ascii asin atan atan2 average " +
|
159 |
-
"bfilename " +
|
160 |
-
"ceil chartorowid chr concat convert cos cosh count " +
|
161 |
-
"decode deref dual dump dup_val_on_index " +
|
162 |
-
"empty error exp " +
|
163 |
-
"false floor found " +
|
164 |
-
"glb greatest " +
|
165 |
-
"hextoraw " +
|
166 |
-
"initcap instr instrb isopen " +
|
167 |
-
"last_day least lenght lenghtb ln lower lpad ltrim lub " +
|
168 |
-
"make_ref max min mod months_between " +
|
169 |
-
"new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower " +
|
170 |
-
"nls_sort nls_upper nlssort no_data_found notfound null nvl " +
|
171 |
-
"others " +
|
172 |
-
"power " +
|
173 |
-
"rawtohex reftohex round rowcount rowidtochar rpad rtrim " +
|
174 |
-
"sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate " +
|
175 |
-
"tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc " +
|
176 |
-
"uid upper user userenv " +
|
177 |
-
"variance vsize";
|
178 |
-
|
179 |
-
var cTypes = "bfile blob " +
|
180 |
-
"character clob " +
|
181 |
-
"dec " +
|
182 |
-
"float " +
|
183 |
-
"int integer " +
|
184 |
-
"mlslabel " +
|
185 |
-
"natural naturaln nchar nclob number numeric nvarchar2 " +
|
186 |
-
"real rowtype " +
|
187 |
-
"signtype smallint string " +
|
188 |
-
"varchar varchar2";
|
189 |
-
|
190 |
-
var cSqlplus = "appinfo arraysize autocommit autoprint autorecovery autotrace " +
|
191 |
-
"blockterminator break btitle " +
|
192 |
-
"cmdsep colsep compatibility compute concat copycommit copytypecheck " +
|
193 |
-
"define describe " +
|
194 |
-
"echo editfile embedded escape exec execute " +
|
195 |
-
"feedback flagger flush " +
|
196 |
-
"heading headsep " +
|
197 |
-
"instance " +
|
198 |
-
"linesize lno loboffset logsource long longchunksize " +
|
199 |
-
"markup " +
|
200 |
-
"native newpage numformat numwidth " +
|
201 |
-
"pagesize pause pno " +
|
202 |
-
"recsep recsepchar release repfooter repheader " +
|
203 |
-
"serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber " +
|
204 |
-
"sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix " +
|
205 |
-
"tab term termout time timing trimout trimspool ttitle " +
|
206 |
-
"underline " +
|
207 |
-
"verify version " +
|
208 |
-
"wrap";
|
209 |
-
|
210 |
-
CodeMirror.defineMIME("text/x-plsql", {
|
211 |
-
name: "plsql",
|
212 |
-
keywords: keywords(cKeywords),
|
213 |
-
functions: keywords(cFunctions),
|
214 |
-
types: keywords(cTypes),
|
215 |
-
sqlplus: keywords(cSqlplus)
|
216 |
-
});
|
217 |
-
}());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/python/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
The MIT License
|
2 |
-
|
3 |
-
Copyright (c) 2010 Timothy Farrell
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
-
of this software and associated documentation files (the "Software"), to deal
|
7 |
-
in the Software without restriction, including without limitation the rights
|
8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
copies of the Software, and to permit persons to whom the Software is
|
10 |
-
furnished to do so, subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in
|
13 |
-
all copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/python/index.html
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Python mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="python.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Python mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
# Literals
|
17 |
-
1234
|
18 |
-
0.0e101
|
19 |
-
.123
|
20 |
-
0b01010011100
|
21 |
-
0o01234567
|
22 |
-
0x0987654321abcdef
|
23 |
-
7
|
24 |
-
2147483647
|
25 |
-
3L
|
26 |
-
79228162514264337593543950336L
|
27 |
-
0x100000000L
|
28 |
-
79228162514264337593543950336
|
29 |
-
0xdeadbeef
|
30 |
-
3.14j
|
31 |
-
10.j
|
32 |
-
10j
|
33 |
-
.001j
|
34 |
-
1e100j
|
35 |
-
3.14e-10j
|
36 |
-
|
37 |
-
|
38 |
-
# String Literals
|
39 |
-
'For\''
|
40 |
-
"God\""
|
41 |
-
"""so loved
|
42 |
-
the world"""
|
43 |
-
'''that he gave
|
44 |
-
his only begotten\' '''
|
45 |
-
'that whosoever believeth \
|
46 |
-
in him'
|
47 |
-
''
|
48 |
-
|
49 |
-
# Identifiers
|
50 |
-
__a__
|
51 |
-
a.b
|
52 |
-
a.b.c
|
53 |
-
|
54 |
-
# Operators
|
55 |
-
+ - * / % & | ^ ~ < >
|
56 |
-
== != <= >= <> << >> // **
|
57 |
-
and or not in is
|
58 |
-
|
59 |
-
# Delimiters
|
60 |
-
() [] {} , : ` = ; @ . # Note that @ and . require the proper context.
|
61 |
-
+= -= *= /= %= &= |= ^=
|
62 |
-
//= >>= <<= **=
|
63 |
-
|
64 |
-
# Keywords
|
65 |
-
as assert break class continue def del elif else except
|
66 |
-
finally for from global if import lambda pass raise
|
67 |
-
return try while with yield
|
68 |
-
|
69 |
-
# Python 2 Keywords (otherwise Identifiers)
|
70 |
-
exec print
|
71 |
-
|
72 |
-
# Python 3 Keywords (otherwise Identifiers)
|
73 |
-
nonlocal
|
74 |
-
|
75 |
-
# Types
|
76 |
-
bool classmethod complex dict enumerate float frozenset int list object
|
77 |
-
property reversed set slice staticmethod str super tuple type
|
78 |
-
|
79 |
-
# Python 2 Types (otherwise Identifiers)
|
80 |
-
basestring buffer file long unicode xrange
|
81 |
-
|
82 |
-
# Python 3 Types (otherwise Identifiers)
|
83 |
-
bytearray bytes filter map memoryview open range zip
|
84 |
-
|
85 |
-
# Some Example code
|
86 |
-
import os
|
87 |
-
from package import ParentClass
|
88 |
-
|
89 |
-
@nonsenseDecorator
|
90 |
-
def doesNothing():
|
91 |
-
pass
|
92 |
-
|
93 |
-
class ExampleClass(ParentClass):
|
94 |
-
@staticmethod
|
95 |
-
def example(inputStr):
|
96 |
-
a = list(inputStr)
|
97 |
-
a.reverse()
|
98 |
-
return ''.join(a)
|
99 |
-
|
100 |
-
def __init__(self, mixin = 'Hello'):
|
101 |
-
self.mixin = mixin
|
102 |
-
|
103 |
-
</textarea></div>
|
104 |
-
<script>
|
105 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
106 |
-
mode: {name: "python",
|
107 |
-
version: 2,
|
108 |
-
singleLineStringErrors: false},
|
109 |
-
lineNumbers: true,
|
110 |
-
indentUnit: 4,
|
111 |
-
tabMode: "shift",
|
112 |
-
matchBrackets: true
|
113 |
-
});
|
114 |
-
</script>
|
115 |
-
<h2>Configuration Options:</h2>
|
116 |
-
<ul>
|
117 |
-
<li>version - 2/3 - The version of Python to recognize. Default is 2.</li>
|
118 |
-
<li>singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.</li>
|
119 |
-
</ul>
|
120 |
-
|
121 |
-
<p><strong>MIME types defined:</strong> <code>text/x-python</code>.</p>
|
122 |
-
</body>
|
123 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/python/python.js
DELETED
@@ -1,320 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("python", function(conf, parserConf) {
|
2 |
-
var ERRORCLASS = 'error';
|
3 |
-
|
4 |
-
function wordRegexp(words) {
|
5 |
-
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
6 |
-
}
|
7 |
-
|
8 |
-
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
9 |
-
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
|
10 |
-
var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
11 |
-
var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
|
12 |
-
var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
|
13 |
-
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
|
14 |
-
|
15 |
-
var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
|
16 |
-
var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
|
17 |
-
'def', 'del', 'elif', 'else', 'except', 'finally',
|
18 |
-
'for', 'from', 'global', 'if', 'import',
|
19 |
-
'lambda', 'pass', 'raise', 'return',
|
20 |
-
'try', 'while', 'with', 'yield'];
|
21 |
-
var commontypes = ['bool', 'classmethod', 'complex', 'dict', 'enumerate',
|
22 |
-
'float', 'frozenset', 'int', 'list', 'object',
|
23 |
-
'property', 'reversed', 'set', 'slice', 'staticmethod',
|
24 |
-
'str', 'super', 'tuple', 'type'];
|
25 |
-
var py2 = {'types': ['basestring', 'buffer', 'file', 'long', 'unicode',
|
26 |
-
'xrange'],
|
27 |
-
'keywords': ['exec', 'print']};
|
28 |
-
var py3 = {'types': ['bytearray', 'bytes', 'filter', 'map', 'memoryview',
|
29 |
-
'open', 'range', 'zip'],
|
30 |
-
'keywords': ['nonlocal']};
|
31 |
-
|
32 |
-
if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
|
33 |
-
commonkeywords = commonkeywords.concat(py3.keywords);
|
34 |
-
commontypes = commontypes.concat(py3.types);
|
35 |
-
var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
|
36 |
-
} else {
|
37 |
-
commonkeywords = commonkeywords.concat(py2.keywords);
|
38 |
-
commontypes = commontypes.concat(py2.types);
|
39 |
-
var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
40 |
-
}
|
41 |
-
var keywords = wordRegexp(commonkeywords);
|
42 |
-
var types = wordRegexp(commontypes);
|
43 |
-
|
44 |
-
var indentInfo = null;
|
45 |
-
|
46 |
-
// tokenizers
|
47 |
-
function tokenBase(stream, state) {
|
48 |
-
// Handle scope changes
|
49 |
-
if (stream.sol()) {
|
50 |
-
var scopeOffset = state.scopes[0].offset;
|
51 |
-
if (stream.eatSpace()) {
|
52 |
-
var lineOffset = stream.indentation();
|
53 |
-
if (lineOffset > scopeOffset) {
|
54 |
-
indentInfo = 'indent';
|
55 |
-
} else if (lineOffset < scopeOffset) {
|
56 |
-
indentInfo = 'dedent';
|
57 |
-
}
|
58 |
-
return null;
|
59 |
-
} else {
|
60 |
-
if (scopeOffset > 0) {
|
61 |
-
dedent(stream, state);
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
if (stream.eatSpace()) {
|
66 |
-
return null;
|
67 |
-
}
|
68 |
-
|
69 |
-
var ch = stream.peek();
|
70 |
-
|
71 |
-
// Handle Comments
|
72 |
-
if (ch === '#') {
|
73 |
-
stream.skipToEnd();
|
74 |
-
return 'comment';
|
75 |
-
}
|
76 |
-
|
77 |
-
// Handle Number Literals
|
78 |
-
if (stream.match(/^[0-9\.]/, false)) {
|
79 |
-
var floatLiteral = false;
|
80 |
-
// Floats
|
81 |
-
if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
82 |
-
if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
|
83 |
-
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
84 |
-
if (floatLiteral) {
|
85 |
-
// Float literals may be "imaginary"
|
86 |
-
stream.eat(/J/i);
|
87 |
-
return 'number';
|
88 |
-
}
|
89 |
-
// Integers
|
90 |
-
var intLiteral = false;
|
91 |
-
// Hex
|
92 |
-
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
|
93 |
-
// Binary
|
94 |
-
if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
|
95 |
-
// Octal
|
96 |
-
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
|
97 |
-
// Decimal
|
98 |
-
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
|
99 |
-
// Decimal literals may be "imaginary"
|
100 |
-
stream.eat(/J/i);
|
101 |
-
// TODO - Can you have imaginary longs?
|
102 |
-
intLiteral = true;
|
103 |
-
}
|
104 |
-
// Zero by itself with no other piece of number.
|
105 |
-
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
|
106 |
-
if (intLiteral) {
|
107 |
-
// Integer literals may be "long"
|
108 |
-
stream.eat(/L/i);
|
109 |
-
return 'number';
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
// Handle Strings
|
114 |
-
if (stream.match(stringPrefixes)) {
|
115 |
-
state.tokenize = tokenStringFactory(stream.current());
|
116 |
-
return state.tokenize(stream, state);
|
117 |
-
}
|
118 |
-
|
119 |
-
// Handle operators and Delimiters
|
120 |
-
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
|
121 |
-
return null;
|
122 |
-
}
|
123 |
-
if (stream.match(doubleOperators)
|
124 |
-
|| stream.match(singleOperators)
|
125 |
-
|| stream.match(wordOperators)) {
|
126 |
-
return 'operator';
|
127 |
-
}
|
128 |
-
if (stream.match(singleDelimiters)) {
|
129 |
-
return null;
|
130 |
-
}
|
131 |
-
|
132 |
-
if (stream.match(types)) {
|
133 |
-
return 'builtin';
|
134 |
-
}
|
135 |
-
|
136 |
-
if (stream.match(keywords)) {
|
137 |
-
return 'keyword';
|
138 |
-
}
|
139 |
-
|
140 |
-
if (stream.match(identifiers)) {
|
141 |
-
return 'variable';
|
142 |
-
}
|
143 |
-
|
144 |
-
// Handle non-detected items
|
145 |
-
stream.next();
|
146 |
-
return ERRORCLASS;
|
147 |
-
}
|
148 |
-
|
149 |
-
function tokenStringFactory(delimiter) {
|
150 |
-
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
|
151 |
-
delimiter = delimiter.substr(1);
|
152 |
-
}
|
153 |
-
var singleline = delimiter.length == 1;
|
154 |
-
var OUTCLASS = 'string';
|
155 |
-
|
156 |
-
return function tokenString(stream, state) {
|
157 |
-
while (!stream.eol()) {
|
158 |
-
stream.eatWhile(/[^'"\\]/);
|
159 |
-
if (stream.eat('\\')) {
|
160 |
-
stream.next();
|
161 |
-
if (singleline && stream.eol()) {
|
162 |
-
return OUTCLASS;
|
163 |
-
}
|
164 |
-
} else if (stream.match(delimiter)) {
|
165 |
-
state.tokenize = tokenBase;
|
166 |
-
return OUTCLASS;
|
167 |
-
} else {
|
168 |
-
stream.eat(/['"]/);
|
169 |
-
}
|
170 |
-
}
|
171 |
-
if (singleline) {
|
172 |
-
if (parserConf.singleLineStringErrors) {
|
173 |
-
return ERRORCLASS;
|
174 |
-
} else {
|
175 |
-
state.tokenize = tokenBase;
|
176 |
-
}
|
177 |
-
}
|
178 |
-
return OUTCLASS;
|
179 |
-
};
|
180 |
-
}
|
181 |
-
|
182 |
-
function indent(stream, state, type) {
|
183 |
-
type = type || 'py';
|
184 |
-
var indentUnit = 0;
|
185 |
-
if (type === 'py') {
|
186 |
-
for (var i = 0; i < state.scopes.length; ++i) {
|
187 |
-
if (state.scopes[i].type === 'py') {
|
188 |
-
indentUnit = state.scopes[i].offset + conf.indentUnit;
|
189 |
-
break;
|
190 |
-
}
|
191 |
-
}
|
192 |
-
} else {
|
193 |
-
indentUnit = stream.column() + stream.current().length;
|
194 |
-
}
|
195 |
-
state.scopes.unshift({
|
196 |
-
offset: indentUnit,
|
197 |
-
type: type
|
198 |
-
});
|
199 |
-
}
|
200 |
-
|
201 |
-
function dedent(stream, state) {
|
202 |
-
if (state.scopes.length == 1) return;
|
203 |
-
if (state.scopes[0].type === 'py') {
|
204 |
-
var _indent = stream.indentation();
|
205 |
-
var _indent_index = -1;
|
206 |
-
for (var i = 0; i < state.scopes.length; ++i) {
|
207 |
-
if (_indent === state.scopes[i].offset) {
|
208 |
-
_indent_index = i;
|
209 |
-
break;
|
210 |
-
}
|
211 |
-
}
|
212 |
-
if (_indent_index === -1) {
|
213 |
-
return true;
|
214 |
-
}
|
215 |
-
while (state.scopes[0].offset !== _indent) {
|
216 |
-
state.scopes.shift();
|
217 |
-
}
|
218 |
-
return false
|
219 |
-
} else {
|
220 |
-
state.scopes.shift();
|
221 |
-
return false;
|
222 |
-
}
|
223 |
-
}
|
224 |
-
|
225 |
-
function tokenLexer(stream, state) {
|
226 |
-
indentInfo = null;
|
227 |
-
var style = state.tokenize(stream, state);
|
228 |
-
var current = stream.current();
|
229 |
-
|
230 |
-
// Handle '.' connected identifiers
|
231 |
-
if (current === '.') {
|
232 |
-
style = state.tokenize(stream, state);
|
233 |
-
current = stream.current();
|
234 |
-
if (style === 'variable') {
|
235 |
-
return 'variable';
|
236 |
-
} else {
|
237 |
-
return ERRORCLASS;
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
// Handle decorators
|
242 |
-
if (current === '@') {
|
243 |
-
style = state.tokenize(stream, state);
|
244 |
-
current = stream.current();
|
245 |
-
if (style === 'variable'
|
246 |
-
|| current === '@staticmethod'
|
247 |
-
|| current === '@classmethod') {
|
248 |
-
return 'meta';
|
249 |
-
} else {
|
250 |
-
return ERRORCLASS;
|
251 |
-
}
|
252 |
-
}
|
253 |
-
|
254 |
-
// Handle scope changes.
|
255 |
-
if (current === 'pass' || current === 'return') {
|
256 |
-
state.dedent += 1;
|
257 |
-
}
|
258 |
-
if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
|
259 |
-
|| indentInfo === 'indent') {
|
260 |
-
indent(stream, state);
|
261 |
-
}
|
262 |
-
var delimiter_index = '[({'.indexOf(current);
|
263 |
-
if (delimiter_index !== -1) {
|
264 |
-
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
|
265 |
-
}
|
266 |
-
if (indentInfo === 'dedent') {
|
267 |
-
if (dedent(stream, state)) {
|
268 |
-
return ERRORCLASS;
|
269 |
-
}
|
270 |
-
}
|
271 |
-
delimiter_index = '])}'.indexOf(current);
|
272 |
-
if (delimiter_index !== -1) {
|
273 |
-
if (dedent(stream, state)) {
|
274 |
-
return ERRORCLASS;
|
275 |
-
}
|
276 |
-
}
|
277 |
-
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
|
278 |
-
if (state.scopes.length > 1) state.scopes.shift();
|
279 |
-
state.dedent -= 1;
|
280 |
-
}
|
281 |
-
|
282 |
-
return style;
|
283 |
-
}
|
284 |
-
|
285 |
-
var external = {
|
286 |
-
startState: function(basecolumn) {
|
287 |
-
return {
|
288 |
-
tokenize: tokenBase,
|
289 |
-
scopes: [{offset:basecolumn || 0, type:'py'}],
|
290 |
-
lastToken: null,
|
291 |
-
lambda: false,
|
292 |
-
dedent: 0
|
293 |
-
};
|
294 |
-
},
|
295 |
-
|
296 |
-
token: function(stream, state) {
|
297 |
-
var style = tokenLexer(stream, state);
|
298 |
-
|
299 |
-
state.lastToken = {style:style, content: stream.current()};
|
300 |
-
|
301 |
-
if (stream.eol() && stream.lambda) {
|
302 |
-
state.lambda = false;
|
303 |
-
}
|
304 |
-
|
305 |
-
return style;
|
306 |
-
},
|
307 |
-
|
308 |
-
indent: function(state, textAfter) {
|
309 |
-
if (state.tokenize != tokenBase) {
|
310 |
-
return 0;
|
311 |
-
}
|
312 |
-
|
313 |
-
return state.scopes[0].offset;
|
314 |
-
}
|
315 |
-
|
316 |
-
};
|
317 |
-
return external;
|
318 |
-
});
|
319 |
-
|
320 |
-
CodeMirror.defineMIME("text/x-python", "python");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/r/LICENSE
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
Copyright (c) 2011, Ubalo, Inc.
|
2 |
-
All rights reserved.
|
3 |
-
|
4 |
-
Redistribution and use in source and binary forms, with or without
|
5 |
-
modification, are permitted provided that the following conditions are met:
|
6 |
-
* Redistributions of source code must retain the above copyright
|
7 |
-
notice, this list of conditions and the following disclaimer.
|
8 |
-
* Redistributions in binary form must reproduce the above copyright
|
9 |
-
notice, this list of conditions and the following disclaimer in the
|
10 |
-
documentation and/or other materials provided with the distribution.
|
11 |
-
* Neither the name of the Ubalo, Inc nor the names of its
|
12 |
-
contributors may be used to endorse or promote products derived
|
13 |
-
from this software without specific prior written permission.
|
14 |
-
|
15 |
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16 |
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17 |
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
-
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
19 |
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20 |
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21 |
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22 |
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23 |
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24 |
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/r/index.html
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: R mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="r.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>
|
10 |
-
.CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
|
11 |
-
.cm-s-default span.cm-semi { color: blue; font-weight: bold; }
|
12 |
-
.cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
|
13 |
-
.cm-s-default span.cm-arrow { color: brown; }
|
14 |
-
.cm-s-default span.cm-arg-is { color: brown; }
|
15 |
-
</style>
|
16 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
17 |
-
</head>
|
18 |
-
<body>
|
19 |
-
<h1>CodeMirror 2: R mode</h1>
|
20 |
-
<form><textarea id="code" name="code">
|
21 |
-
# Code from http://www.mayin.org/ajayshah/KB/R/
|
22 |
-
|
23 |
-
# FIRST LEARN ABOUT LISTS --
|
24 |
-
X = list(height=5.4, weight=54)
|
25 |
-
print("Use default printing --")
|
26 |
-
print(X)
|
27 |
-
print("Accessing individual elements --")
|
28 |
-
cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
|
29 |
-
|
30 |
-
# FUNCTIONS --
|
31 |
-
square <- function(x) {
|
32 |
-
return(x*x)
|
33 |
-
}
|
34 |
-
cat("The square of 3 is ", square(3), "\n")
|
35 |
-
|
36 |
-
# default value of the arg is set to 5.
|
37 |
-
cube <- function(x=5) {
|
38 |
-
return(x*x*x);
|
39 |
-
}
|
40 |
-
cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
|
41 |
-
cat("Calling cube : ", cube(), "\n") # will default to 5^3.
|
42 |
-
|
43 |
-
# LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
|
44 |
-
powers <- function(x) {
|
45 |
-
parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
|
46 |
-
return(parcel);
|
47 |
-
}
|
48 |
-
|
49 |
-
X = powers(3);
|
50 |
-
print("Showing powers of 3 --"); print(X);
|
51 |
-
|
52 |
-
# WRITING THIS COMPACTLY (4 lines instead of 7)
|
53 |
-
|
54 |
-
powerful <- function(x) {
|
55 |
-
return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
|
56 |
-
}
|
57 |
-
print("Showing powers of 3 --"); print(powerful(3));
|
58 |
-
|
59 |
-
# In R, the last expression in a function is, by default, what is
|
60 |
-
# returned. So you could equally just say:
|
61 |
-
powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
|
62 |
-
</textarea></form>
|
63 |
-
<script>
|
64 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
65 |
-
</script>
|
66 |
-
|
67 |
-
<p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
|
68 |
-
|
69 |
-
<p>Development of the CodeMirror R mode was kindly sponsored
|
70 |
-
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
71 |
-
the <a href="LICENSE">license</a>.</p>
|
72 |
-
|
73 |
-
</body>
|
74 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/r/r.js
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("r", function(config) {
|
2 |
-
function wordObj(str) {
|
3 |
-
var words = str.split(" "), res = {};
|
4 |
-
for (var i = 0; i < words.length; ++i) res[words[i]] = true;
|
5 |
-
return res;
|
6 |
-
}
|
7 |
-
var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
|
8 |
-
var builtins = wordObj("list quote bquote eval return call parse deparse");
|
9 |
-
var keywords = wordObj("if else repeat while function for in next break");
|
10 |
-
var blockkeywords = wordObj("if else repeat while function for");
|
11 |
-
var opChars = /[+\-*\/^<>=!&|~$:]/;
|
12 |
-
var curPunc;
|
13 |
-
|
14 |
-
function tokenBase(stream, state) {
|
15 |
-
curPunc = null;
|
16 |
-
var ch = stream.next();
|
17 |
-
if (ch == "#") {
|
18 |
-
stream.skipToEnd();
|
19 |
-
return "comment";
|
20 |
-
} else if (ch == "0" && stream.eat("x")) {
|
21 |
-
stream.eatWhile(/[\da-f]/i);
|
22 |
-
return "number";
|
23 |
-
} else if (ch == "." && stream.eat(/\d/)) {
|
24 |
-
stream.match(/\d*(?:e[+\-]?\d+)?/);
|
25 |
-
return "number";
|
26 |
-
} else if (/\d/.test(ch)) {
|
27 |
-
stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
|
28 |
-
return "number";
|
29 |
-
} else if (ch == "'" || ch == '"') {
|
30 |
-
state.tokenize = tokenString(ch);
|
31 |
-
return "string";
|
32 |
-
} else if (ch == "." && stream.match(/.[.\d]+/)) {
|
33 |
-
return "keyword";
|
34 |
-
} else if (/[\w\.]/.test(ch) && ch != "_") {
|
35 |
-
stream.eatWhile(/[\w\.]/);
|
36 |
-
var word = stream.current();
|
37 |
-
if (atoms.propertyIsEnumerable(word)) return "atom";
|
38 |
-
if (keywords.propertyIsEnumerable(word)) {
|
39 |
-
if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
|
40 |
-
return "keyword";
|
41 |
-
}
|
42 |
-
if (builtins.propertyIsEnumerable(word)) return "builtin";
|
43 |
-
return "variable";
|
44 |
-
} else if (ch == "%") {
|
45 |
-
if (stream.skipTo("%")) stream.next();
|
46 |
-
return "variable-2";
|
47 |
-
} else if (ch == "<" && stream.eat("-")) {
|
48 |
-
return "arrow";
|
49 |
-
} else if (ch == "=" && state.ctx.argList) {
|
50 |
-
return "arg-is";
|
51 |
-
} else if (opChars.test(ch)) {
|
52 |
-
if (ch == "$") return "dollar";
|
53 |
-
stream.eatWhile(opChars);
|
54 |
-
return "operator";
|
55 |
-
} else if (/[\(\){}\[\];]/.test(ch)) {
|
56 |
-
curPunc = ch;
|
57 |
-
if (ch == ";") return "semi";
|
58 |
-
return null;
|
59 |
-
} else {
|
60 |
-
return null;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
function tokenString(quote) {
|
65 |
-
return function(stream, state) {
|
66 |
-
if (stream.eat("\\")) {
|
67 |
-
var ch = stream.next();
|
68 |
-
if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
|
69 |
-
else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
|
70 |
-
else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
|
71 |
-
else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
|
72 |
-
else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
|
73 |
-
return "string-2";
|
74 |
-
} else {
|
75 |
-
var next;
|
76 |
-
while ((next = stream.next()) != null) {
|
77 |
-
if (next == quote) { state.tokenize = tokenBase; break; }
|
78 |
-
if (next == "\\") { stream.backUp(1); break; }
|
79 |
-
}
|
80 |
-
return "string";
|
81 |
-
}
|
82 |
-
};
|
83 |
-
}
|
84 |
-
|
85 |
-
function push(state, type, stream) {
|
86 |
-
state.ctx = {type: type,
|
87 |
-
indent: state.indent,
|
88 |
-
align: null,
|
89 |
-
column: stream.column(),
|
90 |
-
prev: state.ctx};
|
91 |
-
}
|
92 |
-
function pop(state) {
|
93 |
-
state.indent = state.ctx.indent;
|
94 |
-
state.ctx = state.ctx.prev;
|
95 |
-
}
|
96 |
-
|
97 |
-
return {
|
98 |
-
startState: function(base) {
|
99 |
-
return {tokenize: tokenBase,
|
100 |
-
ctx: {type: "top",
|
101 |
-
indent: -config.indentUnit,
|
102 |
-
align: false},
|
103 |
-
indent: 0,
|
104 |
-
afterIdent: false};
|
105 |
-
},
|
106 |
-
|
107 |
-
token: function(stream, state) {
|
108 |
-
if (stream.sol()) {
|
109 |
-
if (state.ctx.align == null) state.ctx.align = false;
|
110 |
-
state.indent = stream.indentation();
|
111 |
-
}
|
112 |
-
if (stream.eatSpace()) return null;
|
113 |
-
var style = state.tokenize(stream, state);
|
114 |
-
if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
|
115 |
-
|
116 |
-
var ctype = state.ctx.type;
|
117 |
-
if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
|
118 |
-
if (curPunc == "{") push(state, "}", stream);
|
119 |
-
else if (curPunc == "(") {
|
120 |
-
push(state, ")", stream);
|
121 |
-
if (state.afterIdent) state.ctx.argList = true;
|
122 |
-
}
|
123 |
-
else if (curPunc == "[") push(state, "]", stream);
|
124 |
-
else if (curPunc == "block") push(state, "block", stream);
|
125 |
-
else if (curPunc == ctype) pop(state);
|
126 |
-
state.afterIdent = style == "variable" || style == "keyword";
|
127 |
-
return style;
|
128 |
-
},
|
129 |
-
|
130 |
-
indent: function(state, textAfter) {
|
131 |
-
if (state.tokenize != tokenBase) return 0;
|
132 |
-
var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
|
133 |
-
closing = firstChar == ctx.type;
|
134 |
-
if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
|
135 |
-
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
136 |
-
else return ctx.indent + (closing ? 0 : config.indentUnit);
|
137 |
-
}
|
138 |
-
};
|
139 |
-
});
|
140 |
-
|
141 |
-
CodeMirror.defineMIME("text/x-rsrc", "r");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/changes/changes.js
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("changes", function(config, modeConfig) {
|
2 |
-
var headerSeperator = /^-+$/;
|
3 |
-
var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
|
4 |
-
var simpleEmail = /^[\w+.-]+@[\w.-]+/;
|
5 |
-
|
6 |
-
return {
|
7 |
-
token: function(stream) {
|
8 |
-
if (stream.sol()) {
|
9 |
-
if (stream.match(headerSeperator)) { return 'tag'; }
|
10 |
-
if (stream.match(headerLine)) { return 'tag'; }
|
11 |
-
}
|
12 |
-
if (stream.match(simpleEmail)) { return 'string'; }
|
13 |
-
stream.next();
|
14 |
-
return null;
|
15 |
-
}
|
16 |
-
};
|
17 |
-
});
|
18 |
-
|
19 |
-
CodeMirror.defineMIME("text/x-rpm-changes", "changes");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/changes/index.html
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: RPM changes mode</title>
|
5 |
-
<link rel="stylesheet" href="../../../lib/codemirror.css">
|
6 |
-
<script src="../../../lib/codemirror.js"></script>
|
7 |
-
<script src="changes.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: RPM changes mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
-------------------------------------------------------------------
|
17 |
-
Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
|
18 |
-
|
19 |
-
- Update to r60.3
|
20 |
-
- Fixes bug in the reflect package
|
21 |
-
* disallow Interface method on Value obtained via unexported name
|
22 |
-
|
23 |
-
-------------------------------------------------------------------
|
24 |
-
Thu Oct 6 08:14:24 UTC 2011 - misterx@example.com
|
25 |
-
|
26 |
-
- Update to r60.2
|
27 |
-
- Fixes memory leak in certain map types
|
28 |
-
|
29 |
-
-------------------------------------------------------------------
|
30 |
-
Wed Oct 5 14:34:10 UTC 2011 - misterx@example.com
|
31 |
-
|
32 |
-
- Tweaks for gdb debugging
|
33 |
-
- go.spec changes:
|
34 |
-
- move %go_arch definition to %prep section
|
35 |
-
- pass correct location of go specific gdb pretty printer and
|
36 |
-
functions to cpp as HOST_EXTRA_CFLAGS macro
|
37 |
-
- install go gdb functions & printer
|
38 |
-
- gdb-printer.patch
|
39 |
-
- patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
|
40 |
-
gdb functions and pretty printer
|
41 |
-
</textarea></div>
|
42 |
-
<script>
|
43 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
44 |
-
mode: {name: "changes"},
|
45 |
-
lineNumbers: true,
|
46 |
-
indentUnit: 4,
|
47 |
-
tabMode: "shift",
|
48 |
-
matchBrackets: true
|
49 |
-
});
|
50 |
-
</script>
|
51 |
-
|
52 |
-
<p><strong>MIME types defined:</strong> <code>text/x-rpm-changes</code>.</p>
|
53 |
-
</body>
|
54 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/spec/index.html
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: RPM spec mode</title>
|
5 |
-
<link rel="stylesheet" href="../../../lib/codemirror.css">
|
6 |
-
<script src="../../../lib/codemirror.js"></script>
|
7 |
-
<script src="spec.js"></script>
|
8 |
-
<link rel="stylesheet" href="spec.css">
|
9 |
-
<link rel="stylesheet" href="../../../theme/default.css">
|
10 |
-
<link rel="stylesheet" href="../../../css/docs.css">
|
11 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
12 |
-
</head>
|
13 |
-
<body>
|
14 |
-
<h1>CodeMirror 2: RPM spec mode</h1>
|
15 |
-
|
16 |
-
<div><textarea id="code" name="code">
|
17 |
-
#
|
18 |
-
# spec file for package minidlna
|
19 |
-
#
|
20 |
-
# Copyright (c) 2011, Sascha Peilicke <saschpe@gmx.de>
|
21 |
-
#
|
22 |
-
# All modifications and additions to the file contributed by third parties
|
23 |
-
# remain the property of their copyright owners, unless otherwise agreed
|
24 |
-
# upon. The license for this file, and modifications and additions to the
|
25 |
-
# file, is the same license as for the pristine package itself (unless the
|
26 |
-
# license for the pristine package is not an Open Source License, in which
|
27 |
-
# case the license is the MIT License). An "Open Source License" is a
|
28 |
-
# license that conforms to the Open Source Definition (Version 1.9)
|
29 |
-
# published by the Open Source Initiative.
|
30 |
-
|
31 |
-
|
32 |
-
Name: libupnp6
|
33 |
-
Version: 1.6.13
|
34 |
-
Release: 0
|
35 |
-
Summary: Portable Universal Plug and Play (UPnP) SDK
|
36 |
-
Group: System/Libraries
|
37 |
-
License: BSD-3-Clause
|
38 |
-
Url: http://sourceforge.net/projects/pupnp/
|
39 |
-
Source0: http://downloads.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2
|
40 |
-
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
41 |
-
|
42 |
-
%description
|
43 |
-
The portable Universal Plug and Play (UPnP) SDK provides support for building
|
44 |
-
UPnP-compliant control points, devices, and bridges on several operating
|
45 |
-
systems.
|
46 |
-
|
47 |
-
%package -n libupnp-devel
|
48 |
-
Summary: Portable Universal Plug and Play (UPnP) SDK
|
49 |
-
Group: Development/Libraries/C and C++
|
50 |
-
Provides: pkgconfig(libupnp)
|
51 |
-
Requires: %{name} = %{version}
|
52 |
-
|
53 |
-
%description -n libupnp-devel
|
54 |
-
The portable Universal Plug and Play (UPnP) SDK provides support for building
|
55 |
-
UPnP-compliant control points, devices, and bridges on several operating
|
56 |
-
systems.
|
57 |
-
|
58 |
-
%prep
|
59 |
-
%setup -n libupnp-%{version}
|
60 |
-
|
61 |
-
%build
|
62 |
-
%configure --disable-static
|
63 |
-
make %{?_smp_mflags}
|
64 |
-
|
65 |
-
%install
|
66 |
-
%makeinstall
|
67 |
-
find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
|
68 |
-
|
69 |
-
%post -p /sbin/ldconfig
|
70 |
-
|
71 |
-
%postun -p /sbin/ldconfig
|
72 |
-
|
73 |
-
%files
|
74 |
-
%defattr(-,root,root,-)
|
75 |
-
%doc ChangeLog NEWS README TODO
|
76 |
-
%{_libdir}/libixml.so.*
|
77 |
-
%{_libdir}/libthreadutil.so.*
|
78 |
-
%{_libdir}/libupnp.so.*
|
79 |
-
|
80 |
-
%files -n libupnp-devel
|
81 |
-
%defattr(-,root,root,-)
|
82 |
-
%{_libdir}/pkgconfig/libupnp.pc
|
83 |
-
%{_libdir}/libixml.so
|
84 |
-
%{_libdir}/libthreadutil.so
|
85 |
-
%{_libdir}/libupnp.so
|
86 |
-
%{_includedir}/upnp/
|
87 |
-
|
88 |
-
%changelog</textarea></div>
|
89 |
-
<script>
|
90 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
91 |
-
mode: {name: "spec"},
|
92 |
-
lineNumbers: true,
|
93 |
-
indentUnit: 4,
|
94 |
-
matchBrackets: true
|
95 |
-
});
|
96 |
-
</script>
|
97 |
-
|
98 |
-
<p><strong>MIME types defined:</strong> <code>text/x-rpm-spec</code>.</p>
|
99 |
-
</body>
|
100 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/spec/spec.css
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
.cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;}
|
2 |
-
.cm-s-default span.cm-macro {color: #b218b2;}
|
3 |
-
.cm-s-default span.cm-section {color: green; font-weight: bold;}
|
4 |
-
.cm-s-default span.cm-script {color: red;}
|
5 |
-
.cm-s-default span.cm-issue {color: yellow;}
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rpm/spec/spec.js
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
// Quick and dirty spec file highlighting
|
2 |
-
|
3 |
-
CodeMirror.defineMode("spec", function(config, modeConfig) {
|
4 |
-
var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
|
5 |
-
|
6 |
-
var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
|
7 |
-
var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preun|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
|
8 |
-
var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
|
9 |
-
var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
|
10 |
-
var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
|
11 |
-
|
12 |
-
return {
|
13 |
-
startState: function () {
|
14 |
-
return {
|
15 |
-
controlFlow: false,
|
16 |
-
macroParameters: false,
|
17 |
-
section: false,
|
18 |
-
};
|
19 |
-
},
|
20 |
-
token: function (stream, state) {
|
21 |
-
var ch = stream.peek();
|
22 |
-
if (ch == "#") { stream.skipToEnd(); return "comment"; }
|
23 |
-
|
24 |
-
if (stream.sol()) {
|
25 |
-
if (stream.match(preamble)) { return "preamble"; }
|
26 |
-
if (stream.match(section)) { return "section"; }
|
27 |
-
}
|
28 |
-
|
29 |
-
if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
|
30 |
-
if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
|
31 |
-
|
32 |
-
if (stream.match(control_flow_simple)) { return "keyword"; }
|
33 |
-
if (stream.match(control_flow_complex)) {
|
34 |
-
state.controlFlow = true;
|
35 |
-
return "keyword";
|
36 |
-
}
|
37 |
-
if (state.controlFlow) {
|
38 |
-
if (stream.match(operators)) { return "operator"; }
|
39 |
-
if (stream.match(/^(\d+)/)) { return "number"; }
|
40 |
-
if (stream.eol()) { state.controlFlow = false; }
|
41 |
-
}
|
42 |
-
|
43 |
-
if (stream.match(arch)) { return "number"; }
|
44 |
-
|
45 |
-
// Macros like '%make_install' or '%attr(0775,root,root)'
|
46 |
-
if (stream.match(/^%[\w]+/)) {
|
47 |
-
if (stream.match(/^\(/)) { state.macroParameters = true; }
|
48 |
-
return "macro";
|
49 |
-
}
|
50 |
-
if (state.macroParameters) {
|
51 |
-
if (stream.match(/^\d+/)) { return "number";}
|
52 |
-
if (stream.match(/^\)/)) {
|
53 |
-
state.macroParameters = false;
|
54 |
-
return "macro";
|
55 |
-
}
|
56 |
-
}
|
57 |
-
if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}'
|
58 |
-
|
59 |
-
//TODO: Include bash script sub-parser (CodeMirror supports that)
|
60 |
-
stream.next();
|
61 |
-
return null;
|
62 |
-
}
|
63 |
-
};
|
64 |
-
});
|
65 |
-
|
66 |
-
CodeMirror.defineMIME("text/x-rpm-spec", "spec");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rst/index.html
DELETED
@@ -1,526 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: reStructuredText mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="rst.js"></script>
|
8 |
-
<link rel="stylesheet" href="rst.css">
|
9 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: reStructuredText mode</h1>
|
14 |
-
|
15 |
-
<form><textarea id="code" name="code">
|
16 |
-
.. This is an excerpt from Sphinx documentation: http://sphinx.pocoo.org/_sources/rest.txt
|
17 |
-
|
18 |
-
.. highlightlang:: rest
|
19 |
-
|
20 |
-
.. _rst-primer:
|
21 |
-
|
22 |
-
reStructuredText Primer
|
23 |
-
=======================
|
24 |
-
|
25 |
-
This section is a brief introduction to reStructuredText (reST) concepts and
|
26 |
-
syntax, intended to provide authors with enough information to author documents
|
27 |
-
productively. Since reST was designed to be a simple, unobtrusive markup
|
28 |
-
language, this will not take too long.
|
29 |
-
|
30 |
-
.. seealso::
|
31 |
-
|
32 |
-
The authoritative `reStructuredText User Documentation
|
33 |
-
<http://docutils.sourceforge.net/rst.html>`_. The "ref" links in this
|
34 |
-
document link to the description of the individual constructs in the reST
|
35 |
-
reference.
|
36 |
-
|
37 |
-
|
38 |
-
Paragraphs
|
39 |
-
----------
|
40 |
-
|
41 |
-
The paragraph (:duref:`ref <paragraphs>`) is the most basic block in a reST
|
42 |
-
document. Paragraphs are simply chunks of text separated by one or more blank
|
43 |
-
lines. As in Python, indentation is significant in reST, so all lines of the
|
44 |
-
same paragraph must be left-aligned to the same level of indentation.
|
45 |
-
|
46 |
-
|
47 |
-
.. _inlinemarkup:
|
48 |
-
|
49 |
-
Inline markup
|
50 |
-
-------------
|
51 |
-
|
52 |
-
The standard reST inline markup is quite simple: use
|
53 |
-
|
54 |
-
* one asterisk: ``*text*`` for emphasis (italics),
|
55 |
-
* two asterisks: ``**text**`` for strong emphasis (boldface), and
|
56 |
-
* backquotes: ````text```` for code samples.
|
57 |
-
|
58 |
-
If asterisks or backquotes appear in running text and could be confused with
|
59 |
-
inline markup delimiters, they have to be escaped with a backslash.
|
60 |
-
|
61 |
-
Be aware of some restrictions of this markup:
|
62 |
-
|
63 |
-
* it may not be nested,
|
64 |
-
* content may not start or end with whitespace: ``* text*`` is wrong,
|
65 |
-
* it must be separated from surrounding text by non-word characters. Use a
|
66 |
-
backslash escaped space to work around that: ``thisis\ *one*\ word``.
|
67 |
-
|
68 |
-
These restrictions may be lifted in future versions of the docutils.
|
69 |
-
|
70 |
-
reST also allows for custom "interpreted text roles"', which signify that the
|
71 |
-
enclosed text should be interpreted in a specific way. Sphinx uses this to
|
72 |
-
provide semantic markup and cross-referencing of identifiers, as described in
|
73 |
-
the appropriate section. The general syntax is ``:rolename:`content```.
|
74 |
-
|
75 |
-
Standard reST provides the following roles:
|
76 |
-
|
77 |
-
* :durole:`emphasis` -- alternate spelling for ``*emphasis*``
|
78 |
-
* :durole:`strong` -- alternate spelling for ``**strong**``
|
79 |
-
* :durole:`literal` -- alternate spelling for ````literal````
|
80 |
-
* :durole:`subscript` -- subscript text
|
81 |
-
* :durole:`superscript` -- superscript text
|
82 |
-
* :durole:`title-reference` -- for titles of books, periodicals, and other
|
83 |
-
materials
|
84 |
-
|
85 |
-
See :ref:`inline-markup` for roles added by Sphinx.
|
86 |
-
|
87 |
-
|
88 |
-
Lists and Quote-like blocks
|
89 |
-
---------------------------
|
90 |
-
|
91 |
-
List markup (:duref:`ref <bullet-lists>`) is natural: just place an asterisk at
|
92 |
-
the start of a paragraph and indent properly. The same goes for numbered lists;
|
93 |
-
they can also be autonumbered using a ``#`` sign::
|
94 |
-
|
95 |
-
* This is a bulleted list.
|
96 |
-
* It has two items, the second
|
97 |
-
item uses two lines.
|
98 |
-
|
99 |
-
1. This is a numbered list.
|
100 |
-
2. It has two items too.
|
101 |
-
|
102 |
-
#. This is a numbered list.
|
103 |
-
#. It has two items too.
|
104 |
-
|
105 |
-
|
106 |
-
Nested lists are possible, but be aware that they must be separated from the
|
107 |
-
parent list items by blank lines::
|
108 |
-
|
109 |
-
* this is
|
110 |
-
* a list
|
111 |
-
|
112 |
-
* with a nested list
|
113 |
-
* and some subitems
|
114 |
-
|
115 |
-
* and here the parent list continues
|
116 |
-
|
117 |
-
Definition lists (:duref:`ref <definition-lists>`) are created as follows::
|
118 |
-
|
119 |
-
term (up to a line of text)
|
120 |
-
Definition of the term, which must be indented
|
121 |
-
|
122 |
-
and can even consist of multiple paragraphs
|
123 |
-
|
124 |
-
next term
|
125 |
-
Description.
|
126 |
-
|
127 |
-
Note that the term cannot have more than one line of text.
|
128 |
-
|
129 |
-
Quoted paragraphs (:duref:`ref <block-quotes>`) are created by just indenting
|
130 |
-
them more than the surrounding paragraphs.
|
131 |
-
|
132 |
-
Line blocks (:duref:`ref <line-blocks>`) are a way of preserving line breaks::
|
133 |
-
|
134 |
-
| These lines are
|
135 |
-
| broken exactly like in
|
136 |
-
| the source file.
|
137 |
-
|
138 |
-
There are also several more special blocks available:
|
139 |
-
|
140 |
-
* field lists (:duref:`ref <field-lists>`)
|
141 |
-
* option lists (:duref:`ref <option-lists>`)
|
142 |
-
* quoted literal blocks (:duref:`ref <quoted-literal-blocks>`)
|
143 |
-
* doctest blocks (:duref:`ref <doctest-blocks>`)
|
144 |
-
|
145 |
-
|
146 |
-
Source Code
|
147 |
-
-----------
|
148 |
-
|
149 |
-
Literal code blocks (:duref:`ref <literal-blocks>`) are introduced by ending a
|
150 |
-
paragraph with the special marker ``::``. The literal block must be indented
|
151 |
-
(and, like all paragraphs, separated from the surrounding ones by blank lines)::
|
152 |
-
|
153 |
-
This is a normal text paragraph. The next paragraph is a code sample::
|
154 |
-
|
155 |
-
It is not processed in any way, except
|
156 |
-
that the indentation is removed.
|
157 |
-
|
158 |
-
It can span multiple lines.
|
159 |
-
|
160 |
-
This is a normal text paragraph again.
|
161 |
-
|
162 |
-
The handling of the ``::`` marker is smart:
|
163 |
-
|
164 |
-
* If it occurs as a paragraph of its own, that paragraph is completely left
|
165 |
-
out of the document.
|
166 |
-
* If it is preceded by whitespace, the marker is removed.
|
167 |
-
* If it is preceded by non-whitespace, the marker is replaced by a single
|
168 |
-
colon.
|
169 |
-
|
170 |
-
That way, the second sentence in the above example's first paragraph would be
|
171 |
-
rendered as "The next paragraph is a code sample:".
|
172 |
-
|
173 |
-
|
174 |
-
.. _rst-tables:
|
175 |
-
|
176 |
-
Tables
|
177 |
-
------
|
178 |
-
|
179 |
-
Two forms of tables are supported. For *grid tables* (:duref:`ref
|
180 |
-
<grid-tables>`), you have to "paint" the cell grid yourself. They look like
|
181 |
-
this::
|
182 |
-
|
183 |
-
+------------------------+------------+----------+----------+
|
184 |
-
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
|
185 |
-
| (header rows optional) | | | |
|
186 |
-
+========================+============+==========+==========+
|
187 |
-
| body row 1, column 1 | column 2 | column 3 | column 4 |
|
188 |
-
+------------------------+------------+----------+----------+
|
189 |
-
| body row 2 | ... | ... | |
|
190 |
-
+------------------------+------------+----------+----------+
|
191 |
-
|
192 |
-
*Simple tables* (:duref:`ref <simple-tables>`) are easier to write, but
|
193 |
-
limited: they must contain more than one row, and the first column cannot
|
194 |
-
contain multiple lines. They look like this::
|
195 |
-
|
196 |
-
===== ===== =======
|
197 |
-
A B A and B
|
198 |
-
===== ===== =======
|
199 |
-
False False False
|
200 |
-
True False False
|
201 |
-
False True False
|
202 |
-
True True True
|
203 |
-
===== ===== =======
|
204 |
-
|
205 |
-
|
206 |
-
Hyperlinks
|
207 |
-
----------
|
208 |
-
|
209 |
-
External links
|
210 |
-
^^^^^^^^^^^^^^
|
211 |
-
|
212 |
-
Use ```Link text <http://example.com/>`_`` for inline web links. If the link
|
213 |
-
text should be the web address, you don't need special markup at all, the parser
|
214 |
-
finds links and mail addresses in ordinary text.
|
215 |
-
|
216 |
-
You can also separate the link and the target definition (:duref:`ref
|
217 |
-
<hyperlink-targets>`), like this::
|
218 |
-
|
219 |
-
This is a paragraph that contains `a link`_.
|
220 |
-
|
221 |
-
.. _a link: http://example.com/
|
222 |
-
|
223 |
-
|
224 |
-
Internal links
|
225 |
-
^^^^^^^^^^^^^^
|
226 |
-
|
227 |
-
Internal linking is done via a special reST role provided by Sphinx, see the
|
228 |
-
section on specific markup, :ref:`ref-role`.
|
229 |
-
|
230 |
-
|
231 |
-
Sections
|
232 |
-
--------
|
233 |
-
|
234 |
-
Section headers (:duref:`ref <sections>`) are created by underlining (and
|
235 |
-
optionally overlining) the section title with a punctuation character, at least
|
236 |
-
as long as the text::
|
237 |
-
|
238 |
-
=================
|
239 |
-
This is a heading
|
240 |
-
=================
|
241 |
-
|
242 |
-
Normally, there are no heading levels assigned to certain characters as the
|
243 |
-
structure is determined from the succession of headings. However, for the
|
244 |
-
Python documentation, this convention is used which you may follow:
|
245 |
-
|
246 |
-
* ``#`` with overline, for parts
|
247 |
-
* ``*`` with overline, for chapters
|
248 |
-
* ``=``, for sections
|
249 |
-
* ``-``, for subsections
|
250 |
-
* ``^``, for subsubsections
|
251 |
-
* ``"``, for paragraphs
|
252 |
-
|
253 |
-
Of course, you are free to use your own marker characters (see the reST
|
254 |
-
documentation), and use a deeper nesting level, but keep in mind that most
|
255 |
-
target formats (HTML, LaTeX) have a limited supported nesting depth.
|
256 |
-
|
257 |
-
|
258 |
-
Explicit Markup
|
259 |
-
---------------
|
260 |
-
|
261 |
-
"Explicit markup" (:duref:`ref <explicit-markup-blocks>`) is used in reST for
|
262 |
-
most constructs that need special handling, such as footnotes,
|
263 |
-
specially-highlighted paragraphs, comments, and generic directives.
|
264 |
-
|
265 |
-
An explicit markup block begins with a line starting with ``..`` followed by
|
266 |
-
whitespace and is terminated by the next paragraph at the same level of
|
267 |
-
indentation. (There needs to be a blank line between explicit markup and normal
|
268 |
-
paragraphs. This may all sound a bit complicated, but it is intuitive enough
|
269 |
-
when you write it.)
|
270 |
-
|
271 |
-
|
272 |
-
.. _directives:
|
273 |
-
|
274 |
-
Directives
|
275 |
-
----------
|
276 |
-
|
277 |
-
A directive (:duref:`ref <directives>`) is a generic block of explicit markup.
|
278 |
-
Besides roles, it is one of the extension mechanisms of reST, and Sphinx makes
|
279 |
-
heavy use of it.
|
280 |
-
|
281 |
-
Docutils supports the following directives:
|
282 |
-
|
283 |
-
* Admonitions: :dudir:`attention`, :dudir:`caution`, :dudir:`danger`,
|
284 |
-
:dudir:`error`, :dudir:`hint`, :dudir:`important`, :dudir:`note`,
|
285 |
-
:dudir:`tip`, :dudir:`warning` and the generic :dudir:`admonition`.
|
286 |
-
(Most themes style only "note" and "warning" specially.)
|
287 |
-
|
288 |
-
* Images:
|
289 |
-
|
290 |
-
- :dudir:`image` (see also Images_ below)
|
291 |
-
- :dudir:`figure` (an image with caption and optional legend)
|
292 |
-
|
293 |
-
* Additional body elements:
|
294 |
-
|
295 |
-
- :dudir:`contents` (a local, i.e. for the current file only, table of
|
296 |
-
contents)
|
297 |
-
- :dudir:`container` (a container with a custom class, useful to generate an
|
298 |
-
outer ``<div>`` in HTML)
|
299 |
-
- :dudir:`rubric` (a heading without relation to the document sectioning)
|
300 |
-
- :dudir:`topic`, :dudir:`sidebar` (special highlighted body elements)
|
301 |
-
- :dudir:`parsed-literal` (literal block that supports inline markup)
|
302 |
-
- :dudir:`epigraph` (a block quote with optional attribution line)
|
303 |
-
- :dudir:`highlights`, :dudir:`pull-quote` (block quotes with their own
|
304 |
-
class attribute)
|
305 |
-
- :dudir:`compound` (a compound paragraph)
|
306 |
-
|
307 |
-
* Special tables:
|
308 |
-
|
309 |
-
- :dudir:`table` (a table with title)
|
310 |
-
- :dudir:`csv-table` (a table generated from comma-separated values)
|
311 |
-
- :dudir:`list-table` (a table generated from a list of lists)
|
312 |
-
|
313 |
-
* Special directives:
|
314 |
-
|
315 |
-
- :dudir:`raw` (include raw target-format markup)
|
316 |
-
- :dudir:`include` (include reStructuredText from another file)
|
317 |
-
-- in Sphinx, when given an absolute include file path, this directive takes
|
318 |
-
it as relative to the source directory
|
319 |
-
- :dudir:`class` (assign a class attribute to the next element) [1]_
|
320 |
-
|
321 |
-
* HTML specifics:
|
322 |
-
|
323 |
-
- :dudir:`meta` (generation of HTML ``<meta>`` tags)
|
324 |
-
- :dudir:`title` (override document title)
|
325 |
-
|
326 |
-
* Influencing markup:
|
327 |
-
|
328 |
-
- :dudir:`default-role` (set a new default role)
|
329 |
-
- :dudir:`role` (create a new role)
|
330 |
-
|
331 |
-
Since these are only per-file, better use Sphinx' facilities for setting the
|
332 |
-
:confval:`default_role`.
|
333 |
-
|
334 |
-
Do *not* use the directives :dudir:`sectnum`, :dudir:`header` and
|
335 |
-
:dudir:`footer`.
|
336 |
-
|
337 |
-
Directives added by Sphinx are described in :ref:`sphinxmarkup`.
|
338 |
-
|
339 |
-
Basically, a directive consists of a name, arguments, options and content. (Keep
|
340 |
-
this terminology in mind, it is used in the next chapter describing custom
|
341 |
-
directives.) Looking at this example, ::
|
342 |
-
|
343 |
-
.. function:: foo(x)
|
344 |
-
foo(y, z)
|
345 |
-
:module: some.module.name
|
346 |
-
|
347 |
-
Return a line of text input from the user.
|
348 |
-
|
349 |
-
``function`` is the directive name. It is given two arguments here, the
|
350 |
-
remainder of the first line and the second line, as well as one option
|
351 |
-
``module`` (as you can see, options are given in the lines immediately following
|
352 |
-
the arguments and indicated by the colons). Options must be indented to the
|
353 |
-
same level as the directive content.
|
354 |
-
|
355 |
-
The directive content follows after a blank line and is indented relative to the
|
356 |
-
directive start.
|
357 |
-
|
358 |
-
|
359 |
-
Images
|
360 |
-
------
|
361 |
-
|
362 |
-
reST supports an image directive (:dudir:`ref <image>`), used like so::
|
363 |
-
|
364 |
-
.. image:: gnu.png
|
365 |
-
(options)
|
366 |
-
|
367 |
-
When used within Sphinx, the file name given (here ``gnu.png``) must either be
|
368 |
-
relative to the source file, or absolute which means that they are relative to
|
369 |
-
the top source directory. For example, the file ``sketch/spam.rst`` could refer
|
370 |
-
to the image ``images/spam.png`` as ``../images/spam.png`` or
|
371 |
-
``/images/spam.png``.
|
372 |
-
|
373 |
-
Sphinx will automatically copy image files over to a subdirectory of the output
|
374 |
-
directory on building (e.g. the ``_static`` directory for HTML output.)
|
375 |
-
|
376 |
-
Interpretation of image size options (``width`` and ``height``) is as follows:
|
377 |
-
if the size has no unit or the unit is pixels, the given size will only be
|
378 |
-
respected for output channels that support pixels (i.e. not in LaTeX output).
|
379 |
-
Other units (like ``pt`` for points) will be used for HTML and LaTeX output.
|
380 |
-
|
381 |
-
Sphinx extends the standard docutils behavior by allowing an asterisk for the
|
382 |
-
extension::
|
383 |
-
|
384 |
-
.. image:: gnu.*
|
385 |
-
|
386 |
-
Sphinx then searches for all images matching the provided pattern and determines
|
387 |
-
their type. Each builder then chooses the best image out of these candidates.
|
388 |
-
For instance, if the file name ``gnu.*`` was given and two files :file:`gnu.pdf`
|
389 |
-
and :file:`gnu.png` existed in the source tree, the LaTeX builder would choose
|
390 |
-
the former, while the HTML builder would prefer the latter.
|
391 |
-
|
392 |
-
.. versionchanged:: 0.4
|
393 |
-
Added the support for file names ending in an asterisk.
|
394 |
-
|
395 |
-
.. versionchanged:: 0.6
|
396 |
-
Image paths can now be absolute.
|
397 |
-
|
398 |
-
|
399 |
-
Footnotes
|
400 |
-
---------
|
401 |
-
|
402 |
-
For footnotes (:duref:`ref <footnotes>`), use ``[#name]_`` to mark the footnote
|
403 |
-
location, and add the footnote body at the bottom of the document after a
|
404 |
-
"Footnotes" rubric heading, like so::
|
405 |
-
|
406 |
-
Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_
|
407 |
-
|
408 |
-
.. rubric:: Footnotes
|
409 |
-
|
410 |
-
.. [#f1] Text of the first footnote.
|
411 |
-
.. [#f2] Text of the second footnote.
|
412 |
-
|
413 |
-
You can also explicitly number the footnotes (``[1]_``) or use auto-numbered
|
414 |
-
footnotes without names (``[#]_``).
|
415 |
-
|
416 |
-
|
417 |
-
Citations
|
418 |
-
---------
|
419 |
-
|
420 |
-
Standard reST citations (:duref:`ref <citations>`) are supported, with the
|
421 |
-
additional feature that they are "global", i.e. all citations can be referenced
|
422 |
-
from all files. Use them like so::
|
423 |
-
|
424 |
-
Lorem ipsum [Ref]_ dolor sit amet.
|
425 |
-
|
426 |
-
.. [Ref] Book or article reference, URL or whatever.
|
427 |
-
|
428 |
-
Citation usage is similar to footnote usage, but with a label that is not
|
429 |
-
numeric or begins with ``#``.
|
430 |
-
|
431 |
-
|
432 |
-
Substitutions
|
433 |
-
-------------
|
434 |
-
|
435 |
-
reST supports "substitutions" (:duref:`ref <substitution-definitions>`), which
|
436 |
-
are pieces of text and/or markup referred to in the text by ``|name|``. They
|
437 |
-
are defined like footnotes with explicit markup blocks, like this::
|
438 |
-
|
439 |
-
.. |name| replace:: replacement *text*
|
440 |
-
|
441 |
-
or this::
|
442 |
-
|
443 |
-
.. |caution| image:: warning.png
|
444 |
-
:alt: Warning!
|
445 |
-
|
446 |
-
See the :duref:`reST reference for substitutions <substitution-definitions>`
|
447 |
-
for details.
|
448 |
-
|
449 |
-
If you want to use some substitutions for all documents, put them into
|
450 |
-
:confval:`rst_prolog` or put them into a separate file and include it into all
|
451 |
-
documents you want to use them in, using the :rst:dir:`include` directive. (Be
|
452 |
-
sure to give the include file a file name extension differing from that of other
|
453 |
-
source files, to avoid Sphinx finding it as a standalone document.)
|
454 |
-
|
455 |
-
Sphinx defines some default substitutions, see :ref:`default-substitutions`.
|
456 |
-
|
457 |
-
|
458 |
-
Comments
|
459 |
-
--------
|
460 |
-
|
461 |
-
Every explicit markup block which isn't a valid markup construct (like the
|
462 |
-
footnotes above) is regarded as a comment (:duref:`ref <comments>`). For
|
463 |
-
example::
|
464 |
-
|
465 |
-
.. This is a comment.
|
466 |
-
|
467 |
-
You can indent text after a comment start to form multiline comments::
|
468 |
-
|
469 |
-
..
|
470 |
-
This whole indented block
|
471 |
-
is a comment.
|
472 |
-
|
473 |
-
Still in the comment.
|
474 |
-
|
475 |
-
|
476 |
-
Source encoding
|
477 |
-
---------------
|
478 |
-
|
479 |
-
Since the easiest way to include special characters like em dashes or copyright
|
480 |
-
signs in reST is to directly write them as Unicode characters, one has to
|
481 |
-
specify an encoding. Sphinx assumes source files to be encoded in UTF-8 by
|
482 |
-
default; you can change this with the :confval:`source_encoding` config value.
|
483 |
-
|
484 |
-
|
485 |
-
Gotchas
|
486 |
-
-------
|
487 |
-
|
488 |
-
There are some problems one commonly runs into while authoring reST documents:
|
489 |
-
|
490 |
-
* **Separation of inline markup:** As said above, inline markup spans must be
|
491 |
-
separated from the surrounding text by non-word characters, you have to use a
|
492 |
-
backslash-escaped space to get around that. See `the reference
|
493 |
-
<http://docutils.sf.net/docs/ref/rst/restructuredtext.html#inline-markup>`_
|
494 |
-
for the details.
|
495 |
-
|
496 |
-
* **No nested inline markup:** Something like ``*see :func:`foo`*`` is not
|
497 |
-
possible.
|
498 |
-
|
499 |
-
|
500 |
-
.. rubric:: Footnotes
|
501 |
-
|
502 |
-
.. [1] When the default domain contains a :rst:dir:`class` directive, this directive
|
503 |
-
will be shadowed. Therefore, Sphinx re-exports it as :rst:dir:`rst-class`.
|
504 |
-
</textarea></form>
|
505 |
-
|
506 |
-
<script>
|
507 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
508 |
-
lineNumbers: true,
|
509 |
-
});
|
510 |
-
</script>
|
511 |
-
<p>The reStructuredText mode supports one configuration parameter:</p>
|
512 |
-
<dl>
|
513 |
-
<dt><code>verbatim (string)</code></dt>
|
514 |
-
<dd>A name or MIME type of a mode that will be used for highlighting
|
515 |
-
verbatim blocks. By default, reStructuredText mode uses uniform color
|
516 |
-
for whole block of verbatim text if no mode is given.</dd>
|
517 |
-
</dl>
|
518 |
-
<p>If <code>python</code> mode is available (not a part of CodeMirror 2 yet),
|
519 |
-
it will be used for highlighting blocks containing Python/IPython terminal
|
520 |
-
sessions (blocks starting with <code>>>></code> (for Python) or
|
521 |
-
<code>In [num]:</code> (for IPython).
|
522 |
-
|
523 |
-
<p><strong>MIME types defined:</strong> <code>text/x-rst</code>.</p>
|
524 |
-
</body>
|
525 |
-
</html>
|
526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rst/rst.css
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
.cm-s-default span.cm-emphasis {
|
2 |
-
font-style: italic;
|
3 |
-
}
|
4 |
-
|
5 |
-
.cm-s-default span.cm-strong {
|
6 |
-
font-weight: bold;
|
7 |
-
}
|
8 |
-
|
9 |
-
.cm-s-default span.cm-interpreted {
|
10 |
-
color: #33cc66;
|
11 |
-
}
|
12 |
-
|
13 |
-
.cm-s-default span.cm-inline {
|
14 |
-
color: #3399cc;
|
15 |
-
}
|
16 |
-
|
17 |
-
.cm-s-default span.cm-role {
|
18 |
-
color: #666699;
|
19 |
-
}
|
20 |
-
|
21 |
-
.cm-s-default span.cm-list {
|
22 |
-
color: #cc0099;
|
23 |
-
font-weight: bold;
|
24 |
-
}
|
25 |
-
|
26 |
-
.cm-s-default span.cm-body {
|
27 |
-
color: #6699cc;
|
28 |
-
}
|
29 |
-
|
30 |
-
.cm-s-default span.cm-verbatim {
|
31 |
-
color: #3366ff;
|
32 |
-
}
|
33 |
-
|
34 |
-
.cm-s-default span.cm-comment {
|
35 |
-
color: #aa7700;
|
36 |
-
}
|
37 |
-
|
38 |
-
.cm-s-default span.cm-directive {
|
39 |
-
font-weight: bold;
|
40 |
-
color: #3399ff;
|
41 |
-
}
|
42 |
-
|
43 |
-
.cm-s-default span.cm-hyperlink {
|
44 |
-
font-weight: bold;
|
45 |
-
color: #3366ff;
|
46 |
-
}
|
47 |
-
|
48 |
-
.cm-s-default span.cm-footnote {
|
49 |
-
font-weight: bold;
|
50 |
-
color: #3333ff;
|
51 |
-
}
|
52 |
-
|
53 |
-
.cm-s-default span.cm-citation {
|
54 |
-
font-weight: bold;
|
55 |
-
color: #3300ff;
|
56 |
-
}
|
57 |
-
|
58 |
-
.cm-s-default span.cm-replacement {
|
59 |
-
color: #9933cc;
|
60 |
-
}
|
61 |
-
|
62 |
-
.cm-s-default span.cm-section {
|
63 |
-
font-weight: bold;
|
64 |
-
color: #cc0099;
|
65 |
-
}
|
66 |
-
|
67 |
-
.cm-s-default span.cm-directive-marker {
|
68 |
-
font-weight: bold;
|
69 |
-
color: #3399ff;
|
70 |
-
}
|
71 |
-
|
72 |
-
.cm-s-default span.cm-verbatim-marker {
|
73 |
-
font-weight: bold;
|
74 |
-
color: #9900ff;
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rst/rst.js
DELETED
@@ -1,333 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode('rst', function(config, options) {
|
2 |
-
function setState(state, fn, ctx) {
|
3 |
-
state.fn = fn;
|
4 |
-
setCtx(state, ctx);
|
5 |
-
}
|
6 |
-
|
7 |
-
function setCtx(state, ctx) {
|
8 |
-
state.ctx = ctx || {};
|
9 |
-
}
|
10 |
-
|
11 |
-
function setNormal(state, ch) {
|
12 |
-
if (ch && (typeof ch !== 'string')) {
|
13 |
-
var str = ch.current();
|
14 |
-
ch = str[str.length-1];
|
15 |
-
}
|
16 |
-
|
17 |
-
setState(state, normal, {back: ch});
|
18 |
-
}
|
19 |
-
|
20 |
-
function hasMode(mode) {
|
21 |
-
if (mode) {
|
22 |
-
var modes = CodeMirror.listModes();
|
23 |
-
|
24 |
-
for (var i in modes) {
|
25 |
-
if (modes[i] == mode) {
|
26 |
-
return true;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
return false;
|
32 |
-
}
|
33 |
-
|
34 |
-
function getMode(mode) {
|
35 |
-
if (hasMode(mode)) {
|
36 |
-
return CodeMirror.getMode(config, mode);
|
37 |
-
} else {
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
var verbatimMode = getMode(options.verbatim);
|
43 |
-
var pythonMode = getMode('python');
|
44 |
-
|
45 |
-
var reSection = /^[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/;
|
46 |
-
var reDirective = /^\s*\w([-:.\w]*\w)?::(\s|$)/;
|
47 |
-
var reHyperlink = /^\s*_[\w-]+:(\s|$)/;
|
48 |
-
var reFootnote = /^\s*\[(\d+|#)\](\s|$)/;
|
49 |
-
var reCitation = /^\s*\[[A-Za-z][\w-]*\](\s|$)/;
|
50 |
-
var reFootnoteRef = /^\[(\d+|#)\]_/;
|
51 |
-
var reCitationRef = /^\[[A-Za-z][\w-]*\]_/;
|
52 |
-
var reDirectiveMarker = /^\.\.(\s|$)/;
|
53 |
-
var reVerbatimMarker = /^::\s*$/;
|
54 |
-
var rePreInline = /^[-\s"([{</:]/;
|
55 |
-
var rePostInline = /^[-\s`'")\]}>/:.,;!?\\_]/;
|
56 |
-
var reEnumeratedList = /^\s*((\d+|[A-Za-z#])[.)]|\((\d+|[A-Z-a-z#])\))\s/;
|
57 |
-
var reBulletedList = /^\s*[-\+\*]\s/;
|
58 |
-
var reExamples = /^\s+(>>>|In \[\d+\]:)\s/;
|
59 |
-
|
60 |
-
function normal(stream, state) {
|
61 |
-
var ch, sol, i;
|
62 |
-
|
63 |
-
if (stream.eat(/\\/)) {
|
64 |
-
ch = stream.next();
|
65 |
-
setNormal(state, ch);
|
66 |
-
return null;
|
67 |
-
}
|
68 |
-
|
69 |
-
sol = stream.sol();
|
70 |
-
|
71 |
-
if (sol && (ch = stream.eat(reSection))) {
|
72 |
-
for (i = 0; stream.eat(ch); i++);
|
73 |
-
|
74 |
-
if (i >= 3 && stream.match(/^\s*$/)) {
|
75 |
-
setNormal(state, null);
|
76 |
-
return 'section';
|
77 |
-
} else {
|
78 |
-
stream.backUp(i + 1);
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
if (sol && stream.match(reDirectiveMarker)) {
|
83 |
-
if (!stream.eol()) {
|
84 |
-
setState(state, directive);
|
85 |
-
}
|
86 |
-
|
87 |
-
return 'directive-marker';
|
88 |
-
}
|
89 |
-
|
90 |
-
if (stream.match(reVerbatimMarker)) {
|
91 |
-
if (!verbatimMode) {
|
92 |
-
setState(state, verbatim);
|
93 |
-
} else {
|
94 |
-
var mode = verbatimMode;
|
95 |
-
|
96 |
-
setState(state, verbatim, {
|
97 |
-
mode: mode,
|
98 |
-
local: mode.startState()
|
99 |
-
});
|
100 |
-
}
|
101 |
-
|
102 |
-
return 'verbatim-marker';
|
103 |
-
}
|
104 |
-
|
105 |
-
if (sol && stream.match(reExamples, false)) {
|
106 |
-
if (!pythonMode) {
|
107 |
-
setState(state, verbatim);
|
108 |
-
return 'verbatim-marker';
|
109 |
-
} else {
|
110 |
-
var mode = pythonMode;
|
111 |
-
|
112 |
-
setState(state, verbatim, {
|
113 |
-
mode: mode,
|
114 |
-
local: mode.startState()
|
115 |
-
});
|
116 |
-
|
117 |
-
return null;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
if (sol && (stream.match(reEnumeratedList) ||
|
122 |
-
stream.match(reBulletedList))) {
|
123 |
-
setNormal(state, stream);
|
124 |
-
return 'list';
|
125 |
-
}
|
126 |
-
|
127 |
-
function testBackward(re) {
|
128 |
-
return sol || !state.ctx.back || re.test(state.ctx.back);
|
129 |
-
}
|
130 |
-
|
131 |
-
function testForward(re) {
|
132 |
-
return stream.eol() || stream.match(re, false);
|
133 |
-
}
|
134 |
-
|
135 |
-
function testInline(re) {
|
136 |
-
return stream.match(re) && testBackward(/\W/) && testForward(/\W/);
|
137 |
-
}
|
138 |
-
|
139 |
-
if (testInline(reFootnoteRef)) {
|
140 |
-
setNormal(state, stream);
|
141 |
-
return 'footnote';
|
142 |
-
}
|
143 |
-
|
144 |
-
if (testInline(reCitationRef)) {
|
145 |
-
setNormal(state, stream);
|
146 |
-
return 'citation';
|
147 |
-
}
|
148 |
-
|
149 |
-
ch = stream.next();
|
150 |
-
|
151 |
-
if (testBackward(rePreInline)) {
|
152 |
-
if ((ch === ':' || ch === '|') && stream.eat(/\S/)) {
|
153 |
-
var token;
|
154 |
-
|
155 |
-
if (ch === ':') {
|
156 |
-
token = 'role';
|
157 |
-
} else {
|
158 |
-
token = 'replacement';
|
159 |
-
}
|
160 |
-
|
161 |
-
setState(state, inline, {
|
162 |
-
ch: ch,
|
163 |
-
wide: false,
|
164 |
-
prev: null,
|
165 |
-
token: token
|
166 |
-
});
|
167 |
-
|
168 |
-
return token;
|
169 |
-
}
|
170 |
-
|
171 |
-
if (ch === '*' || ch === '`') {
|
172 |
-
var orig = ch,
|
173 |
-
wide = false;
|
174 |
-
|
175 |
-
ch = stream.next();
|
176 |
-
|
177 |
-
if (ch == orig) {
|
178 |
-
wide = true;
|
179 |
-
ch = stream.next();
|
180 |
-
}
|
181 |
-
|
182 |
-
if (ch && !/\s/.test(ch)) {
|
183 |
-
var token;
|
184 |
-
|
185 |
-
if (orig === '*') {
|
186 |
-
token = wide ? 'strong' : 'emphasis';
|
187 |
-
} else {
|
188 |
-
token = wide ? 'inline' : 'interpreted';
|
189 |
-
}
|
190 |
-
|
191 |
-
setState(state, inline, {
|
192 |
-
ch: orig, // inline() has to know what to search for
|
193 |
-
wide: wide, // are we looking for `ch` or `chch`
|
194 |
-
prev: null, // terminator must not be preceeded with whitespace
|
195 |
-
token: token // I don't want to recompute this all the time
|
196 |
-
});
|
197 |
-
|
198 |
-
return token;
|
199 |
-
}
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
setNormal(state, ch);
|
204 |
-
return null;
|
205 |
-
}
|
206 |
-
|
207 |
-
function inline(stream, state) {
|
208 |
-
var ch = stream.next(),
|
209 |
-
token = state.ctx.token;
|
210 |
-
|
211 |
-
function finish(ch) {
|
212 |
-
state.ctx.prev = ch;
|
213 |
-
return token;
|
214 |
-
}
|
215 |
-
|
216 |
-
if (ch != state.ctx.ch) {
|
217 |
-
return finish(ch);
|
218 |
-
}
|
219 |
-
|
220 |
-
if (/\s/.test(state.ctx.prev)) {
|
221 |
-
return finish(ch);
|
222 |
-
}
|
223 |
-
|
224 |
-
if (state.ctx.wide) {
|
225 |
-
ch = stream.next();
|
226 |
-
|
227 |
-
if (ch != state.ctx.ch) {
|
228 |
-
return finish(ch);
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
if (!stream.eol() && !rePostInline.test(stream.peek())) {
|
233 |
-
if (state.ctx.wide) {
|
234 |
-
stream.backUp(1);
|
235 |
-
}
|
236 |
-
|
237 |
-
return finish(ch);
|
238 |
-
}
|
239 |
-
|
240 |
-
setState(state, normal);
|
241 |
-
setNormal(state, ch);
|
242 |
-
|
243 |
-
return token;
|
244 |
-
}
|
245 |
-
|
246 |
-
function directive(stream, state) {
|
247 |
-
var token = null;
|
248 |
-
|
249 |
-
if (stream.match(reDirective)) {
|
250 |
-
token = 'directive';
|
251 |
-
} else if (stream.match(reHyperlink)) {
|
252 |
-
token = 'hyperlink';
|
253 |
-
} else if (stream.match(reFootnote)) {
|
254 |
-
token = 'footnote';
|
255 |
-
} else if (stream.match(reCitation)) {
|
256 |
-
token = 'citation';
|
257 |
-
} else {
|
258 |
-
stream.eatSpace();
|
259 |
-
|
260 |
-
if (stream.eol()) {
|
261 |
-
setNormal(state, stream);
|
262 |
-
return null;
|
263 |
-
} else {
|
264 |
-
stream.skipToEnd();
|
265 |
-
setState(state, comment);
|
266 |
-
return 'comment';
|
267 |
-
}
|
268 |
-
}
|
269 |
-
|
270 |
-
setState(state, body, {start: true});
|
271 |
-
return token;
|
272 |
-
}
|
273 |
-
|
274 |
-
function body(stream, state) {
|
275 |
-
var token = 'body';
|
276 |
-
|
277 |
-
if (!state.ctx.start || stream.sol()) {
|
278 |
-
return block(stream, state, token);
|
279 |
-
}
|
280 |
-
|
281 |
-
stream.skipToEnd();
|
282 |
-
setCtx(state);
|
283 |
-
|
284 |
-
return token;
|
285 |
-
}
|
286 |
-
|
287 |
-
function comment(stream, state) {
|
288 |
-
return block(stream, state, 'comment');
|
289 |
-
}
|
290 |
-
|
291 |
-
function verbatim(stream, state) {
|
292 |
-
if (!verbatimMode) {
|
293 |
-
return block(stream, state, 'verbatim');
|
294 |
-
} else {
|
295 |
-
if (stream.sol()) {
|
296 |
-
if (!stream.eatSpace()) {
|
297 |
-
setNormal(state, stream);
|
298 |
-
}
|
299 |
-
|
300 |
-
return null;
|
301 |
-
}
|
302 |
-
|
303 |
-
return verbatimMode.token(stream, state.ctx.local);
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
function block(stream, state, token) {
|
308 |
-
if (stream.eol() || stream.eatSpace()) {
|
309 |
-
stream.skipToEnd();
|
310 |
-
return token;
|
311 |
-
} else {
|
312 |
-
setNormal(state, stream);
|
313 |
-
return null;
|
314 |
-
}
|
315 |
-
}
|
316 |
-
|
317 |
-
return {
|
318 |
-
startState: function() {
|
319 |
-
return {fn: normal, ctx: {}};
|
320 |
-
},
|
321 |
-
|
322 |
-
copyState: function(state) {
|
323 |
-
return {fn: state.fn, ctx: state.ctx};
|
324 |
-
},
|
325 |
-
|
326 |
-
token: function(stream, state) {
|
327 |
-
var token = state.fn(stream, state);
|
328 |
-
return token;
|
329 |
-
}
|
330 |
-
};
|
331 |
-
});
|
332 |
-
|
333 |
-
CodeMirror.defineMIME("text/x-rst", "rst");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ruby/LICENSE
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
Copyright (c) 2011, Ubalo, Inc.
|
2 |
-
All rights reserved.
|
3 |
-
|
4 |
-
Redistribution and use in source and binary forms, with or without
|
5 |
-
modification, are permitted provided that the following conditions are met:
|
6 |
-
* Redistributions of source code must retain the above copyright
|
7 |
-
notice, this list of conditions and the following disclaimer.
|
8 |
-
* Redistributions in binary form must reproduce the above copyright
|
9 |
-
notice, this list of conditions and the following disclaimer in the
|
10 |
-
documentation and/or other materials provided with the distribution.
|
11 |
-
* Neither the name of the Ubalo, Inc. nor the names of its
|
12 |
-
contributors may be used to endorse or promote products derived
|
13 |
-
from this software without specific prior written permission.
|
14 |
-
|
15 |
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16 |
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17 |
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
-
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
19 |
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20 |
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21 |
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22 |
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23 |
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24 |
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ruby/index.html
DELETED
@@ -1,172 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Ruby mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="ruby.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>
|
10 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
11 |
-
.cm-s-default span.cm-arrow { color: red; }
|
12 |
-
</style>
|
13 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
14 |
-
</head>
|
15 |
-
<body>
|
16 |
-
<h1>CodeMirror 2: Ruby mode</h1>
|
17 |
-
<form><textarea id="code" name="code">
|
18 |
-
# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
|
19 |
-
#
|
20 |
-
# This program evaluates polynomials. It first asks for the coefficients
|
21 |
-
# of a polynomial, which must be entered on one line, highest-order first.
|
22 |
-
# It then requests values of x and will compute the value of the poly for
|
23 |
-
# each x. It will repeatly ask for x values, unless you the user enters
|
24 |
-
# a blank line. It that case, it will ask for another polynomial. If the
|
25 |
-
# user types quit for either input, the program immediately exits.
|
26 |
-
#
|
27 |
-
|
28 |
-
#
|
29 |
-
# Function to evaluate a polynomial at x. The polynomial is given
|
30 |
-
# as a list of coefficients, from the greatest to the least.
|
31 |
-
def polyval(x, coef)
|
32 |
-
sum = 0
|
33 |
-
coef = coef.clone # Don't want to destroy the original
|
34 |
-
while true
|
35 |
-
sum += coef.shift # Add and remove the next coef
|
36 |
-
break if coef.empty? # If no more, done entirely.
|
37 |
-
sum *= x # This happens the right number of times.
|
38 |
-
end
|
39 |
-
return sum
|
40 |
-
end
|
41 |
-
|
42 |
-
#
|
43 |
-
# Function to read a line containing a list of integers and return
|
44 |
-
# them as an array of integers. If the string conversion fails, it
|
45 |
-
# throws TypeError. If the input line is the word 'quit', then it
|
46 |
-
# converts it to an end-of-file exception
|
47 |
-
def readints(prompt)
|
48 |
-
# Read a line
|
49 |
-
print prompt
|
50 |
-
line = readline.chomp
|
51 |
-
raise EOFError.new if line == 'quit' # You can also use a real EOF.
|
52 |
-
|
53 |
-
# Go through each item on the line, converting each one and adding it
|
54 |
-
# to retval.
|
55 |
-
retval = [ ]
|
56 |
-
for str in line.split(/\s+/)
|
57 |
-
if str =~ /^\-?\d+$/
|
58 |
-
retval.push(str.to_i)
|
59 |
-
else
|
60 |
-
raise TypeError.new
|
61 |
-
end
|
62 |
-
end
|
63 |
-
|
64 |
-
return retval
|
65 |
-
end
|
66 |
-
|
67 |
-
#
|
68 |
-
# Take a coeff and an exponent and return the string representation, ignoring
|
69 |
-
# the sign of the coefficient.
|
70 |
-
def term_to_str(coef, exp)
|
71 |
-
ret = ""
|
72 |
-
|
73 |
-
# Show coeff, unless it's 1 or at the right
|
74 |
-
coef = coef.abs
|
75 |
-
ret = coef.to_s unless coef == 1 && exp > 0
|
76 |
-
ret += "x" if exp > 0 # x if exponent not 0
|
77 |
-
ret += "^" + exp.to_s if exp > 1 # ^exponent, if > 1.
|
78 |
-
|
79 |
-
return ret
|
80 |
-
end
|
81 |
-
|
82 |
-
#
|
83 |
-
# Create a string of the polynomial in sort-of-readable form.
|
84 |
-
def polystr(p)
|
85 |
-
# Get the exponent of first coefficient, plus 1.
|
86 |
-
exp = p.length
|
87 |
-
|
88 |
-
# Assign exponents to each term, making pairs of coeff and exponent,
|
89 |
-
# Then get rid of the zero terms.
|
90 |
-
p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
|
91 |
-
|
92 |
-
# If there's nothing left, it's a zero
|
93 |
-
return "0" if p.empty?
|
94 |
-
|
95 |
-
# *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
|
96 |
-
|
97 |
-
# Convert the first term, preceded by a "-" if it's negative.
|
98 |
-
result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
|
99 |
-
|
100 |
-
# Convert the rest of the terms, in each case adding the appropriate
|
101 |
-
# + or - separating them.
|
102 |
-
for term in p[1...p.length]
|
103 |
-
# Add the separator then the rep. of the term.
|
104 |
-
result += (if term[0] < 0 then " - " else " + " end) +
|
105 |
-
term_to_str(*term)
|
106 |
-
end
|
107 |
-
|
108 |
-
return result
|
109 |
-
end
|
110 |
-
|
111 |
-
#
|
112 |
-
# Run until some kind of endfile.
|
113 |
-
begin
|
114 |
-
# Repeat until an exception or quit gets us out.
|
115 |
-
while true
|
116 |
-
# Read a poly until it works. An EOF will except out of the
|
117 |
-
# program.
|
118 |
-
print "\n"
|
119 |
-
begin
|
120 |
-
poly = readints("Enter a polynomial coefficients: ")
|
121 |
-
rescue TypeError
|
122 |
-
print "Try again.\n"
|
123 |
-
retry
|
124 |
-
end
|
125 |
-
break if poly.empty?
|
126 |
-
|
127 |
-
# Read and evaluate x values until the user types a blank line.
|
128 |
-
# Again, an EOF will except out of the pgm.
|
129 |
-
while true
|
130 |
-
# Request an integer.
|
131 |
-
print "Enter x value or blank line: "
|
132 |
-
x = readline.chomp
|
133 |
-
break if x == ''
|
134 |
-
raise EOFError.new if x == 'quit'
|
135 |
-
|
136 |
-
# If it looks bad, let's try again.
|
137 |
-
if x !~ /^\-?\d+$/
|
138 |
-
print "That doesn't look like an integer. Please try again.\n"
|
139 |
-
next
|
140 |
-
end
|
141 |
-
|
142 |
-
# Convert to an integer and print the result.
|
143 |
-
x = x.to_i
|
144 |
-
print "p(x) = ", polystr(poly), "\n"
|
145 |
-
print "p(", x, ") = ", polyval(x, poly), "\n"
|
146 |
-
end
|
147 |
-
end
|
148 |
-
rescue EOFError
|
149 |
-
print "\n=== EOF ===\n"
|
150 |
-
rescue Interrupt, SignalException
|
151 |
-
print "\n=== Interrupted ===\n"
|
152 |
-
else
|
153 |
-
print "--- Bye ---\n"
|
154 |
-
end
|
155 |
-
</textarea></form>
|
156 |
-
<script>
|
157 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
158 |
-
mode: "text/x-ruby",
|
159 |
-
tabMode: "indent",
|
160 |
-
matchBrackets: true,
|
161 |
-
indentUnit: 4
|
162 |
-
});
|
163 |
-
</script>
|
164 |
-
|
165 |
-
<p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
|
166 |
-
|
167 |
-
<p>Development of the CodeMirror Ruby mode was kindly sponsored
|
168 |
-
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
169 |
-
the <a href="LICENSE">license</a>.</p>
|
170 |
-
|
171 |
-
</body>
|
172 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/ruby/ruby.js
DELETED
@@ -1,195 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("ruby", function(config, parserConfig) {
|
2 |
-
function wordObj(words) {
|
3 |
-
var o = {};
|
4 |
-
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
|
5 |
-
return o;
|
6 |
-
}
|
7 |
-
var keywords = wordObj([
|
8 |
-
"alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
|
9 |
-
"elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
|
10 |
-
"redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
|
11 |
-
"until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
|
12 |
-
"caller", "lambda", "proc", "public", "protected", "private", "require", "load",
|
13 |
-
"require_relative", "extend", "autoload"
|
14 |
-
]);
|
15 |
-
var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
|
16 |
-
"unless", "catch", "loop", "proc"]);
|
17 |
-
var dedentWords = wordObj(["end", "until"]);
|
18 |
-
var matching = {"[": "]", "{": "}", "(": ")"};
|
19 |
-
var curPunc;
|
20 |
-
|
21 |
-
function chain(newtok, stream, state) {
|
22 |
-
state.tokenize.push(newtok);
|
23 |
-
return newtok(stream, state);
|
24 |
-
}
|
25 |
-
|
26 |
-
function tokenBase(stream, state) {
|
27 |
-
curPunc = null;
|
28 |
-
if (stream.sol() && stream.match("=begin") && stream.eol()) {
|
29 |
-
state.tokenize.push(readBlockComment);
|
30 |
-
return "comment";
|
31 |
-
}
|
32 |
-
if (stream.eatSpace()) return null;
|
33 |
-
var ch = stream.next();
|
34 |
-
if (ch == "`" || ch == "'" || ch == '"' || ch == "/") {
|
35 |
-
return chain(readQuoted(ch, "string", ch == '"'), stream, state);
|
36 |
-
} else if (ch == "%") {
|
37 |
-
var style, embed = false;
|
38 |
-
if (stream.eat("s")) style = "atom";
|
39 |
-
else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; }
|
40 |
-
else if (stream.eat(/[wxqr]/)) style = "string";
|
41 |
-
var delim = stream.eat(/[^\w\s]/);
|
42 |
-
if (!delim) return "operator";
|
43 |
-
if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
|
44 |
-
return chain(readQuoted(delim, style, embed, true), stream, state);
|
45 |
-
} else if (ch == "#") {
|
46 |
-
stream.skipToEnd();
|
47 |
-
return "comment";
|
48 |
-
} else if (ch == "<" && stream.eat("<")) {
|
49 |
-
stream.eat("-");
|
50 |
-
stream.eat(/[\'\"\`]/);
|
51 |
-
var match = stream.match(/^\w+/);
|
52 |
-
stream.eat(/[\'\"\`]/);
|
53 |
-
if (match) return chain(readHereDoc(match[0]), stream, state);
|
54 |
-
return null;
|
55 |
-
} else if (ch == "0") {
|
56 |
-
if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
|
57 |
-
else if (stream.eat("b")) stream.eatWhile(/[01]/);
|
58 |
-
else stream.eatWhile(/[0-7]/);
|
59 |
-
return "number";
|
60 |
-
} else if (/\d/.test(ch)) {
|
61 |
-
stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
|
62 |
-
return "number";
|
63 |
-
} else if (ch == "?") {
|
64 |
-
while (stream.match(/^\\[CM]-/)) {}
|
65 |
-
if (stream.eat("\\")) stream.eatWhile(/\w/);
|
66 |
-
else stream.next();
|
67 |
-
return "string";
|
68 |
-
} else if (ch == ":") {
|
69 |
-
if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
|
70 |
-
if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
|
71 |
-
stream.eatWhile(/[\w\?]/);
|
72 |
-
return "atom";
|
73 |
-
} else if (ch == "@") {
|
74 |
-
stream.eat("@");
|
75 |
-
stream.eatWhile(/[\w\?]/);
|
76 |
-
return "variable-2";
|
77 |
-
} else if (ch == "$") {
|
78 |
-
stream.next();
|
79 |
-
stream.eatWhile(/[\w\?]/);
|
80 |
-
return "variable-3";
|
81 |
-
} else if (/\w/.test(ch)) {
|
82 |
-
stream.eatWhile(/[\w\?]/);
|
83 |
-
if (stream.eat(":")) return "atom";
|
84 |
-
return "ident";
|
85 |
-
} else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
|
86 |
-
curPunc = "|";
|
87 |
-
return null;
|
88 |
-
} else if (/[\(\)\[\]{}\\;]/.test(ch)) {
|
89 |
-
curPunc = ch;
|
90 |
-
return null;
|
91 |
-
} else if (ch == "-" && stream.eat(">")) {
|
92 |
-
return "arrow";
|
93 |
-
} else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
|
94 |
-
stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
|
95 |
-
return "operator";
|
96 |
-
} else {
|
97 |
-
return null;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
function tokenBaseUntilBrace() {
|
102 |
-
var depth = 1;
|
103 |
-
return function(stream, state) {
|
104 |
-
if (stream.peek() == "}") {
|
105 |
-
depth--;
|
106 |
-
if (depth == 0) {
|
107 |
-
state.tokenize.pop();
|
108 |
-
return state.tokenize[state.tokenize.length-1](stream, state);
|
109 |
-
}
|
110 |
-
} else if (stream.peek() == "{") {
|
111 |
-
depth++;
|
112 |
-
}
|
113 |
-
return tokenBase(stream, state);
|
114 |
-
};
|
115 |
-
}
|
116 |
-
function readQuoted(quote, style, embed, unescaped) {
|
117 |
-
return function(stream, state) {
|
118 |
-
var escaped = false, ch;
|
119 |
-
while ((ch = stream.next()) != null) {
|
120 |
-
if (ch == quote && (unescaped || !escaped)) {
|
121 |
-
state.tokenize.pop();
|
122 |
-
break;
|
123 |
-
}
|
124 |
-
if (embed && ch == "#" && !escaped && stream.eat("{")) {
|
125 |
-
state.tokenize.push(tokenBaseUntilBrace(arguments.callee));
|
126 |
-
break;
|
127 |
-
}
|
128 |
-
escaped = !escaped && ch == "\\";
|
129 |
-
}
|
130 |
-
return style;
|
131 |
-
};
|
132 |
-
}
|
133 |
-
function readHereDoc(phrase) {
|
134 |
-
return function(stream, state) {
|
135 |
-
if (stream.match(phrase)) state.tokenize.pop();
|
136 |
-
else stream.skipToEnd();
|
137 |
-
return "string";
|
138 |
-
};
|
139 |
-
}
|
140 |
-
function readBlockComment(stream, state) {
|
141 |
-
if (stream.sol() && stream.match("=end") && stream.eol())
|
142 |
-
state.tokenize.pop();
|
143 |
-
stream.skipToEnd();
|
144 |
-
return "comment";
|
145 |
-
}
|
146 |
-
|
147 |
-
return {
|
148 |
-
startState: function() {
|
149 |
-
return {tokenize: [tokenBase],
|
150 |
-
indented: 0,
|
151 |
-
context: {type: "top", indented: -config.indentUnit},
|
152 |
-
continuedLine: false,
|
153 |
-
lastTok: null,
|
154 |
-
varList: false};
|
155 |
-
},
|
156 |
-
|
157 |
-
token: function(stream, state) {
|
158 |
-
if (stream.sol()) state.indented = stream.indentation();
|
159 |
-
var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
|
160 |
-
if (style == "ident") {
|
161 |
-
var word = stream.current();
|
162 |
-
style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
|
163 |
-
: /^[A-Z]/.test(word) ? "tag"
|
164 |
-
: (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
|
165 |
-
: "variable";
|
166 |
-
if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
|
167 |
-
else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
|
168 |
-
else if (word == "if" && stream.column() == stream.indentation()) kwtype = "indent";
|
169 |
-
}
|
170 |
-
if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
|
171 |
-
if (curPunc == "|") state.varList = !state.varList;
|
172 |
-
|
173 |
-
if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
|
174 |
-
state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
|
175 |
-
else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
|
176 |
-
state.context = state.context.prev;
|
177 |
-
|
178 |
-
if (stream.eol())
|
179 |
-
state.continuedLine = (curPunc == "\\" || style == "operator");
|
180 |
-
return style;
|
181 |
-
},
|
182 |
-
|
183 |
-
indent: function(state, textAfter) {
|
184 |
-
if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
|
185 |
-
var firstChar = textAfter && textAfter.charAt(0);
|
186 |
-
var ct = state.context;
|
187 |
-
var closing = ct.type == matching[firstChar] ||
|
188 |
-
ct.type == "keyword" && /^(?:end|until|else|elsif|when)\b/.test(textAfter);
|
189 |
-
return ct.indented + (closing ? 0 : config.indentUnit) +
|
190 |
-
(state.continuedLine ? config.indentUnit : 0);
|
191 |
-
}
|
192 |
-
};
|
193 |
-
});
|
194 |
-
|
195 |
-
CodeMirror.defineMIME("text/x-ruby", "ruby");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rust/index.html
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Rust mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="rust.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Rust mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
// Demo code.
|
17 |
-
|
18 |
-
type foo<T> = int;
|
19 |
-
tag bar {
|
20 |
-
some(int, foo<float>);
|
21 |
-
none;
|
22 |
-
}
|
23 |
-
|
24 |
-
fn check_crate(x: int) {
|
25 |
-
let v = 10;
|
26 |
-
alt foo {
|
27 |
-
1 to 3 {
|
28 |
-
print_foo();
|
29 |
-
if x {
|
30 |
-
blah() + 10;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
(x, y) { "bye" }
|
34 |
-
_ { "hi" }
|
35 |
-
}
|
36 |
-
}
|
37 |
-
</textarea></div>
|
38 |
-
|
39 |
-
<script>
|
40 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
41 |
-
lineNumbers: true,
|
42 |
-
matchBrackets: true,
|
43 |
-
tabMode: "indent"
|
44 |
-
});
|
45 |
-
</script>
|
46 |
-
|
47 |
-
<p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
|
48 |
-
</body>
|
49 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/rust/rust.js
DELETED
@@ -1,411 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("rust", function() {
|
2 |
-
var indentUnit = 4, altIndentUnit = 2;
|
3 |
-
var valKeywords = {
|
4 |
-
"if": "if-style", "while": "if-style", "else": "else-style",
|
5 |
-
"do": "else-style", "ret": "else-style", "fail": "else-style",
|
6 |
-
"break": "atom", "cont": "atom", "const": "let", "resource": "fn",
|
7 |
-
"let": "let", "fn": "fn", "for": "for", "alt": "alt", "obj": "fn",
|
8 |
-
"lambda": "fn", "type": "type", "tag": "tag", "mod": "mod",
|
9 |
-
"as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op",
|
10 |
-
"claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style",
|
11 |
-
"export": "else-style", "copy": "op", "log": "op", "log_err": "op",
|
12 |
-
"use": "op", "bind": "op"
|
13 |
-
};
|
14 |
-
var typeKeywords = function() {
|
15 |
-
var keywords = {"fn": "fn", "block": "fn", "obj": "obj"};
|
16 |
-
var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" ");
|
17 |
-
for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom";
|
18 |
-
return keywords;
|
19 |
-
}();
|
20 |
-
var operatorChar = /[+\-*&%=<>!?|\.@]/;
|
21 |
-
|
22 |
-
// Tokenizer
|
23 |
-
|
24 |
-
// Used as scratch variable to communicate multiple values without
|
25 |
-
// consing up tons of objects.
|
26 |
-
var tcat, content;
|
27 |
-
function r(tc, style) {
|
28 |
-
tcat = tc;
|
29 |
-
return style;
|
30 |
-
}
|
31 |
-
|
32 |
-
function tokenBase(stream, state) {
|
33 |
-
var ch = stream.next();
|
34 |
-
if (ch == '"') {
|
35 |
-
state.tokenize = tokenString;
|
36 |
-
return state.tokenize(stream, state);
|
37 |
-
}
|
38 |
-
if (ch == "'") {
|
39 |
-
tcat = "atom";
|
40 |
-
if (stream.eat("\\")) {
|
41 |
-
if (stream.skipTo("'")) { stream.next(); return "string"; }
|
42 |
-
else { return "error"; }
|
43 |
-
} else {
|
44 |
-
stream.next();
|
45 |
-
return stream.eat("'") ? "string" : "error";
|
46 |
-
}
|
47 |
-
}
|
48 |
-
if (ch == "/") {
|
49 |
-
if (stream.eat("/")) { stream.skipToEnd(); return "comment"; }
|
50 |
-
if (stream.eat("*")) {
|
51 |
-
state.tokenize = tokenComment(1);
|
52 |
-
return state.tokenize(stream, state);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
if (ch == "#") {
|
56 |
-
if (stream.eat("[")) { tcat = "open-attr"; return null; }
|
57 |
-
stream.eatWhile(/\w/);
|
58 |
-
return r("macro", "meta");
|
59 |
-
}
|
60 |
-
if (ch == ":" && stream.match(":<")) {
|
61 |
-
return r("op", null);
|
62 |
-
}
|
63 |
-
if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) {
|
64 |
-
var flp = false;
|
65 |
-
if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) {
|
66 |
-
stream.eatWhile(/\d/);
|
67 |
-
if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); }
|
68 |
-
if (stream.match(/^e[+\-]?\d+/i)) { flp = true; }
|
69 |
-
}
|
70 |
-
if (flp) stream.match(/^f(?:32|64)/);
|
71 |
-
else stream.match(/^[ui](?:8|16|32|64)/);
|
72 |
-
return r("atom", "number");
|
73 |
-
}
|
74 |
-
if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null);
|
75 |
-
if (ch == "-" && stream.eat(">")) return r("->", null);
|
76 |
-
if (ch.match(operatorChar)) {
|
77 |
-
stream.eatWhile(operatorChar);
|
78 |
-
return r("op", null);
|
79 |
-
}
|
80 |
-
stream.eatWhile(/\w/);
|
81 |
-
content = stream.current();
|
82 |
-
if (stream.match(/^::\w/)) {
|
83 |
-
stream.backUp(1);
|
84 |
-
return r("prefix", "variable-2");
|
85 |
-
}
|
86 |
-
if (state.keywords.propertyIsEnumerable(content))
|
87 |
-
return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword");
|
88 |
-
return r("name", "variable");
|
89 |
-
}
|
90 |
-
|
91 |
-
function tokenString(stream, state) {
|
92 |
-
var ch, escaped = false;
|
93 |
-
while (ch = stream.next()) {
|
94 |
-
if (ch == '"' && !escaped) {
|
95 |
-
state.tokenize = tokenBase;
|
96 |
-
return r("atom", "string");
|
97 |
-
}
|
98 |
-
escaped = !escaped && ch == "\\";
|
99 |
-
}
|
100 |
-
// Hack to not confuse the parser when a string is split in
|
101 |
-
// pieces.
|
102 |
-
return r("op", "string");
|
103 |
-
}
|
104 |
-
|
105 |
-
function tokenComment(depth) {
|
106 |
-
return function(stream, state) {
|
107 |
-
var lastCh = null, ch;
|
108 |
-
while (ch = stream.next()) {
|
109 |
-
if (ch == "/" && lastCh == "*") {
|
110 |
-
if (depth == 1) {
|
111 |
-
state.tokenize = tokenBase;
|
112 |
-
break;
|
113 |
-
} else {
|
114 |
-
state.tokenize = tokenComment(depth - 1);
|
115 |
-
return state.tokenize(stream, state);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
if (ch == "*" && lastCh == "/") {
|
119 |
-
state.tokenize = tokenComment(depth + 1);
|
120 |
-
return state.tokenize(stream, state);
|
121 |
-
}
|
122 |
-
lastCh = ch;
|
123 |
-
}
|
124 |
-
return "comment";
|
125 |
-
};
|
126 |
-
}
|
127 |
-
|
128 |
-
// Parser
|
129 |
-
|
130 |
-
var cx = {state: null, stream: null, marked: null, cc: null};
|
131 |
-
function pass() {
|
132 |
-
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
133 |
-
}
|
134 |
-
function cont() {
|
135 |
-
pass.apply(null, arguments);
|
136 |
-
return true;
|
137 |
-
}
|
138 |
-
|
139 |
-
function pushlex(type, info) {
|
140 |
-
var result = function() {
|
141 |
-
var state = cx.state;
|
142 |
-
state.lexical = {indented: state.indented, column: cx.stream.column(),
|
143 |
-
type: type, prev: state.lexical, info: info};
|
144 |
-
};
|
145 |
-
result.lex = true;
|
146 |
-
return result;
|
147 |
-
}
|
148 |
-
function poplex() {
|
149 |
-
var state = cx.state;
|
150 |
-
if (state.lexical.prev) {
|
151 |
-
if (state.lexical.type == ")")
|
152 |
-
state.indented = state.lexical.indented;
|
153 |
-
state.lexical = state.lexical.prev;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
function typecx() { cx.state.keywords = typeKeywords; }
|
157 |
-
function valcx() { cx.state.keywords = valKeywords; }
|
158 |
-
poplex.lex = typecx.lex = valcx.lex = true;
|
159 |
-
|
160 |
-
function commasep(comb, end) {
|
161 |
-
function more(type) {
|
162 |
-
if (type == ",") return cont(comb, more);
|
163 |
-
if (type == end) return cont();
|
164 |
-
return cont(more);
|
165 |
-
}
|
166 |
-
return function(type) {
|
167 |
-
if (type == end) return cont();
|
168 |
-
return pass(comb, more);
|
169 |
-
};
|
170 |
-
}
|
171 |
-
|
172 |
-
function block(type) {
|
173 |
-
if (type == "}") return cont();
|
174 |
-
if (type == "let") return cont(pushlex("stat", "let"), letdef1, poplex, block);
|
175 |
-
if (type == "fn") return cont(pushlex("stat"), fndef, poplex, block);
|
176 |
-
if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block);
|
177 |
-
if (type == "tag") return cont(pushlex("stat"), tagdef, poplex, block);
|
178 |
-
if (type == "mod") return cont(pushlex("stat"), mod, poplex, block);
|
179 |
-
if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex);
|
180 |
-
if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block);
|
181 |
-
return pass(pushlex("stat"), expression, poplex, endstatement, block);
|
182 |
-
}
|
183 |
-
function endstatement(type) {
|
184 |
-
if (type == ";") return cont();
|
185 |
-
return pass();
|
186 |
-
}
|
187 |
-
function expression(type) {
|
188 |
-
if (type == "atom" || type == "name") return cont(maybeop);
|
189 |
-
if (type == "{") return cont(pushlex("}"), exprbrace, poplex);
|
190 |
-
if (type.match(/[\[\(]/)) return matchBrackets(type, expression);
|
191 |
-
if (type.match(/[\]\)\};,]/)) return pass();
|
192 |
-
if (type == "if-style") return cont(expression, expression);
|
193 |
-
if (type == "else-style" || type == "op") return cont(expression);
|
194 |
-
if (type == "for") return cont(pattern, maybetype, inop, expression, expression);
|
195 |
-
if (type == "alt") return cont(expression, altbody);
|
196 |
-
if (type == "fn") return cont(fndef);
|
197 |
-
if (type == "macro") return cont(macro);
|
198 |
-
return cont();
|
199 |
-
}
|
200 |
-
function maybeop(type) {
|
201 |
-
if (content == ".") return cont(maybeprop);
|
202 |
-
if (content == "::<"){return cont(typarams, maybeop);}
|
203 |
-
if (type == "op" || content == ":") return cont(expression);
|
204 |
-
if (type == "(" || type == "[") return matchBrackets(type, expression);
|
205 |
-
return pass();
|
206 |
-
}
|
207 |
-
function maybeprop(type) {
|
208 |
-
if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);}
|
209 |
-
return pass(expression);
|
210 |
-
}
|
211 |
-
function exprbrace(type) {
|
212 |
-
if (type == "op") {
|
213 |
-
if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block);
|
214 |
-
if (content == "||") return cont(poplex, pushlex("}", "block"), block);
|
215 |
-
}
|
216 |
-
if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
|
217 |
-
&& !cx.stream.match("::", false)))
|
218 |
-
return pass(record_of(expression));
|
219 |
-
return pass(block);
|
220 |
-
}
|
221 |
-
function record_of(comb) {
|
222 |
-
function ro(type) {
|
223 |
-
if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);}
|
224 |
-
if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);}
|
225 |
-
if (type == ":") return cont(comb, ro);
|
226 |
-
if (type == "}") return cont();
|
227 |
-
return cont(ro);
|
228 |
-
}
|
229 |
-
return ro;
|
230 |
-
}
|
231 |
-
function blockvars(type) {
|
232 |
-
if (type == "name") {cx.marked = "def"; return cont(blockvars);}
|
233 |
-
if (type == "op" && content == "|") return cont();
|
234 |
-
return cont(blockvars);
|
235 |
-
}
|
236 |
-
|
237 |
-
function letdef1(type) {
|
238 |
-
if (type.match(/[\]\)\};]/)) return cont();
|
239 |
-
if (content == "=") return cont(expression, letdef2);
|
240 |
-
if (type == ",") return cont(letdef1);
|
241 |
-
return pass(pattern, maybetype, letdef1);
|
242 |
-
}
|
243 |
-
function letdef2(type) {
|
244 |
-
if (type.match(/[\]\)\};,]/)) return pass(letdef1);
|
245 |
-
else return pass(expression, letdef2);
|
246 |
-
}
|
247 |
-
function maybetype(type) {
|
248 |
-
if (type == ":") return cont(typecx, rtype, valcx);
|
249 |
-
return pass();
|
250 |
-
}
|
251 |
-
function inop(type) {
|
252 |
-
if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();}
|
253 |
-
return pass();
|
254 |
-
}
|
255 |
-
function fndef(type) {
|
256 |
-
if (type == "name") {cx.marked = "def"; return cont(fndef);}
|
257 |
-
if (content == "<") return cont(typarams, fndef);
|
258 |
-
if (type == "{") return pass(expression);
|
259 |
-
if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef);
|
260 |
-
if (type == "->") return cont(typecx, rtype, valcx, fndef);
|
261 |
-
return cont(fndef);
|
262 |
-
}
|
263 |
-
function tydef(type) {
|
264 |
-
if (type == "name") {cx.marked = "def"; return cont(tydef);}
|
265 |
-
if (content == "<") return cont(typarams, tydef);
|
266 |
-
if (content == "=") return cont(typecx, rtype, valcx);
|
267 |
-
return cont(tydef);
|
268 |
-
}
|
269 |
-
function tagdef(type) {
|
270 |
-
if (type == "name") {cx.marked = "def"; return cont(tagdef);}
|
271 |
-
if (content == "<") return cont(typarams, tagdef);
|
272 |
-
if (content == "=") return cont(typecx, rtype, valcx, endstatement);
|
273 |
-
if (type == "{") return cont(pushlex("}"), typecx, tagblock, valcx, poplex);
|
274 |
-
return cont(tagdef);
|
275 |
-
}
|
276 |
-
function tagblock(type) {
|
277 |
-
if (type == "}") return cont();
|
278 |
-
if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, tagblock);
|
279 |
-
if (content.match(/^\w+$/)) cx.marked = "def";
|
280 |
-
return cont(tagblock);
|
281 |
-
}
|
282 |
-
function mod(type) {
|
283 |
-
if (type == "name") {cx.marked = "def"; return cont(mod);}
|
284 |
-
if (type == "{") return cont(pushlex("}"), block, poplex);
|
285 |
-
return pass();
|
286 |
-
}
|
287 |
-
function typarams(type) {
|
288 |
-
if (content == ">") return cont();
|
289 |
-
if (content == ",") return cont(typarams);
|
290 |
-
return pass(rtype, typarams);
|
291 |
-
}
|
292 |
-
function argdef(type) {
|
293 |
-
if (type == "name") {cx.marked = "def"; return cont(argdef);}
|
294 |
-
if (type == ":") return cont(typecx, rtype, valcx);
|
295 |
-
return pass();
|
296 |
-
}
|
297 |
-
function rtype(type) {
|
298 |
-
if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); }
|
299 |
-
if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);}
|
300 |
-
if (type == "atom") return cont(rtypemaybeparam);
|
301 |
-
if (type == "op" || type == "obj") return cont(rtype);
|
302 |
-
if (type == "fn") return cont(fntype);
|
303 |
-
if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex);
|
304 |
-
return matchBrackets(type, rtype);
|
305 |
-
}
|
306 |
-
function rtypemaybeparam(type) {
|
307 |
-
if (content == "<") return cont(typarams);
|
308 |
-
return pass();
|
309 |
-
}
|
310 |
-
function fntype(type) {
|
311 |
-
if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype);
|
312 |
-
if (type == "->") return cont(rtype);
|
313 |
-
return pass();
|
314 |
-
}
|
315 |
-
function pattern(type) {
|
316 |
-
if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);}
|
317 |
-
if (type == "atom") return cont(patternmaybeop);
|
318 |
-
if (type == "op") return cont(pattern);
|
319 |
-
if (type.match(/[\]\)\};,]/)) return pass();
|
320 |
-
return matchBrackets(type, pattern);
|
321 |
-
}
|
322 |
-
function patternmaybeop(type) {
|
323 |
-
if (type == "op" && content == ".") return cont();
|
324 |
-
if (content == "to") {cx.marked = "keyword"; return cont(pattern);}
|
325 |
-
else return pass();
|
326 |
-
}
|
327 |
-
function altbody(type) {
|
328 |
-
if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex);
|
329 |
-
return pass();
|
330 |
-
}
|
331 |
-
function altblock1(type) {
|
332 |
-
if (type == "}") return cont();
|
333 |
-
if (type == "|") return cont(altblock1);
|
334 |
-
if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);}
|
335 |
-
if (type.match(/[\]\);,]/)) return cont(altblock1);
|
336 |
-
return pass(pattern, altblock2);
|
337 |
-
}
|
338 |
-
function altblock2(type) {
|
339 |
-
if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1);
|
340 |
-
else return pass(altblock1);
|
341 |
-
}
|
342 |
-
|
343 |
-
function macro(type) {
|
344 |
-
if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression);
|
345 |
-
return pass();
|
346 |
-
}
|
347 |
-
function matchBrackets(type, comb) {
|
348 |
-
if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex);
|
349 |
-
if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex);
|
350 |
-
if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex);
|
351 |
-
return cont();
|
352 |
-
}
|
353 |
-
|
354 |
-
function parse(state, stream, style) {
|
355 |
-
var cc = state.cc;
|
356 |
-
// Communicate our context to the combinators.
|
357 |
-
// (Less wasteful than consing up a hundred closures on every call.)
|
358 |
-
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
359 |
-
|
360 |
-
while (true) {
|
361 |
-
var combinator = cc.length ? cc.pop() : block;
|
362 |
-
if (combinator(tcat)) {
|
363 |
-
while(cc.length && cc[cc.length - 1].lex)
|
364 |
-
cc.pop()();
|
365 |
-
return cx.marked || style;
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
return {
|
371 |
-
startState: function() {
|
372 |
-
return {
|
373 |
-
tokenize: tokenBase,
|
374 |
-
cc: [],
|
375 |
-
lexical: {indented: -indentUnit, column: 0, type: "top", align: false},
|
376 |
-
keywords: valKeywords,
|
377 |
-
indented: 0
|
378 |
-
};
|
379 |
-
},
|
380 |
-
|
381 |
-
token: function(stream, state) {
|
382 |
-
if (stream.sol()) {
|
383 |
-
if (!state.lexical.hasOwnProperty("align"))
|
384 |
-
state.lexical.align = false;
|
385 |
-
state.indented = stream.indentation();
|
386 |
-
}
|
387 |
-
if (stream.eatSpace()) return null;
|
388 |
-
tcat = content = null;
|
389 |
-
var style = state.tokenize(stream, state);
|
390 |
-
if (style == "comment") return style;
|
391 |
-
if (!state.lexical.hasOwnProperty("align"))
|
392 |
-
state.lexical.align = true;
|
393 |
-
if (tcat == "prefix") return style;
|
394 |
-
if (!content) content = stream.current();
|
395 |
-
return parse(state, stream, style);
|
396 |
-
},
|
397 |
-
|
398 |
-
indent: function(state, textAfter) {
|
399 |
-
if (state.tokenize != tokenBase) return 0;
|
400 |
-
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
|
401 |
-
type = lexical.type, closing = firstChar == type;
|
402 |
-
if (type == "stat") return lexical.indented + indentUnit;
|
403 |
-
if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
404 |
-
return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit));
|
405 |
-
},
|
406 |
-
|
407 |
-
electricChars: "{}"
|
408 |
-
};
|
409 |
-
});
|
410 |
-
|
411 |
-
CodeMirror.defineMIME("text/x-rustsrc", "rust");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/scheme/index.html
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Scheme mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="scheme.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>.CodeMirror {background: #f8f8f8;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: Scheme mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
; See if the input starts with a given symbol.
|
16 |
-
(define (match-symbol input pattern)
|
17 |
-
(cond ((null? (remain input)) #f)
|
18 |
-
((eqv? (car (remain input)) pattern) (r-cdr input))
|
19 |
-
(else #f)))
|
20 |
-
|
21 |
-
; Allow the input to start with one of a list of patterns.
|
22 |
-
(define (match-or input pattern)
|
23 |
-
(cond ((null? pattern) #f)
|
24 |
-
((match-pattern input (car pattern)))
|
25 |
-
(else (match-or input (cdr pattern)))))
|
26 |
-
|
27 |
-
; Allow a sequence of patterns.
|
28 |
-
(define (match-seq input pattern)
|
29 |
-
(if (null? pattern)
|
30 |
-
input
|
31 |
-
(let ((match (match-pattern input (car pattern))))
|
32 |
-
(if match (match-seq match (cdr pattern)) #f))))
|
33 |
-
|
34 |
-
; Match with the pattern but no problem if it does not match.
|
35 |
-
(define (match-opt input pattern)
|
36 |
-
(let ((match (match-pattern input (car pattern))))
|
37 |
-
(if match match input)))
|
38 |
-
|
39 |
-
; Match anything (other than '()), until pattern is found. The rather
|
40 |
-
; clumsy form of requiring an ending pattern is needed to decide where
|
41 |
-
; the end of the match is. If none is given, this will match the rest
|
42 |
-
; of the sentence.
|
43 |
-
(define (match-any input pattern)
|
44 |
-
(cond ((null? (remain input)) #f)
|
45 |
-
((null? pattern) (f-cons (remain input) (clear-remain input)))
|
46 |
-
(else
|
47 |
-
(let ((accum-any (collector)))
|
48 |
-
(define (match-pattern-any input pattern)
|
49 |
-
(cond ((null? (remain input)) #f)
|
50 |
-
(else (accum-any (car (remain input)))
|
51 |
-
(cond ((match-pattern (r-cdr input) pattern))
|
52 |
-
(else (match-pattern-any (r-cdr input) pattern))))))
|
53 |
-
(let ((retval (match-pattern-any input (car pattern))))
|
54 |
-
(if retval
|
55 |
-
(f-cons (accum-any) retval)
|
56 |
-
#f))))))
|
57 |
-
</textarea></form>
|
58 |
-
<script>
|
59 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
60 |
-
</script>
|
61 |
-
|
62 |
-
<p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p>
|
63 |
-
|
64 |
-
</body>
|
65 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/scheme/scheme.js
DELETED
@@ -1,202 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
|
3 |
-
*/
|
4 |
-
CodeMirror.defineMode("scheme", function (config, mode) {
|
5 |
-
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
|
6 |
-
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
|
7 |
-
var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
|
8 |
-
|
9 |
-
function makeKeywords(str) {
|
10 |
-
var obj = {}, words = str.split(" ");
|
11 |
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
12 |
-
return obj;
|
13 |
-
}
|
14 |
-
|
15 |
-
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
16 |
-
var indentKeys = makeKeywords("define let letrec let* lambda");
|
17 |
-
|
18 |
-
|
19 |
-
function stateStack(indent, type, prev) { // represents a state stack object
|
20 |
-
this.indent = indent;
|
21 |
-
this.type = type;
|
22 |
-
this.prev = prev;
|
23 |
-
}
|
24 |
-
|
25 |
-
function pushStack(state, indent, type) {
|
26 |
-
state.indentStack = new stateStack(indent, type, state.indentStack);
|
27 |
-
}
|
28 |
-
|
29 |
-
function popStack(state) {
|
30 |
-
state.indentStack = state.indentStack.prev;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Scheme numbers are complicated unfortunately.
|
35 |
-
* Checks if we're looking at a number, which might be possibly a fraction.
|
36 |
-
* Also checks that it is not part of a longer identifier. Returns true/false accordingly.
|
37 |
-
*/
|
38 |
-
function isNumber(ch, stream){
|
39 |
-
if(/[0-9]/.exec(ch) != null){
|
40 |
-
stream.eatWhile(/[0-9]/);
|
41 |
-
stream.eat(/\//);
|
42 |
-
stream.eatWhile(/[0-9]/);
|
43 |
-
if (stream.eol() || !(/[a-zA-Z\-\_\/]/.exec(stream.peek()))) return true;
|
44 |
-
stream.backUp(stream.current().length - 1); // undo all the eating
|
45 |
-
}
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
|
49 |
-
return {
|
50 |
-
startState: function () {
|
51 |
-
return {
|
52 |
-
indentStack: null,
|
53 |
-
indentation: 0,
|
54 |
-
mode: false,
|
55 |
-
sExprComment: false
|
56 |
-
};
|
57 |
-
},
|
58 |
-
|
59 |
-
token: function (stream, state) {
|
60 |
-
if (state.indentStack == null && stream.sol()) {
|
61 |
-
// update indentation, but only if indentStack is empty
|
62 |
-
state.indentation = stream.indentation();
|
63 |
-
}
|
64 |
-
|
65 |
-
// skip spaces
|
66 |
-
if (stream.eatSpace()) {
|
67 |
-
return null;
|
68 |
-
}
|
69 |
-
var returnType = null;
|
70 |
-
|
71 |
-
switch(state.mode){
|
72 |
-
case "string": // multi-line string parsing mode
|
73 |
-
var next, escaped = false;
|
74 |
-
while ((next = stream.next()) != null) {
|
75 |
-
if (next == "\"" && !escaped) {
|
76 |
-
|
77 |
-
state.mode = false;
|
78 |
-
break;
|
79 |
-
}
|
80 |
-
escaped = !escaped && next == "\\";
|
81 |
-
}
|
82 |
-
returnType = STRING; // continue on in scheme-string mode
|
83 |
-
break;
|
84 |
-
case "comment": // comment parsing mode
|
85 |
-
var next, maybeEnd = false;
|
86 |
-
while ((next = stream.next()) != null) {
|
87 |
-
if (next == "#" && maybeEnd) {
|
88 |
-
|
89 |
-
state.mode = false;
|
90 |
-
break;
|
91 |
-
}
|
92 |
-
maybeEnd = (next == "|");
|
93 |
-
}
|
94 |
-
returnType = COMMENT;
|
95 |
-
break;
|
96 |
-
case "s-expr-comment": // s-expr commenting mode
|
97 |
-
state.mode = false;
|
98 |
-
if(stream.peek() == "(" || stream.peek() == "["){
|
99 |
-
// actually start scheme s-expr commenting mode
|
100 |
-
state.sExprComment = 0;
|
101 |
-
}else{
|
102 |
-
// if not we just comment the entire of the next token
|
103 |
-
stream.eatWhile(/[^/s]/); // eat non spaces
|
104 |
-
returnType = COMMENT;
|
105 |
-
break;
|
106 |
-
}
|
107 |
-
default: // default parsing mode
|
108 |
-
var ch = stream.next();
|
109 |
-
|
110 |
-
if (ch == "\"") {
|
111 |
-
state.mode = "string";
|
112 |
-
returnType = STRING;
|
113 |
-
|
114 |
-
} else if (ch == "'") {
|
115 |
-
returnType = ATOM;
|
116 |
-
} else if (ch == '#') {
|
117 |
-
if (stream.eat("|")) { // Multi-line comment
|
118 |
-
state.mode = "comment"; // toggle to comment mode
|
119 |
-
returnType = COMMENT;
|
120 |
-
} else if (stream.eat(/[tf]/)) { // #t/#f (atom)
|
121 |
-
returnType = ATOM;
|
122 |
-
} else if (stream.eat(';')) { // S-Expr comment
|
123 |
-
state.mode = "s-expr-comment";
|
124 |
-
returnType = COMMENT;
|
125 |
-
}
|
126 |
-
|
127 |
-
} else if (ch == ";") { // comment
|
128 |
-
stream.skipToEnd(); // rest of the line is a comment
|
129 |
-
returnType = COMMENT;
|
130 |
-
} else if (ch == "-"){
|
131 |
-
|
132 |
-
if(!isNaN(parseInt(stream.peek()))){
|
133 |
-
stream.eatWhile(/[\/0-9]/);
|
134 |
-
returnType = NUMBER;
|
135 |
-
}else{
|
136 |
-
returnType = null;
|
137 |
-
}
|
138 |
-
} else if (isNumber(ch,stream)){
|
139 |
-
returnType = NUMBER;
|
140 |
-
} else if (ch == "(" || ch == "[") {
|
141 |
-
var keyWord = ''; var indentTemp = stream.column();
|
142 |
-
/**
|
143 |
-
Either
|
144 |
-
(indent-word ..
|
145 |
-
(non-indent-word ..
|
146 |
-
(;something else, bracket, etc.
|
147 |
-
*/
|
148 |
-
|
149 |
-
while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
|
150 |
-
keyWord += letter;
|
151 |
-
}
|
152 |
-
|
153 |
-
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
|
154 |
-
|
155 |
-
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
156 |
-
} else { // non-indent word
|
157 |
-
// we continue eating the spaces
|
158 |
-
stream.eatSpace();
|
159 |
-
if (stream.eol() || stream.peek() == ";") {
|
160 |
-
// nothing significant after
|
161 |
-
// we restart indentation 1 space after
|
162 |
-
pushStack(state, indentTemp + 1, ch);
|
163 |
-
} else {
|
164 |
-
pushStack(state, indentTemp + stream.current().length, ch); // else we match
|
165 |
-
}
|
166 |
-
}
|
167 |
-
stream.backUp(stream.current().length - 1); // undo all the eating
|
168 |
-
|
169 |
-
if(typeof state.sExprComment == "number") state.sExprComment++;
|
170 |
-
|
171 |
-
returnType = BRACKET;
|
172 |
-
} else if (ch == ")" || ch == "]") {
|
173 |
-
returnType = BRACKET;
|
174 |
-
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
175 |
-
popStack(state);
|
176 |
-
|
177 |
-
if(typeof state.sExprComment == "number"){
|
178 |
-
if(--state.sExprComment == 0){
|
179 |
-
returnType = COMMENT; // final closing bracket
|
180 |
-
state.sExprComment = false; // turn off s-expr commenting mode
|
181 |
-
}
|
182 |
-
}
|
183 |
-
}
|
184 |
-
} else {
|
185 |
-
stream.eatWhile(/[\w\$_\-]/);
|
186 |
-
|
187 |
-
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
|
188 |
-
returnType = BUILTIN;
|
189 |
-
}else returnType = null;
|
190 |
-
}
|
191 |
-
}
|
192 |
-
return (typeof state.sExprComment == "number") ? COMMENT : returnType;
|
193 |
-
},
|
194 |
-
|
195 |
-
indent: function (state, textAfter) {
|
196 |
-
if (state.indentStack == null) return state.indentation;
|
197 |
-
return state.indentStack.indent;
|
198 |
-
}
|
199 |
-
};
|
200 |
-
});
|
201 |
-
|
202 |
-
CodeMirror.defineMIME("text/x-scheme", "scheme");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/smalltalk/index.html
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: Smalltalk mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="smalltalk.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style>
|
11 |
-
.CodeMirror {border: 2px solid #dee; border-right-width: 10px;}
|
12 |
-
.CodeMirror-gutter {border: none; background: #dee;}
|
13 |
-
.CodeMirror-gutter pre {color: white; font-weight: bold;}
|
14 |
-
</style>
|
15 |
-
</head>
|
16 |
-
<body>
|
17 |
-
<h1>CodeMirror 2: Smalltalk mode</h1>
|
18 |
-
|
19 |
-
<form><textarea id="code" name="code">
|
20 |
-
"
|
21 |
-
This is a test of the Smalltalk code
|
22 |
-
"
|
23 |
-
Seaside.WAComponent subclass: #MyCounter [
|
24 |
-
| count |
|
25 |
-
MyCounter class >> canBeRoot [ ^true ]
|
26 |
-
|
27 |
-
initialize [
|
28 |
-
super initialize.
|
29 |
-
count := 0.
|
30 |
-
]
|
31 |
-
states [ ^{ self } ]
|
32 |
-
renderContentOn: html [
|
33 |
-
html heading: count.
|
34 |
-
html anchor callback: [ count := count + 1 ]; with: '++'.
|
35 |
-
html space.
|
36 |
-
html anchor callback: [ count := count - 1 ]; with: '--'.
|
37 |
-
]
|
38 |
-
]
|
39 |
-
|
40 |
-
MyCounter registerAsApplication: 'mycounter'
|
41 |
-
</textarea></form>
|
42 |
-
|
43 |
-
<script>
|
44 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
45 |
-
lineNumbers: true,
|
46 |
-
matchBrackets: true,
|
47 |
-
mode: "text/x-stsrc",
|
48 |
-
indentUnit: 4
|
49 |
-
});
|
50 |
-
</script>
|
51 |
-
|
52 |
-
<p>Simple Smalltalk mode.</p>
|
53 |
-
|
54 |
-
<p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p>
|
55 |
-
</body>
|
56 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/smalltalk/smalltalk.js
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("smalltalk", function(config, parserConfig) {
|
2 |
-
var keywords = {"true": 1, "false": 1, nil: 1, self: 1, "super": 1, thisContext: 1};
|
3 |
-
var indentUnit = config.indentUnit;
|
4 |
-
|
5 |
-
function chain(stream, state, f) {
|
6 |
-
state.tokenize = f;
|
7 |
-
return f(stream, state);
|
8 |
-
}
|
9 |
-
|
10 |
-
var type;
|
11 |
-
function ret(tp, style) {
|
12 |
-
type = tp;
|
13 |
-
return style;
|
14 |
-
}
|
15 |
-
|
16 |
-
function tokenBase(stream, state) {
|
17 |
-
var ch = stream.next();
|
18 |
-
if (ch == '"')
|
19 |
-
return chain(stream, state, tokenComment(ch));
|
20 |
-
else if (ch == "'")
|
21 |
-
return chain(stream, state, tokenString(ch));
|
22 |
-
else if (ch == "#") {
|
23 |
-
stream.eatWhile(/[\w\$_]/);
|
24 |
-
return ret("string", "string");
|
25 |
-
}
|
26 |
-
else if (ch == '$') {
|
27 |
-
if (stream.next() == "<") {
|
28 |
-
stream.eatWhile(/\d/);
|
29 |
-
stream.eat(/\>/);
|
30 |
-
}
|
31 |
-
return ret("string", "string");
|
32 |
-
}
|
33 |
-
else if (ch == "^" || (ch == ":" && stream.eat("="))) {
|
34 |
-
return ret("operator", "operator");
|
35 |
-
}
|
36 |
-
else if (/\d/.test(ch)) {
|
37 |
-
stream.eatWhile(/[\w\.]/)
|
38 |
-
return ret("number", "number");
|
39 |
-
}
|
40 |
-
else if (/[\[\]()]/.test(ch)) {
|
41 |
-
return ret(ch, null);
|
42 |
-
}
|
43 |
-
else {
|
44 |
-
stream.eatWhile(/[\w\$_]/);
|
45 |
-
if (keywords && keywords.propertyIsEnumerable(stream.current())) return ret("keyword", "keyword");
|
46 |
-
return ret("word", "variable");
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
function tokenString(quote) {
|
51 |
-
return function(stream, state) {
|
52 |
-
var escaped = false, next, end = false;
|
53 |
-
while ((next = stream.next()) != null) {
|
54 |
-
if (next == quote && !escaped) {end = true; break;}
|
55 |
-
escaped = !escaped && next == "\\";
|
56 |
-
}
|
57 |
-
if (end || !(escaped))
|
58 |
-
state.tokenize = tokenBase;
|
59 |
-
return ret("string", "string");
|
60 |
-
};
|
61 |
-
}
|
62 |
-
|
63 |
-
function tokenComment(quote) {
|
64 |
-
return function(stream, state) {
|
65 |
-
var next, end = false;
|
66 |
-
while ((next = stream.next()) != null) {
|
67 |
-
if (next == quote) {end = true; break;}
|
68 |
-
}
|
69 |
-
if (end)
|
70 |
-
state.tokenize = tokenBase;
|
71 |
-
return ret("comment", "comment");
|
72 |
-
};
|
73 |
-
}
|
74 |
-
|
75 |
-
function Context(indented, column, type, align, prev) {
|
76 |
-
this.indented = indented;
|
77 |
-
this.column = column;
|
78 |
-
this.type = type;
|
79 |
-
this.align = align;
|
80 |
-
this.prev = prev;
|
81 |
-
}
|
82 |
-
|
83 |
-
function pushContext(state, col, type) {
|
84 |
-
return state.context = new Context(state.indented, col, type, null, state.context);
|
85 |
-
}
|
86 |
-
function popContext(state) {
|
87 |
-
return state.context = state.context.prev;
|
88 |
-
}
|
89 |
-
|
90 |
-
// Interface
|
91 |
-
|
92 |
-
return {
|
93 |
-
startState: function(basecolumn) {
|
94 |
-
return {
|
95 |
-
tokenize: tokenBase,
|
96 |
-
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
97 |
-
indented: 0,
|
98 |
-
startOfLine: true
|
99 |
-
};
|
100 |
-
},
|
101 |
-
|
102 |
-
token: function(stream, state) {
|
103 |
-
var ctx = state.context;
|
104 |
-
if (stream.sol()) {
|
105 |
-
if (ctx.align == null) ctx.align = false;
|
106 |
-
state.indented = stream.indentation();
|
107 |
-
state.startOfLine = true;
|
108 |
-
}
|
109 |
-
if (stream.eatSpace()) return null;
|
110 |
-
var style = state.tokenize(stream, state);
|
111 |
-
if (type == "comment") return style;
|
112 |
-
if (ctx.align == null) ctx.align = true;
|
113 |
-
|
114 |
-
if (type == "[") pushContext(state, stream.column(), "]");
|
115 |
-
else if (type == "(") pushContext(state, stream.column(), ")");
|
116 |
-
else if (type == ctx.type) popContext(state);
|
117 |
-
state.startOfLine = false;
|
118 |
-
return style;
|
119 |
-
},
|
120 |
-
|
121 |
-
indent: function(state, textAfter) {
|
122 |
-
if (state.tokenize != tokenBase) return 0;
|
123 |
-
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
|
124 |
-
if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
125 |
-
else return ctx.indented + (closing ? 0 : indentUnit);
|
126 |
-
},
|
127 |
-
|
128 |
-
electricChars: "]"
|
129 |
-
};
|
130 |
-
});
|
131 |
-
|
132 |
-
CodeMirror.defineMIME("text/x-stsrc", {name: "smalltalk"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/sparql/index.html
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: SPARQL mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="sparql.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: SPARQL mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
|
16 |
-
PREFIX dc: <http://purl.org/dc/elements/1.1/>
|
17 |
-
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
|
18 |
-
|
19 |
-
# Comment!
|
20 |
-
|
21 |
-
SELECT ?given ?family
|
22 |
-
WHERE {
|
23 |
-
?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
|
24 |
-
?annot dc:creator ?c .
|
25 |
-
OPTIONAL {?c foaf:given ?given ;
|
26 |
-
foaf:family ?family } .
|
27 |
-
FILTER isBlank(?c)
|
28 |
-
}
|
29 |
-
</textarea></form>
|
30 |
-
<script>
|
31 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
32 |
-
mode: "application/x-sparql-query",
|
33 |
-
tabMode: "indent",
|
34 |
-
matchBrackets: true
|
35 |
-
});
|
36 |
-
</script>
|
37 |
-
|
38 |
-
<p><strong>MIME types defined:</strong> <code>application/x-sparql-query</code>.</p>
|
39 |
-
|
40 |
-
</body>
|
41 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/sparql/sparql.js
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("sparql", function(config) {
|
2 |
-
var indentUnit = config.indentUnit;
|
3 |
-
var curPunc;
|
4 |
-
|
5 |
-
function wordRegexp(words) {
|
6 |
-
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
7 |
-
}
|
8 |
-
var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
|
9 |
-
"isblank", "isliteral", "union", "a"]);
|
10 |
-
var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
|
11 |
-
"ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
|
12 |
-
"graph", "by", "asc", "desc"]);
|
13 |
-
var operatorChars = /[*+\-<>=&|]/;
|
14 |
-
|
15 |
-
function tokenBase(stream, state) {
|
16 |
-
var ch = stream.next();
|
17 |
-
curPunc = null;
|
18 |
-
if (ch == "$" || ch == "?") {
|
19 |
-
stream.match(/^[\w\d]*/);
|
20 |
-
return "variable-2";
|
21 |
-
}
|
22 |
-
else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
|
23 |
-
stream.match(/^[^\s\u00a0>]*>?/);
|
24 |
-
return "atom";
|
25 |
-
}
|
26 |
-
else if (ch == "\"" || ch == "'") {
|
27 |
-
state.tokenize = tokenLiteral(ch);
|
28 |
-
return state.tokenize(stream, state);
|
29 |
-
}
|
30 |
-
else if (/[{}\(\),\.;\[\]]/.test(ch)) {
|
31 |
-
curPunc = ch;
|
32 |
-
return null;
|
33 |
-
}
|
34 |
-
else if (ch == "#") {
|
35 |
-
stream.skipToEnd();
|
36 |
-
return "comment";
|
37 |
-
}
|
38 |
-
else if (operatorChars.test(ch)) {
|
39 |
-
stream.eatWhile(operatorChars);
|
40 |
-
return null;
|
41 |
-
}
|
42 |
-
else if (ch == ":") {
|
43 |
-
stream.eatWhile(/[\w\d\._\-]/);
|
44 |
-
return "atom";
|
45 |
-
}
|
46 |
-
else {
|
47 |
-
stream.eatWhile(/[_\w\d]/);
|
48 |
-
if (stream.eat(":")) {
|
49 |
-
stream.eatWhile(/[\w\d_\-]/);
|
50 |
-
return "atom";
|
51 |
-
}
|
52 |
-
var word = stream.current(), type;
|
53 |
-
if (ops.test(word))
|
54 |
-
return null;
|
55 |
-
else if (keywords.test(word))
|
56 |
-
return "keyword";
|
57 |
-
else
|
58 |
-
return "variable";
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
function tokenLiteral(quote) {
|
63 |
-
return function(stream, state) {
|
64 |
-
var escaped = false, ch;
|
65 |
-
while ((ch = stream.next()) != null) {
|
66 |
-
if (ch == quote && !escaped) {
|
67 |
-
state.tokenize = tokenBase;
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
escaped = !escaped && ch == "\\";
|
71 |
-
}
|
72 |
-
return "string";
|
73 |
-
};
|
74 |
-
}
|
75 |
-
|
76 |
-
function pushContext(state, type, col) {
|
77 |
-
state.context = {prev: state.context, indent: state.indent, col: col, type: type};
|
78 |
-
}
|
79 |
-
function popContext(state) {
|
80 |
-
state.indent = state.context.indent;
|
81 |
-
state.context = state.context.prev;
|
82 |
-
}
|
83 |
-
|
84 |
-
return {
|
85 |
-
startState: function(base) {
|
86 |
-
return {tokenize: tokenBase,
|
87 |
-
context: null,
|
88 |
-
indent: 0,
|
89 |
-
col: 0};
|
90 |
-
},
|
91 |
-
|
92 |
-
token: function(stream, state) {
|
93 |
-
if (stream.sol()) {
|
94 |
-
if (state.context && state.context.align == null) state.context.align = false;
|
95 |
-
state.indent = stream.indentation();
|
96 |
-
}
|
97 |
-
if (stream.eatSpace()) return null;
|
98 |
-
var style = state.tokenize(stream, state);
|
99 |
-
|
100 |
-
if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
|
101 |
-
state.context.align = true;
|
102 |
-
}
|
103 |
-
|
104 |
-
if (curPunc == "(") pushContext(state, ")", stream.column());
|
105 |
-
else if (curPunc == "[") pushContext(state, "]", stream.column());
|
106 |
-
else if (curPunc == "{") pushContext(state, "}", stream.column());
|
107 |
-
else if (/[\]\}\)]/.test(curPunc)) {
|
108 |
-
while (state.context && state.context.type == "pattern") popContext(state);
|
109 |
-
if (state.context && curPunc == state.context.type) popContext(state);
|
110 |
-
}
|
111 |
-
else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
|
112 |
-
else if (/atom|string|variable/.test(style) && state.context) {
|
113 |
-
if (/[\}\]]/.test(state.context.type))
|
114 |
-
pushContext(state, "pattern", stream.column());
|
115 |
-
else if (state.context.type == "pattern" && !state.context.align) {
|
116 |
-
state.context.align = true;
|
117 |
-
state.context.col = stream.column();
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
return style;
|
122 |
-
},
|
123 |
-
|
124 |
-
indent: function(state, textAfter) {
|
125 |
-
var firstChar = textAfter && textAfter.charAt(0);
|
126 |
-
var context = state.context;
|
127 |
-
if (/[\]\}]/.test(firstChar))
|
128 |
-
while (context && context.type == "pattern") context = context.prev;
|
129 |
-
|
130 |
-
var closing = context && firstChar == context.type;
|
131 |
-
if (!context)
|
132 |
-
return 0;
|
133 |
-
else if (context.type == "pattern")
|
134 |
-
return context.col;
|
135 |
-
else if (context.align)
|
136 |
-
return context.col + (closing ? 0 : 1);
|
137 |
-
else
|
138 |
-
return context.indent + (closing ? 0 : indentUnit);
|
139 |
-
}
|
140 |
-
};
|
141 |
-
});
|
142 |
-
|
143 |
-
CodeMirror.defineMIME("application/x-sparql-query", "sparql");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/stex/index.html
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: sTeX mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="stex.js"></script>
|
8 |
-
<link rel="stylesheet" href="../../theme/default.css">
|
9 |
-
<style>.CodeMirror {background: #f8f8f8;}</style>
|
10 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: sTeX mode</h1>
|
14 |
-
<form><textarea id="code" name="code">
|
15 |
-
\begin{module}[id=bbt-size]
|
16 |
-
\importmodule[balanced-binary-trees]{balanced-binary-trees}
|
17 |
-
\importmodule[\KWARCslides{dmath/en/cardinality}]{cardinality}
|
18 |
-
|
19 |
-
\begin{frame}
|
20 |
-
\frametitle{Size Lemma for Balanced Trees}
|
21 |
-
\begin{itemize}
|
22 |
-
\item
|
23 |
-
\begin{assertion}[id=size-lemma,type=lemma]
|
24 |
-
Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree}
|
25 |
-
of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set
|
26 |
-
$\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of
|
27 |
-
\termref[cd=graphs-intro,name=node]{nodes} at
|
28 |
-
\termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has
|
29 |
-
\termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$.
|
30 |
-
\end{assertion}
|
31 |
-
\item
|
32 |
-
\begin{sproof}[id=size-lemma-pf,proofend=,for=size-lemma]{via induction over the depth $i$.}
|
33 |
-
\begin{spfcases}{We have to consider two cases}
|
34 |
-
\begin{spfcase}{$i=0$}
|
35 |
-
\begin{spfstep}[display=flow]
|
36 |
-
then $\livar{V}i=\set{\livar{v}r}$, where $\livar{v}r$ is the root, so
|
37 |
-
$\eq{\card{\livar{V}0},\card{\set{\livar{v}r}},1,\power20}$.
|
38 |
-
\end{spfstep}
|
39 |
-
\end{spfcase}
|
40 |
-
\begin{spfcase}{$i>0$}
|
41 |
-
\begin{spfstep}[display=flow]
|
42 |
-
then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes
|
43 |
-
\begin{justification}[method=byIH](IH)\end{justification}
|
44 |
-
\end{spfstep}
|
45 |
-
\begin{spfstep}
|
46 |
-
By the \begin{justification}[method=byDef]definition of a binary
|
47 |
-
tree\end{justification}, each $\inset{v}{\livar{V}{i-1}}$ is a leaf or has
|
48 |
-
two children that are at depth $i$.
|
49 |
-
\end{spfstep}
|
50 |
-
\begin{spfstep}
|
51 |
-
As $G$ is \termref[cd=balanced-binary-trees,name=balanced-binary-tree]{balanced} and $\gdepth{G}=n>i$, $\livar{V}{i-1}$ cannot contain
|
52 |
-
leaves.
|
53 |
-
\end{spfstep}
|
54 |
-
\begin{spfstep}[type=conclusion]
|
55 |
-
Thus $\eq{\card{\livar{V}i},{\atimes[cdot]{2,\card{\livar{V}{i-1}}}},{\atimes[cdot]{2,\power2{i-1}}},\power2i}$.
|
56 |
-
\end{spfstep}
|
57 |
-
\end{spfcase}
|
58 |
-
\end{spfcases}
|
59 |
-
\end{sproof}
|
60 |
-
\item
|
61 |
-
\begin{assertion}[id=fbbt,type=corollary]
|
62 |
-
A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes.
|
63 |
-
\end{assertion}
|
64 |
-
\item
|
65 |
-
\begin{sproof}[for=fbbt,id=fbbt-pf]{}
|
66 |
-
\begin{spfstep}
|
67 |
-
Let $\defeq{G}{\tup{V,E}}$ be a fully balanced tree
|
68 |
-
\end{spfstep}
|
69 |
-
\begin{spfstep}
|
70 |
-
Then $\card{V}=\Sumfromto{i}1d{\power2i}= \power2{d+1}-1$.
|
71 |
-
\end{spfstep}
|
72 |
-
\end{sproof}
|
73 |
-
\end{itemize}
|
74 |
-
\end{frame}
|
75 |
-
\begin{note}
|
76 |
-
\begin{omtext}[type=conclusion,for=binary-tree]
|
77 |
-
This shows that balanced binary trees grow in breadth very quickly, a consequence of
|
78 |
-
this is that they are very shallow (and this compute very fast), which is the essence of
|
79 |
-
the next result.
|
80 |
-
\end{omtext}
|
81 |
-
\end{note}
|
82 |
-
\end{module}
|
83 |
-
|
84 |
-
%%% Local Variables:
|
85 |
-
%%% mode: LaTeX
|
86 |
-
%%% TeX-master: "all"
|
87 |
-
%%% End: \end{document}
|
88 |
-
</textarea></form>
|
89 |
-
<script>
|
90 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
91 |
-
</script>
|
92 |
-
|
93 |
-
<p><strong>MIME types defined:</strong> <code>text/stex</code>.</p>
|
94 |
-
|
95 |
-
</body>
|
96 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/stex/stex.js
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
|
3 |
-
* Licence: MIT
|
4 |
-
*/
|
5 |
-
|
6 |
-
CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
7 |
-
{
|
8 |
-
function pushCommand(state, command) {
|
9 |
-
state.cmdState.push(command);
|
10 |
-
}
|
11 |
-
|
12 |
-
function peekCommand(state) {
|
13 |
-
if (state.cmdState.length>0)
|
14 |
-
return state.cmdState[state.cmdState.length-1];
|
15 |
-
else
|
16 |
-
return null;
|
17 |
-
}
|
18 |
-
|
19 |
-
function popCommand(state) {
|
20 |
-
if (state.cmdState.length>0) {
|
21 |
-
var plug = state.cmdState.pop();
|
22 |
-
plug.closeBracket();
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
function applyMostPowerful(state) {
|
27 |
-
var context = state.cmdState;
|
28 |
-
for (var i = context.length - 1; i >= 0; i--) {
|
29 |
-
var plug = context[i];
|
30 |
-
if (plug.name=="DEFAULT")
|
31 |
-
continue;
|
32 |
-
return plug.styleIdentifier();
|
33 |
-
}
|
34 |
-
return null;
|
35 |
-
}
|
36 |
-
|
37 |
-
function addPluginPattern(pluginName, cmdStyle, brackets, styles) {
|
38 |
-
return function () {
|
39 |
-
this.name=pluginName;
|
40 |
-
this.bracketNo = 0;
|
41 |
-
this.style=cmdStyle;
|
42 |
-
this.styles = styles;
|
43 |
-
this.brackets = brackets;
|
44 |
-
|
45 |
-
this.styleIdentifier = function(content) {
|
46 |
-
if (this.bracketNo<=this.styles.length)
|
47 |
-
return this.styles[this.bracketNo-1];
|
48 |
-
else
|
49 |
-
return null;
|
50 |
-
};
|
51 |
-
this.openBracket = function(content) {
|
52 |
-
this.bracketNo++;
|
53 |
-
return "bracket";
|
54 |
-
};
|
55 |
-
this.closeBracket = function(content) {
|
56 |
-
};
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
var plugins = new Array();
|
61 |
-
|
62 |
-
plugins["importmodule"] = addPluginPattern("importmodule", "tag", "{[", ["string", "builtin"]);
|
63 |
-
plugins["documentclass"] = addPluginPattern("documentclass", "tag", "{[", ["", "atom"]);
|
64 |
-
plugins["usepackage"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
|
65 |
-
plugins["begin"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
|
66 |
-
plugins["end"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
|
67 |
-
|
68 |
-
plugins["DEFAULT"] = function () {
|
69 |
-
this.name="DEFAULT";
|
70 |
-
this.style="tag";
|
71 |
-
|
72 |
-
this.styleIdentifier = function(content) {
|
73 |
-
};
|
74 |
-
this.openBracket = function(content) {
|
75 |
-
};
|
76 |
-
this.closeBracket = function(content) {
|
77 |
-
};
|
78 |
-
};
|
79 |
-
|
80 |
-
function setState(state, f) {
|
81 |
-
state.f = f;
|
82 |
-
}
|
83 |
-
|
84 |
-
function normal(source, state) {
|
85 |
-
if (source.match(/^\\[a-z]+/)) {
|
86 |
-
var cmdName = source.current();
|
87 |
-
cmdName = cmdName.substr(1, cmdName.length-1);
|
88 |
-
var plug = plugins[cmdName];
|
89 |
-
if (typeof(plug) == 'undefined') {
|
90 |
-
plug = plugins["DEFAULT"];
|
91 |
-
}
|
92 |
-
plug = new plug();
|
93 |
-
pushCommand(state, plug);
|
94 |
-
setState(state, beginParams);
|
95 |
-
return plug.style;
|
96 |
-
}
|
97 |
-
|
98 |
-
var ch = source.next();
|
99 |
-
if (ch == "%") {
|
100 |
-
setState(state, inCComment);
|
101 |
-
return "comment";
|
102 |
-
}
|
103 |
-
else if (ch=='}' || ch==']') {
|
104 |
-
plug = peekCommand(state);
|
105 |
-
if (plug) {
|
106 |
-
plug.closeBracket(ch);
|
107 |
-
setState(state, beginParams);
|
108 |
-
} else
|
109 |
-
return "error";
|
110 |
-
return "bracket";
|
111 |
-
} else if (ch=='{' || ch=='[') {
|
112 |
-
plug = plugins["DEFAULT"];
|
113 |
-
plug = new plug();
|
114 |
-
pushCommand(state, plug);
|
115 |
-
return "bracket";
|
116 |
-
}
|
117 |
-
else if (/\d/.test(ch)) {
|
118 |
-
source.eatWhile(/[\w.%]/);
|
119 |
-
return "atom";
|
120 |
-
}
|
121 |
-
else {
|
122 |
-
source.eatWhile(/[\w-_]/);
|
123 |
-
return applyMostPowerful(state);
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
function inCComment(source, state) {
|
128 |
-
source.skipToEnd();
|
129 |
-
setState(state, normal);
|
130 |
-
return "comment";
|
131 |
-
}
|
132 |
-
|
133 |
-
function beginParams(source, state) {
|
134 |
-
var ch = source.peek();
|
135 |
-
if (ch == '{' || ch == '[') {
|
136 |
-
var lastPlug = peekCommand(state);
|
137 |
-
var style = lastPlug.openBracket(ch);
|
138 |
-
source.eat(ch);
|
139 |
-
setState(state, normal);
|
140 |
-
return "bracket";
|
141 |
-
}
|
142 |
-
if (/[ \t\r]/.test(ch)) {
|
143 |
-
source.eat(ch);
|
144 |
-
return null;
|
145 |
-
}
|
146 |
-
setState(state, normal);
|
147 |
-
lastPlug = peekCommand(state);
|
148 |
-
if (lastPlug) {
|
149 |
-
popCommand(state);
|
150 |
-
}
|
151 |
-
return normal(source, state);
|
152 |
-
}
|
153 |
-
|
154 |
-
return {
|
155 |
-
startState: function() { return { f:normal, cmdState:[] }; },
|
156 |
-
copyState: function(s) { return { f: s.f, cmdState: s.cmdState.slice(0, s.cmdState.length) }; },
|
157 |
-
|
158 |
-
token: function(stream, state) {
|
159 |
-
var t = state.f(stream, state);
|
160 |
-
var w = stream.current();
|
161 |
-
return t;
|
162 |
-
}
|
163 |
-
};
|
164 |
-
});
|
165 |
-
|
166 |
-
|
167 |
-
CodeMirror.defineMIME("text/x-stex", "stex");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/tiddlywiki/index.html
DELETED
@@ -1,183 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror 2: TiddlyWiki mode</title>
|
5 |
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
6 |
-
<script src="../../lib/codemirror.js"></script>
|
7 |
-
<script src="tiddlywiki.js"></script>
|
8 |
-
<link rel="stylesheet" href="tiddlywiki.css">
|
9 |
-
<link rel="stylesheet" href="../../css/docs.css">
|
10 |
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11 |
-
</head>
|
12 |
-
<body>
|
13 |
-
<h1>CodeMirror 2: TiddlyWiki mode</h1>
|
14 |
-
|
15 |
-
<div><textarea id="code" name="code">
|
16 |
-
!TiddlyWiki Formatting
|
17 |
-
* Rendered versions can be found at: http://www.tiddlywiki.com/#Reference
|
18 |
-
|
19 |
-
|!Option|!Syntax|!Output|
|
20 |
-
|bold font|{{{''bold''}}}|''bold''|
|
21 |
-
|italic type|{{{//italic//}}}|//italic//|
|
22 |
-
|underlined text|{{{__underlined__}}}|__underlined__|
|
23 |
-
|strikethrough text|{{{--strikethrough--}}}|--strikethrough--|
|
24 |
-
|superscript text|{{{^^super^^script}}}|^^super^^script|
|
25 |
-
|subscript text|{{{~~sub~~script}}}|~~sub~~script|
|
26 |
-
|highlighted text|{{{@@highlighted@@}}}|@@highlighted@@|
|
27 |
-
|preformatted text|<html><code>{{{preformatted}}}</code></html>|{{{preformatted}}}|
|
28 |
-
|
29 |
-
!Block Elements
|
30 |
-
!!Headings
|
31 |
-
{{{
|
32 |
-
!Heading 1
|
33 |
-
!!Heading 2
|
34 |
-
!!!Heading 3
|
35 |
-
!!!!Heading 4
|
36 |
-
!!!!!Heading 5
|
37 |
-
}}}
|
38 |
-
<<<
|
39 |
-
|
40 |
-
!Heading 1
|
41 |
-
|
42 |
-
!!Heading 2
|
43 |
-
|
44 |
-
!!!Heading 3
|
45 |
-
|
46 |
-
!!!!Heading 4
|
47 |
-
|
48 |
-
!!!!!Heading 5
|
49 |
-
<<<
|
50 |
-
|
51 |
-
!!Lists
|
52 |
-
{{{
|
53 |
-
* unordered list, level 1
|
54 |
-
** unordered list, level 2
|
55 |
-
*** unordered list, level 3
|
56 |
-
|
57 |
-
# ordered list, level 1
|
58 |
-
## ordered list, level 2
|
59 |
-
### unordered list, level 3
|
60 |
-
|
61 |
-
; definition list, term
|
62 |
-
: definition list, description
|
63 |
-
}}}
|
64 |
-
<<<
|
65 |
-
* unordered list, level 1
|
66 |
-
** unordered list, level 2
|
67 |
-
*** unordered list, level 3
|
68 |
-
|
69 |
-
# ordered list, level 1
|
70 |
-
## ordered list, level 2
|
71 |
-
### unordered list, level 3
|
72 |
-
|
73 |
-
; definition list, term
|
74 |
-
: definition list, description
|
75 |
-
<<<
|
76 |
-
|
77 |
-
!!Blockquotes
|
78 |
-
{{{
|
79 |
-
> blockquote, level 1
|
80 |
-
>> blockquote, level 2
|
81 |
-
>>> blockquote, level 3
|
82 |
-
|
83 |
-
<<<
|
84 |
-
blockquote
|
85 |
-
<<<
|
86 |
-
}}}
|
87 |
-
<<<
|
88 |
-
> blockquote, level 1
|
89 |
-
>> blockquote, level 2
|
90 |
-
>>> blockquote, level 3
|
91 |
-
|
92 |
-
> blockquote
|
93 |
-
<<<
|
94 |
-
|
95 |
-
!!Preformatted Text
|
96 |
-
<html><pre>
|
97 |
-
{{{
|
98 |
-
preformatted (e.g. code)
|
99 |
-
}}}
|
100 |
-
</pre></html>
|
101 |
-
<<<
|
102 |
-
{{{
|
103 |
-
preformatted (e.g. code)
|
104 |
-
}}}
|
105 |
-
<<<
|
106 |
-
|
107 |
-
!!Code Sections
|
108 |
-
{{{
|
109 |
-
Text style code
|
110 |
-
}}}
|
111 |
-
|
112 |
-
//{{{
|
113 |
-
JS styled code. TiddlyWiki mixed mode should support highlighter switching in the future.
|
114 |
-
//}}}
|
115 |
-
|
116 |
-
<!--{{{-->
|
117 |
-
XML styled code. TiddlyWiki mixed mode should support highlighter switching in the future.
|
118 |
-
<!--}}}-->
|
119 |
-
|
120 |
-
!!Tables
|
121 |
-
{{{
|
122 |
-
|CssClass|k
|
123 |
-
|!heading column 1|!heading column 2|
|
124 |
-
|row 1, column 1|row 1, column 2|
|
125 |
-
|row 2, column 1|row 2, column 2|
|
126 |
-
|>|COLSPAN|
|
127 |
-
|ROWSPAN| ... |
|
128 |
-
|~| ... |
|
129 |
-
|CssProperty:value;...| ... |
|
130 |
-
|caption|c
|
131 |
-
}}}
|
132 |
-
''Annotation:''
|
133 |
-
* The {{{>}}} marker creates a "colspan", causing the current cell to merge with the one to the right.
|
134 |
-
* The {{{~}}} marker creates a "rowspan", causing the current cell to merge with the one above.
|
135 |
-
<<<
|
136 |
-
|CssClass|k
|
137 |
-
|!heading column 1|!heading column 2|
|
138 |
-
|row 1, column 1|row 1, column 2|
|
139 |
-
|row 2, column 1|row 2, column 2|
|
140 |
-
|>|COLSPAN|
|
141 |
-
|ROWSPAN| ... |
|
142 |
-
|~| ... |
|
143 |
-
|CssProperty:value;...| ... |
|
144 |
-
|caption|c
|
145 |
-
<<<
|
146 |
-
!!Images /% TODO %/
|
147 |
-
cf. [[TiddlyWiki.com|http://www.tiddlywiki.com/#EmbeddedImages]]
|
148 |
-
|
149 |
-
!Hyperlinks
|
150 |
-
* [[WikiWords|WikiWord]] are automatically transformed to hyperlinks to the respective tiddler
|
151 |
-
** the automatic transformation can be suppressed by preceding the respective WikiWord with a tilde ({{{~}}}): {{{~WikiWord}}}
|
152 |
-
* [[PrettyLinks]] are enclosed in square brackets and contain the desired tiddler name: {{{[[tiddler name]]}}}
|
153 |
-
** optionally, a custom title or description can be added, separated by a pipe character ({{{|}}}): {{{[[title|target]]}}}<br>'''N.B.:''' In this case, the target can also be any website (i.e. URL).
|
154 |
-
|
155 |
-
!Custom Styling
|
156 |
-
* {{{@@CssProperty:value;CssProperty:value;...@@}}}<br>''N.B.:'' CSS color definitions should use lowercase letters to prevent the inadvertent creation of WikiWords.
|
157 |
-
* <html><code>{{customCssClass{...}}}</code></html>
|
158 |
-
* raw HTML can be inserted by enclosing the respective code in HTML tags: {{{<html> ... </html>}}}
|
159 |
-
|
160 |
-
!Special Markers
|
161 |
-
* {{{<br>}}} forces a manual line break
|
162 |
-
* {{{----}}} creates a horizontal ruler
|
163 |
-
* [[HTML entities|http://www.tiddlywiki.com/#HtmlEntities]]
|
164 |
-
* [[HTML entities local|HtmlEntities]]
|
165 |
-
* {{{<<macroName>>}}} calls the respective [[macro|Macros]]
|
166 |
-
* To hide text within a tiddler so that it is not displayed, it can be wrapped in {{{/%}}} and {{{%/}}}.<br/>This can be a useful trick for hiding drafts or annotating complex markup.
|
167 |
-
* To prevent wiki markup from taking effect for a particular section, that section can be enclosed in three double quotes: e.g. {{{"""WikiWord"""}}}.
|
168 |
-
</textarea></div>
|
169 |
-
|
170 |
-
<script>
|
171 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
172 |
-
mode: 'tiddlywiki',
|
173 |
-
lineNumbers: true,
|
174 |
-
enterMode: 'keep',
|
175 |
-
matchBrackets: true
|
176 |
-
});
|
177 |
-
</script>
|
178 |
-
|
179 |
-
<p>TiddlyWiki mode supports a single configuration.</p>
|
180 |
-
|
181 |
-
<p><strong>MIME types defined:</strong> <code>text/x-tiddlywiki</code>.</p>
|
182 |
-
</body>
|
183 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/tiddlywiki/tiddlywiki.css
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
.cm-s-default span.cm-header {color: blue; font-weight:bold;}
|
2 |
-
.cm-s-default span.cm-code {color: #a50;}
|
3 |
-
.cm-s-default span.cm-code-inline {color: #660;}
|
4 |
-
|
5 |
-
.cm-s-default span.cm-quote {color: #555;}
|
6 |
-
.cm-s-default span.cm-list {color: #c60;}
|
7 |
-
.cm-s-default span.cm-hr {color: #999;}
|
8 |
-
.cm-s-default span.cm-em {font-style: italic;}
|
9 |
-
.cm-s-default span.cm-strong {font-weight: bold;}
|
10 |
-
|
11 |
-
.cm-s-default span.cm-link-external {color: blue;}
|
12 |
-
.cm-s-default span.cm-brace {color: #170; font-weight: bold;}
|
13 |
-
.cm-s-default span.cm-macro {color: #9E3825;}
|
14 |
-
.cm-s-default span.cm-table {color: blue;}
|
15 |
-
.cm-s-default span.cm-warning {color: red; font-weight: bold;}
|
16 |
-
|
17 |
-
.cm-s-default span.cm-underlined {text-decoration: underline;}
|
18 |
-
.cm-s-default span.cm-line-through {text-decoration: line-through;}
|
19 |
-
|
20 |
-
.cm-s-default span.cm-comment {color: #666;}
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/alphamail/CodeMirror-2.18/mode/tiddlywiki/tiddlywiki.js
DELETED
@@ -1,374 +0,0 @@
|
|
1 |
-
/***
|
2 |
-
|''Name''|tiddlywiki.js|
|
3 |
-
|''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror2|
|
4 |
-
|''Author''|PMario|
|
5 |
-
|''Version''|0.1.6|
|
6 |
-
|''Status''|''beta''|
|
7 |
-
|''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]|
|
8 |
-
|''Documentation''|http://codemirror.tiddlyspace.com/|
|
9 |
-
|''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]|
|
10 |
-
|''CoreVersion''|2.5.0|
|
11 |
-
|''Requires''|codemirror.js|
|
12 |
-
|''Keywords''|syntax highlighting color code mirror codemirror|
|
13 |
-
! Info
|
14 |
-
CoreVersion parameter is needed for TiddlyWiki only!
|
15 |
-
***/
|
16 |
-
//{{{
|
17 |
-
CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
|
18 |
-
var indentUnit = config.indentUnit;
|
19 |
-
|
20 |
-
// Tokenizer
|
21 |
-
var textwords = function () {
|
22 |
-
function kw(type) {
|
23 |
-
return {
|
24 |
-
type: type,
|
25 |
-
style: "text"
|
26 |
-
};
|
27 |
-
}
|
28 |
-
return {};
|
29 |
-
}();
|
30 |
-
|
31 |
-
var keywords = function () {
|
32 |
-
function kw(type) {
|
33 |
-
return { type: type, style: "macro"};
|
34 |
-
}
|
35 |
-
return {
|
36 |
-
"allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'),
|
37 |
-
"newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'),
|
38 |
-
"permaview": kw('permaview'), "saveChanges": kw('saveChanges'),
|
39 |
-
"search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'),
|
40 |
-
"tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'),
|
41 |
-
"tiddler": kw('tiddler'), "timeline": kw('timeline'),
|
42 |
-
"today": kw('today'), "version": kw('version'), "option": kw('option'),
|
43 |
-
|
44 |
-
"with": kw('with'),
|
45 |
-
"filter": kw('filter')
|
46 |
-
};
|
47 |
-
}();
|
48 |
-
|
49 |
-
var isSpaceName = /[\w_\-]/i,
|
50 |
-
reHR = /^\-\-\-\-+$/,
|
51 |
-
reWikiCommentStart = /^\/\*\*\*$/, // /***
|
52 |
-
reWikiCommentStop = /^\*\*\*\/$/, // ***/
|
53 |
-
reBlockQuote = /^<<<$/,
|
54 |
-
|
55 |
-
reJsCodeStart = /^\/\/\{\{\{$/, // //{{{
|
56 |
-
reJsCodeStop = /^\/\/\}\}\}$/, // //}}}
|
57 |
-
reXmlCodeStart = /^<!--\{\{\{-->$/,
|
58 |
-
reXmlCodeStop = /^<!--\}\}\}-->$/,
|
59 |
-
|
60 |
-
reCodeBlockStart = /^\{\{\{$/,
|
61 |
-
reCodeBlockStop = /^\}\}\}$/,
|
62 |
-
|
63 |
-
reCodeStart = /\{\{\{/,
|
64 |
-
reUntilCodeStop = /.*?\}\}\}/;
|
65 |
-
|
66 |
-
function chain(stream, state, f) {
|
67 |
-
state.tokenize = f;
|
68 |
-
return f(stream, state);
|
69 |
-
}
|
70 |
-
|
71 |
-
// used for strings
|
72 |
-
function nextUntilUnescaped(stream, end) {
|
73 |
-
var escaped = false,
|
74 |
-
next;
|
75 |
-
while ((next = stream.next()) != null) {
|
76 |
-
if (next == end && !escaped) return false;
|
77 |
-
escaped = !escaped && next == "\\";
|
78 |
-
}
|
79 |
-
return escaped;
|
80 |
-
}
|
81 |
-
|
82 |
-
// Used as scratch variables to communicate multiple values without
|
83 |
-
// consing up tons of objects.
|
84 |
-
var type, content;
|
85 |
-
|
86 |
-
function ret(tp, style, cont) {
|
87 |
-
type = tp;
|
88 |
-
content = cont;
|
89 |
-
return style;
|
90 |
-
}
|
91 |
-
|
92 |
-
function jsTokenBase(stream, state) {
|
93 |
-
var sol = stream.sol(),
|
94 |
-
ch, tch;
|
95 |
-
|
96 |
-
state.block = false; // indicates the start of a code block.
|
97 |
-
|
98 |
-
ch = stream.peek(); // don't eat, to make match simpler
|
99 |
-
|
100 |
-
// check start of blocks
|
101 |
-
if (sol && /[<\/\*{}\-]/.test(ch)) {
|
102 |
-
if (stream.match(reCodeBlockStart)) {
|
103 |
-
state.block = true;
|
104 |
-
return chain(stream, state, twTokenCode);
|
105 |
-
}
|
106 |
-
if (stream.match(reBlockQuote)) {
|
107 |
-
return ret('quote', 'quote');
|
108 |
-
}
|
109 |
-
if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
|
110 |
-
return ret('code', 'code');
|
111 |
-
}
|
112 |
-
if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
|
113 |
-
return ret('code', 'code');
|
114 |
-
}
|
115 |
-
if (stream.match(reHR)) {
|
116 |
-
return ret('hr', 'hr');
|
117 |
-
}
|
118 |
-
} // sol
|
119 |
-
var ch = stream.next();
|
120 |
-
|
121 |
-
if (sol && /[\/\*!#;:>|]/.test(ch)) {
|
122 |
-
if (ch == "!") { // tw header
|
123 |
-
stream.skipToEnd();
|
124 |
-
return ret("header", "header");
|
125 |
-
}
|
126 |
-
if (ch == "*") { // tw list
|
127 |
-
stream.eatWhile('*');
|
128 |
-
return ret("list", "list");
|
129 |
-
}
|
130 |
-
if (ch == "#") { // tw numbered list
|
131 |
-
stream.eatWhile('#');
|
132 |
-
return ret("list", "list");
|
133 |
-
}
|
134 |
-
if (ch == ";") { // tw list
|
135 |
-
stream.eatWhile(';');
|
136 |
-
return ret("list", "list");
|
137 |
-
}
|
138 |
-
if (ch == ":") { // tw list
|
139 |
-
stream.eatWhile(':');
|
140 |
-
return ret("list", "list");
|
141 |
-
}
|
142 |
-
if (ch == ">") { // single line quote
|
143 |
-
stream.eatWhile(">");
|
144 |
-
return ret("quote", "quote");
|
145 |
-
}
|
146 |
-
if (ch == '|') {
|
147 |
-
return ret('table', 'table');
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
if (ch == '{' && stream.match(/\{\{/)) {
|
152 |
-
return chain(stream, state, twTokenCode);
|
153 |
-
}
|
154 |
-
|
155 |
-
// rudimentary html:// file:// link matching. TW knows much more ...
|
156 |
-
if (/[hf]/i.test(ch)) {
|
157 |
-
if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) {
|
158 |
-
return ret("link-external", "link-external");
|
159 |
-
}
|
160 |
-
}
|
161 |
-
// just a little string indicator, don't want to have the whole string covered
|
162 |
-
if (ch == '"') {
|
163 |
-
return ret('string', 'string');
|
164 |
-
}
|
165 |
-
if (/[\[\]]/.test(ch)) { // check for [[..]]
|
166 |
-
if (stream.peek() == ch) {
|
167 |
-
stream.next();
|
168 |
-
return ret('brace', 'brace');
|
169 |
-
}
|
170 |
-
}
|
171 |
-
if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
|
172 |
-
stream.eatWhile(isSpaceName);
|
173 |
-
return ret("link-external", "link-external");
|
174 |
-
}
|
175 |
-
if (/\d/.test(ch)) { // numbers
|
176 |
-
stream.eatWhile(/\d/);
|
177 |
-
return ret("number", "number");
|
178 |
-
}
|
179 |
-
if (ch == "/") { // tw invisible comment
|
180 |
-
if (stream.eat("%")) {
|
181 |
-
return chain(stream, state, twTokenComment);
|
182 |
-
}
|
183 |
-
else if (stream.eat("/")) { //
|
184 |
-
return chain(stream, state, twTokenEm);
|
185 |
-
}
|
186 |
-
}
|
187 |
-
if (ch == "_") { // tw underline
|
188 |
-
if (stream.eat("_")) {
|
189 |
-
return chain(stream, state, twTokenUnderline);
|
190 |
-
}
|
191 |
-
}
|
192 |
-
if (ch == "-") { // tw strikethrough TODO looks ugly .. different handling see below;
|
193 |
-
if (stream.eat("-")) {
|
194 |
-
return chain(stream, state, twTokenStrike);
|
195 |
-
}
|
196 |
-
}
|
197 |
-
if (ch == "'") { // tw bold
|
198 |
-
if (stream.eat("'")) {
|
199 |
-
return chain(stream, state, twTokenStrong);
|
200 |
-
}
|
201 |
-
}
|
202 |
-
if (ch == "<") { // tw macro
|
203 |
-
if (stream.eat("<")) {
|
204 |
-
return chain(stream, state, twTokenMacro);
|
205 |
-
}
|
206 |
-
}
|
207 |
-
else {
|
208 |
-
return ret(ch);
|
209 |
-
}
|
210 |
-
|
211 |
-
stream.eatWhile(/[\w\$_]/);
|
212 |
-
var word = stream.current(),
|
213 |
-
known = textwords.propertyIsEnumerable(word) && textwords[word];
|
214 |
-
|
215 |
-
return known ? ret(known.type, known.style, word) : ret("text", null, word);
|
216 |
-
|
217 |
-
} // jsTokenBase()
|
218 |
-
|
219 |
-
function twTokenString(quote) {
|
220 |
-
return function (stream, state) {
|
221 |
-
if (!nextUntilUnescaped(stream, quote)) state.tokenize = jsTokenBase;
|
222 |
-
return ret("string", "string");
|
223 |
-
};
|
224 |
-
}
|
225 |
-
|
226 |
-
// tw invisible comment
|
227 |
-
function twTokenComment(stream, state) {
|
228 |
-
var maybeEnd = false,
|
229 |
-
ch;
|
230 |
-
while (ch = stream.next()) {
|
231 |
-
if (ch == "/" && maybeEnd) {
|
232 |
-
state.tokenize = jsTokenBase;
|
233 |
-
break;
|
234 |
-
}
|
235 |
-
maybeEnd = (ch == "%");
|
236 |
-
}
|
237 |
-
return ret("comment", "comment");
|
238 |
-
}
|
239 |
-
|
240 |
-
// tw strong / bold
|
241 |
-
function twTokenStrong(stream, state) {
|
242 |
-
var maybeEnd = false,
|
243 |
-
ch;
|
244 |
-
while (ch = stream.next()) {
|
245 |
-
if (ch == "'" && maybeEnd) {
|
246 |
-
state.tokenize = jsTokenBase;
|
247 |
-
break;
|
248 |
-
}
|
249 |
-
maybeEnd = (ch == "'");
|
250 |
-
}
|
251 |
-
return ret("text", "strong");
|
252 |
-
}
|
253 |
-
|
254 |
-
// tw code
|
255 |
-
function twTokenCode(stream, state) {
|
256 |
-
var ch, sb = state.block;
|
257 |
-
|
258 |
-
if (sb && stream.current()) {
|
259 |
-
return ret("cod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|