mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2025-01-10 11:20:02 +01:00
Merge pull request #25 from gcsolaroli/master
Initial integration of /beta and /gamma with a single backend
This commit is contained in:
commit
a0661c3b02
@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
"request.path": "../index.php",
|
"request.path": "index.php",
|
||||||
"should.pay.toll": "false"
|
"should.pay.toll": "false"
|
||||||
|
|
||||||
|
"development.settings": {
|
||||||
|
"url": "http://localhost/php/clipperz"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -18,8 +18,8 @@ $configuration['db_encoding'] = 0;
|
|||||||
|
|
||||||
$configuration['db'] = 'clipperz'; // database name
|
$configuration['db'] = 'clipperz'; // database name
|
||||||
$configuration['host'] = 'localhost'; // database host
|
$configuration['host'] = 'localhost'; // database host
|
||||||
$configuration['user'] = 'root'; // database user
|
$configuration['user'] = 'clipperz'; // database user
|
||||||
$configuration['pass'] = 'pass'; // database password
|
$configuration['pass'] = 'clipperz'; // database password
|
||||||
$configuration['port'] = '3306'; // database port
|
$configuration['port'] = '3306'; // database port
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +140,9 @@ function updateUserData($parameters, &$user) {
|
|||||||
$user->header = $parameters["header"];
|
$user->header = $parameters["header"];
|
||||||
$user->statistics = $parameters["statistics"];
|
$user->statistics = $parameters["statistics"];
|
||||||
$user->version = $parameters["version"];
|
$user->version = $parameters["version"];
|
||||||
|
if (array_key_exists("lock", $parameters)) {
|
||||||
$user->lock = $parameters["lock"];
|
$user->lock = $parameters["lock"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordData($parameters, &$record, &$recordVersion) {
|
function updateRecordData($parameters, &$record, &$recordVersion) {
|
||||||
@ -153,7 +155,9 @@ function updateRecordData($parameters, &$record, &$recordVersion) {
|
|||||||
$recordVersion->reference = $recordVersionData ["reference"];
|
$recordVersion->reference = $recordVersionData ["reference"];
|
||||||
$recordVersion->data = $recordVersionData ["data"];
|
$recordVersion->data = $recordVersionData ["data"];
|
||||||
$recordVersion->version = $recordVersionData ["version"];
|
$recordVersion->version = $recordVersionData ["version"];
|
||||||
|
if (array_key_exists("previousVersion", $recordVersionData)) {
|
||||||
$recordVersion->previous_version_id = $recordVersionData ["previousVersion"];
|
$recordVersion->previous_version_id = $recordVersionData ["previousVersion"];
|
||||||
|
}
|
||||||
$recordVersion->previous_version_key = $recordVersionData ["previousVersionKey"];
|
$recordVersion->previous_version_key = $recordVersionData ["previousVersionKey"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,6 +369,7 @@ error_log("oneTimePassword");
|
|||||||
|
|
||||||
case "message":
|
case "message":
|
||||||
error_log("message");
|
error_log("message");
|
||||||
|
//error_log("message: ".json_encode($parameters));
|
||||||
if ($parameters["srpSharedSecret"] == $_SESSION["K"]) {
|
if ($parameters["srpSharedSecret"] == $_SESSION["K"]) {
|
||||||
$message = $parameters["message"];
|
$message = $parameters["message"];
|
||||||
|
|
||||||
@ -446,6 +451,88 @@ error_log("message");
|
|||||||
$result["lock"] = $user->lock;
|
$result["lock"] = $user->lock;
|
||||||
$result["result"] = "done";
|
$result["result"] = "done";
|
||||||
|
|
||||||
|
//=============================================================
|
||||||
|
} else if ($message == "saveChanges") {
|
||||||
|
|
||||||
|
//{
|
||||||
|
// "message":"saveChanges",
|
||||||
|
// "srpSharedSecret":"edc78508907c942173818f7247fa64869ba80672a7aa8d27b8fa6bfe524fb9c8",
|
||||||
|
// "parameters":{
|
||||||
|
// "records":{
|
||||||
|
// "updated":[
|
||||||
|
// {
|
||||||
|
// "currentRecordVersion":{
|
||||||
|
// "previousVersionKey":"####",
|
||||||
|
// "reference":"08c8eb7ec528fbf987bbfb84fe2e960cf9ae937b19fbb5f05d8d90a7039fac6a",
|
||||||
|
// "data":"WYQ16AjodjsmyZDXa4MKxOju0F…beD/zXlbVb0Zj0ZI/N55bZ",
|
||||||
|
// "version":"0.3"
|
||||||
|
// },
|
||||||
|
// "record":{
|
||||||
|
// "reference":"83de5304f60a808e48a815c6203d7d3f24874d3f40faba420bbc60b376fcc356",
|
||||||
|
// "data":"B6uBuBE Aly0knvgrUppodDTGZQC…guizL9QvHCWyM bQQBGBVvHZ6LfA==",
|
||||||
|
// "version":"0.3"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// "deleted":[
|
||||||
|
//
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
// "user":{
|
||||||
|
// "header":"{\"rec…sion\":\"0.1\"}",
|
||||||
|
// "statistics":"e6iXVEM4i8ZatPZFCCads/9F",
|
||||||
|
// "version":"0.3"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
$user = new user();
|
||||||
|
$user = $user->Get($_SESSION["userId"]);
|
||||||
|
updateUserData($parameters["parameters"]["user"], $user);
|
||||||
|
|
||||||
|
$recordToUpdateParameterList = $parameters["parameters"]["records"]["updated"];
|
||||||
|
$c = count($recordToUpdateParameterList);
|
||||||
|
for ($i=0; $i<$c; $i++) {
|
||||||
|
$recordList = $user->GetRecordList(array(array("reference", "=", $recordToUpdateParameterList [$i]["record"]["reference"])));
|
||||||
|
if (count($recordList) == 0) {
|
||||||
|
$currentRecord = new record();
|
||||||
|
$currentVersion = new recordversion();
|
||||||
|
$isNewRecord = true;
|
||||||
|
} else {
|
||||||
|
$currentRecord = $recordList[0];
|
||||||
|
$currentRecordVersions = $currentRecord->GetRecordversionList();
|
||||||
|
$currentVersion = $currentRecordVersions[0];
|
||||||
|
$isNewRecord = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateRecordData($recordToUpdateParameterList[$i], $currentRecord, $currentVersion);
|
||||||
|
|
||||||
|
if ($isNewRecord == true) {
|
||||||
|
$currentRecord->SaveNew();
|
||||||
|
$currentVersion->SaveNew();
|
||||||
|
|
||||||
|
$currentRecord->AddRecordversion($currentVersion);
|
||||||
|
$user->AddRecord($currentRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentRecord->Save();
|
||||||
|
$currentVersion->Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->Save();
|
||||||
|
|
||||||
|
$recordToDeleteReferenceList = $parameters["parameters"]["records"]["deleted"];
|
||||||
|
$recordList = array();
|
||||||
|
$c = count($recordToDeleteReferenceList);
|
||||||
|
for ($i=0; $i<$c; $i++) {
|
||||||
|
array_push($recordList, array("reference", "=", $recordToDeleteReferenceList[$i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = new record();
|
||||||
|
$record->DeleteList($recordList, true);
|
||||||
|
|
||||||
|
$result["lock"] = $user->lock;
|
||||||
|
$result["result"] = "done";
|
||||||
|
|
||||||
//=============================================================
|
//=============================================================
|
||||||
} else if ($message == "getRecordDetail") {
|
} else if ($message == "getRecordDetail") {
|
||||||
//{
|
//{
|
||||||
@ -474,6 +561,73 @@ error_log("message");
|
|||||||
// updatedDate:"Tue, 17 April 2007 17:17:52 UTC",
|
// updatedDate:"Tue, 17 April 2007 17:17:52 UTC",
|
||||||
// data:"0/BjzyY6jeh71h...pAw2++NEyylGhMC5C5f5m8pBApYziN84s4O3JQ3khW/1UttQl4="
|
// data:"0/BjzyY6jeh71h...pAw2++NEyylGhMC5C5f5m8pBApYziN84s4O3JQ3khW/1UttQl4="
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// # Actual result (causing error in /gamma)
|
||||||
|
// {
|
||||||
|
// "result" : {
|
||||||
|
// "currentVersion" : {
|
||||||
|
// "reference" : "cb05177f96a832062c6b936d24323cb74a64e2ef1d97ee026cd1003755af7495",
|
||||||
|
// "data" : "RAnoHmikp7RmiZ2WVyEMW+Ia",
|
||||||
|
// "header" : "",
|
||||||
|
// "version" : "0.3",
|
||||||
|
// "creationDate" : "0000-00-00 00:00:00",
|
||||||
|
// "updateDate" : "2011-10-09 19:49:11",
|
||||||
|
// "accessDate" : "2011-10-09 19:49:11"
|
||||||
|
// },
|
||||||
|
// "reference" : "b07e2afa2ba782b9f379649b36ded6de0452b43c27e6b887c7ce4f2a93f44346",
|
||||||
|
// "data" : "NtK1nkLUabbJQx5uO8ept...ZJ5dkJYYkyh3VQ==",
|
||||||
|
// "version" : "0.3",
|
||||||
|
// "creationDate" : "2011-10-09 19:49:11",
|
||||||
|
// "updateDate" : "Tue, 30 Nov 1999 00:00:00 +0000",
|
||||||
|
// "accessDate" : "0000-00-00 00:00:00",
|
||||||
|
// "oldestUsedEncryptedVersion" : "---"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// # Response from the online /gamma version
|
||||||
|
// {
|
||||||
|
// "result" : {
|
||||||
|
// "versions" : {
|
||||||
|
// "e2c193f017ad4f6babf51de59f7550a40596afc0c27373b6a360e426b5bc06de" : {
|
||||||
|
// "reference" : "e2c193f017ad4f6babf51de59f7550a40596afc0c27373b6a360e426b5bc06de",
|
||||||
|
// "data" : "s\/3ClggH4uCcf+BkIMqQ...+W0PVt\/MJ3t7s1g0g",
|
||||||
|
// "creationDate" : "Mon, 10 October 2011 14:42:42 UTC",
|
||||||
|
// "header" : "####",
|
||||||
|
// "updateDate" : "Mon, 10 October 2011 14:42:42 UTC",
|
||||||
|
// "previousVersion" : "a96a6d8b9ac73fcdf874d8a8534ffb2d43da8f5222e96a4a29bd2ae437619463",
|
||||||
|
// "version" : "0.3",
|
||||||
|
// "accessDate" : "Mon, 10 October 2011 14:42:42 UTC",
|
||||||
|
// "previousVersionKey" : "####"
|
||||||
|
// },
|
||||||
|
// [...]
|
||||||
|
// "a96a6d8b9ac73fcdf874d8a8534ffb2d43da8f5222e96a4a29bd2ae437619463" : {
|
||||||
|
// "reference" : "a96a6d8b9ac73fcdf874d8a8534ffb2d43da8f5222e96a4a29bd2ae437619463",
|
||||||
|
// "accessDate" : "Mon, 10 October 2011 14:41:17 UTC",
|
||||||
|
// "creationDate" : "Mon, 27 October 2008 08:16:14 UTC",
|
||||||
|
// "version" : "0.3",
|
||||||
|
// "data" : "m3yhZu81UAjCY6U2Kn...IUCb9suV0fldGOg=",
|
||||||
|
// "updateDate" : "Mon, 27 October 2008 08:16:14 UTC",
|
||||||
|
// "header" : "####"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// "oldestUsedEncryptedVersion" : "0.2",
|
||||||
|
// "reference" : "36ec1a41118813ced3553534fa2607d781cba687768db305beed368a8e06e113",
|
||||||
|
// "data" : "frlUkTbaOWD9j2ROat...ruWioCK0Mss27oHjPg==",
|
||||||
|
// "creationDate" : "Wed, 14 March 2007 17:39:35 UTC",
|
||||||
|
// "version" : "0.3",
|
||||||
|
// "accessDate" : "Mon, 10 October 2011 14:45:12 UTC",
|
||||||
|
// "currentVersion" : "e2c193f017ad4f6babf51de59f7550a40596afc0c27373b6a360e426b5bc06de",
|
||||||
|
// "updatedDate" : "Mon, 10 October 2011 14:45:12 UTC"
|
||||||
|
// },
|
||||||
|
// "toll" : {
|
||||||
|
// "requestType" : "MESSAGE",
|
||||||
|
// "targetValue" : "a516c942a3792cc620775a41f8870a6c7b51796d9a94da978a75da6a52eb1e10",
|
||||||
|
// "cost" : 2
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$record = new record();
|
$record = new record();
|
||||||
|
|
||||||
$recordList = $record->GetList(array(array("reference", "=", $parameters["parameters"]["reference"])));
|
$recordList = $record->GetList(array(array("reference", "=", $parameters["parameters"]["reference"])));
|
||||||
@ -481,14 +635,20 @@ error_log("message");
|
|||||||
$currentRecordVersions = $currentRecord->GetRecordversionList();
|
$currentRecordVersions = $currentRecord->GetRecordversionList();
|
||||||
$currentVersion = $currentRecordVersions[0];
|
$currentVersion = $currentRecordVersions[0];
|
||||||
|
|
||||||
$result["currentVersion"] = array();
|
$result["versions"] = array();
|
||||||
$result["currentVersion"]["reference"] = $currentVersion->reference;
|
// foreach ($currentRecordVersions as $currentVersion) {
|
||||||
$result["currentVersion"]["data"] = $currentVersion->data;
|
$result["versions"][$currentVersion->reference] = array();
|
||||||
$result["currentVersion"]["header"] = $currentVersion->header;
|
$result["versions"][$currentVersion->reference]["reference"] = $currentVersion->reference;
|
||||||
$result["currentVersion"]["version"] = $currentVersion->version;
|
$result["versions"][$currentVersion->reference]["data"] = $currentVersion->data;
|
||||||
$result["currentVersion"]["creationDate"] = $currentVersion->creation_date;
|
$result["versions"][$currentVersion->reference]["header"] = $currentVersion->header;
|
||||||
$result["currentVersion"]["updateDate"] = $currentVersion->update_date;
|
$result["versions"][$currentVersion->reference]["version"] = $currentVersion->version;
|
||||||
$result["currentVersion"]["accessDate"] = $currentVersion->access_date;
|
$result["versions"][$currentVersion->reference]["creationDate"] = $currentVersion->creation_date;
|
||||||
|
$result["versions"][$currentVersion->reference]["updateDate"] = $currentVersion->update_date;
|
||||||
|
$result["versions"][$currentVersion->reference]["accessDate"] = $currentVersion->access_date;
|
||||||
|
|
||||||
|
// }
|
||||||
|
$result["currentVersion"] = $currentVersion->reference;
|
||||||
|
// $result["currentVersion"] = $currentRecord->currentVersion; // ????
|
||||||
|
|
||||||
$result["reference"] = $currentRecord->reference;
|
$result["reference"] = $currentRecord->reference;
|
||||||
$result["data"] = $currentRecord->data;
|
$result["data"] = $currentRecord->data;
|
||||||
@ -750,6 +910,9 @@ error_log("default");
|
|||||||
|
|
||||||
session_write_close();
|
session_write_close();
|
||||||
|
|
||||||
echo(json_encode($result));
|
$finalResult = Array();
|
||||||
error_log("result: ".json_encode($result));
|
$finalResult["result"] = $result;
|
||||||
|
|
||||||
|
echo(json_encode($finalResult));
|
||||||
|
error_log("result: ".json_encode($finalResult));
|
||||||
?>
|
?>
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"request.path": "clipperz.py",
|
||||||
|
"should.pay.toll": "false"
|
||||||
|
|
||||||
|
"development.settings": {
|
||||||
|
"url": "http://localhost/python/clipperz"
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,7 @@ Clipperz_IEisBroken = true;
|
|||||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||||
</script><![endif]-->
|
</script><![endif]-->
|
||||||
|
|
||||||
@js_DEBUG@
|
@js_LINKED@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -68,7 +68,7 @@ Clipperz_normalizedNewLine = '\x0d\x0a';
|
|||||||
<div id="main">
|
<div id="main">
|
||||||
<h3 class="loading">loading ...</h3>
|
<h3 class="loading">loading ...</h3>
|
||||||
|
|
||||||
@js_INSTALL@
|
@js_EMBEDDED@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@});
|
Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@});
|
||||||
|
@ -279,18 +279,23 @@ Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, {
|
|||||||
if (this.shouldProcessData()) {
|
if (this.shouldProcessData()) {
|
||||||
var currentVersionParameters;
|
var currentVersionParameters;
|
||||||
|
|
||||||
|
console.log("Record.processData", someValues);
|
||||||
this.processDataToExtractLegacyValues(someValues['data']);
|
this.processDataToExtractLegacyValues(someValues['data']);
|
||||||
|
|
||||||
if (typeof(someValues['data']['notes']) != 'undefined') {
|
if (typeof(someValues['data']['notes']) != 'undefined') {
|
||||||
this.setNotes(someValues['data']['notes']);
|
this.setNotes(someValues['data']['notes']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (someValues['data']['currentVersionKey'] != null) {
|
if (someValues['data']['currentVersionKey'] != null) {
|
||||||
this.setCurrentVersionKey(someValues['data']['currentVersionKey']);
|
this.setCurrentVersionKey(someValues['data']['currentVersionKey']);
|
||||||
} else {
|
} else {
|
||||||
this.setCurrentVersionKey(this.key());
|
this.setCurrentVersionKey(this.key());
|
||||||
}
|
}
|
||||||
|
|
||||||
currentVersionParameters = someValues['currentVersion'];
|
// currentVersionParameters = someValues['currentVersion'];
|
||||||
|
currentVersionParameters = someValues['versions'][someValues['currentVersion']];
|
||||||
|
console.log("Record.processData - this.currentVersionKey()", this.currentVersionKey());
|
||||||
|
console.log("Record.processData - currentVersionParameters", currentVersionParameters);
|
||||||
currentVersionParameters['key'] = this.currentVersionKey();
|
currentVersionParameters['key'] = this.currentVersionKey();
|
||||||
this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters));
|
this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters));
|
||||||
|
|
||||||
|
@ -116,8 +116,7 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
|
|||||||
this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
|
this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
|
||||||
}
|
}
|
||||||
//console.log("<<< Proxy.setTallCallback", someParameters['result']);
|
//console.log("<<< Proxy.setTallCallback", someParameters['result']);
|
||||||
//return someParameters['result'];
|
return someParameters['result'];
|
||||||
return someParameters;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
@ -1,262 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
Copyright 2008-2011 Clipperz Srl
|
|
||||||
|
|
||||||
This file is part of Clipperz Community Edition.
|
|
||||||
Clipperz Community Edition is an online password manager.
|
|
||||||
For further information about its features and functionalities please
|
|
||||||
refer to http://www.clipperz.com.
|
|
||||||
|
|
||||||
* Clipperz Community Edition is free software: you can redistribute
|
|
||||||
it and/or modify it under the terms of the GNU Affero General Public
|
|
||||||
License as published by the Free Software Foundation, either version
|
|
||||||
3 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
* Clipperz Community Edition is distributed in the hope that it will
|
|
||||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
||||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
See the GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Affero General Public
|
|
||||||
License along with Clipperz Community Edition. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
|
|
||||||
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
Clipperz.PM.Proxy.PHP = function(args) {
|
|
||||||
Clipperz.PM.Proxy.PHP.superclass.constructor.call(this, args);
|
|
||||||
/*
|
|
||||||
this._tolls = {
|
|
||||||
'CONNECT': [],
|
|
||||||
'REGISTER': [],
|
|
||||||
'MESSAGE': []
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
YAHOO.extendX(Clipperz.PM.Proxy.PHP, Clipperz.PM.Proxy, {
|
|
||||||
|
|
||||||
'toString': function() {
|
|
||||||
return "Clipperz.PM.Proxy.PHP - " + this.args();
|
|
||||||
},
|
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
/*
|
|
||||||
'tolls': function() {
|
|
||||||
return this._tolls;
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
'payToll': function(aRequestType, someParameters) {
|
|
||||||
var deferredResult;
|
|
||||||
|
|
||||||
//MochiKit.Logging.logDebug(">>> Proxy.DWR.payToll: " + aRequestType);
|
|
||||||
if (this.tolls()[aRequestType].length > 0) {
|
|
||||||
deferredResult = MochiKit.Async.succeed(this.tolls()[aRequestType].pop());
|
|
||||||
} else {
|
|
||||||
//MochiKit.Logging.logDebug("### " + aRequestType + " toll NOT immediately available; request queued.");
|
|
||||||
deferredResult = new MochiKit.Async.Deferred();
|
|
||||||
deferredResult.addCallback(function(someParameters) {
|
|
||||||
return new Clipperz.PM.Toll(someParameters['toll']);
|
|
||||||
})
|
|
||||||
com_clipperz_pm_Proxy.knock(Clipperz.Base.serializeJSON({requestType:aRequestType}), {
|
|
||||||
callback:MochiKit.Base.method(deferredResult, 'callback'),
|
|
||||||
errorHandler:MochiKit.Base.method(deferredResult, 'errback')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
deferredResult.addCallback(function(aToll) {
|
|
||||||
return aToll.deferredPay();
|
|
||||||
});
|
|
||||||
deferredResult.addCallback(function(someParameters, aToll) {
|
|
||||||
var result;
|
|
||||||
|
|
||||||
result = {
|
|
||||||
parameters: someParameters,
|
|
||||||
toll: aToll
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}, someParameters);
|
|
||||||
|
|
||||||
return deferredResult;
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
'addToll': function(aToll) {
|
|
||||||
this.tolls()[aToll.requestType()].push(aToll);
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
//=========================================================================
|
|
||||||
/*
|
|
||||||
'setTollCallback': function(someParameters) {
|
|
||||||
//MochiKit.Logging.logDebug(">>> Proxy.DWR.setTollCallback");
|
|
||||||
//MochiKit.Logging.logDebug("--- Proxy.DWR.setTollCallback - " + Clipperz.Base.serializeJSON(someParameters));
|
|
||||||
if (typeof(someParameters['toll']) != 'undefined') {
|
|
||||||
this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
|
|
||||||
}
|
|
||||||
return someParameters['result'];
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
//=========================================================================
|
|
||||||
|
|
||||||
'registration': function(someParameters) {
|
|
||||||
return this.sendMessage('registration', someParameters, 'REGISTER');
|
|
||||||
},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
'handshake': function(someParameters) {
|
|
||||||
/*
|
|
||||||
_s = "e8a2162f29aeaabb729f5625e9740edbf0cd80ac77c6b19ab951ed6c88443b8c";
|
|
||||||
_v = new Clipperz.Crypto.BigInt("955e2db0f7844aca372f5799e5f7e51b5866718493096908bd66abcf1d068108", 16);
|
|
||||||
_b = new Clipperz.Crypto.BigInt("5761e6c84d22ea3c5649de01702d60f674ccfe79238540eb34c61cd020230c53", 16);
|
|
||||||
|
|
||||||
_B = _v.add(Clipperz.Crypto.SRP.g().powerModule(_b, Clipperz.Crypto.SRP.n()));
|
|
||||||
_u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_B.asString(10))).toHexString(), 16);
|
|
||||||
_A = new Clipperz.Crypto.BigInt("3b3567ec33d73673552e960872eb154d091a2488915941038aef759236a27e64", 16);
|
|
||||||
_S = (_A.multiply(_v.powerModule(_u, Clipperz.Crypto.SRP.n()))).powerModule(_b, Clipperz.Crypto.SRP.n());
|
|
||||||
_K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_S.asString(10))).toHexString().slice(2);
|
|
||||||
_M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _B.asString(10) + _K)).toHexString().slice(2);
|
|
||||||
_M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _M1 + _K)).toHexString().slice(2);
|
|
||||||
|
|
||||||
// MochiKit.Logging.logDebug("b = " + _b.asString(16));
|
|
||||||
// MochiKit.Logging.logDebug("v = " + _v.asString(16));
|
|
||||||
MochiKit.Logging.logDebug("B = " + _B.asString(16));
|
|
||||||
MochiKit.Logging.logDebug("u = " + _u.asString(16));
|
|
||||||
MochiKit.Logging.logDebug("S = " + _S.asString(16));
|
|
||||||
MochiKit.Logging.logDebug("K = " + _K);
|
|
||||||
MochiKit.Logging.logDebug("M1 = " + _M1);
|
|
||||||
MochiKit.Logging.logDebug("M2 = " + _M2);
|
|
||||||
// MochiKit.Logging.logDebug("someParameters.version: " + someParameters.version);
|
|
||||||
*/
|
|
||||||
return this.sendMessage('handshake', someParameters, 'CONNECT');
|
|
||||||
},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
'message': function(someParameters) {
|
|
||||||
return this.sendMessage('message', someParameters, 'MESSAGE');
|
|
||||||
},
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
'logout': function(someParameters) {
|
|
||||||
//MochiKit.Logging.logDebug("=== Proxy.DWR.logout");
|
|
||||||
return this.sendMessage('logout', someParameters, 'MESSAGE');
|
|
||||||
},
|
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
|
|
||||||
'sendMessage': function(aFunctionName, someParameters, aRequestType) {
|
|
||||||
/*
|
|
||||||
var deferredResult;
|
|
||||||
var proxy;
|
|
||||||
|
|
||||||
//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendMessage - " + aFunctionName + " - " + aRequestType);
|
|
||||||
proxy = this;
|
|
||||||
|
|
||||||
deferredResult = new MochiKit.Async.Deferred();
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.1 Proxy.DWR.sendMessage - 1: " + res); return res;});
|
|
||||||
deferredResult.addCallback(MochiKit.Base.method(proxy, 'payToll'), aRequestType);
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.2 Proxy.DWR.sendMessage - 2: " + Clipperz.Base.serializeJSON(res)); return res;});
|
|
||||||
deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + res); return res;});
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
|
|
||||||
deferredResult.callback(someParameters);
|
|
||||||
|
|
||||||
//MochiKit.Logging.logDebug("<<< Proxy.DWR.sendMessage");
|
|
||||||
return deferredResult;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// return this.sendRemoteMessage(aFunctionName, someParameters);
|
|
||||||
|
|
||||||
|
|
||||||
var deferredResult;
|
|
||||||
var proxy;
|
|
||||||
|
|
||||||
proxy = this;
|
|
||||||
|
|
||||||
deferredResult = new MochiKit.Async.Deferred();
|
|
||||||
deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3: " + res); return res;});
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3.1: " + Clipperz.Base.serializeJSON(res)); return res;});
|
|
||||||
|
|
||||||
deferredResult.callback(someParameters);
|
|
||||||
|
|
||||||
return deferredResult;
|
|
||||||
},
|
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
|
|
||||||
'sendRemoteMessage': function(aFunctionName, someParameters) {
|
|
||||||
/*
|
|
||||||
var deferredResult;
|
|
||||||
|
|
||||||
//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
|
|
||||||
deferredResult = new MochiKit.Async.Deferred();
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 1: " + res); return res;});
|
|
||||||
// deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback'));
|
|
||||||
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 2: " + res); return res;});
|
|
||||||
|
|
||||||
com_clipperz_pm_Proxy[aFunctionName](Clipperz.Base.serializeJSON(someParameters), {
|
|
||||||
callback:MochiKit.Base.method(deferredResult, 'callback'),
|
|
||||||
errorHandler:MochiKit.Base.method(deferredResult, 'errback')
|
|
||||||
});
|
|
||||||
//MochiKit.Logging.logDebug("<<< Proxy.PHP.sendRemoteMessage - result: " + deferredResult);
|
|
||||||
|
|
||||||
return deferredResult;
|
|
||||||
*/
|
|
||||||
|
|
||||||
var deferredResult;
|
|
||||||
var parameters;
|
|
||||||
|
|
||||||
//MochiKit.Logging.logDebug(">>> Proxy.PHP.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
|
|
||||||
parameters = {};
|
|
||||||
parameters['method'] = aFunctionName;
|
|
||||||
// parameters['version'] = someParameters['version'];
|
|
||||||
// parameters['message'] = someParameters['message'];
|
|
||||||
parameters['parameters'] = Clipperz.Base.serializeJSON(someParameters);
|
|
||||||
//MochiKit.Logging.logDebug("--- Proxy.PHP.sendRemoteMessage('" + Clipperz.Base.serializeJSON(parameters) + ") - " + this);
|
|
||||||
deferredResult = new MochiKit.Async.Deferred();
|
|
||||||
deferredResult.addCallback(MochiKit.Async.doXHR, "./php/index.php", {
|
|
||||||
method:'POST',
|
|
||||||
sendContent:MochiKit.Base.queryString(parameters),
|
|
||||||
headers:{"Content-Type":"application/x-www-form-urlencoded"}
|
|
||||||
});
|
|
||||||
//deferredResult.addCallback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - 2: " + res.responseText); return res;});
|
|
||||||
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - ERROR: " + res); return res;});
|
|
||||||
deferredResult.addCallback(MochiKit.Async.evalJSONRequest);
|
|
||||||
deferredResult.addCallback(function (someValues) {
|
|
||||||
if (someValues['result'] == 'EXCEPTION') {
|
|
||||||
throw someValues['message'];
|
|
||||||
}
|
|
||||||
return someValues;
|
|
||||||
})
|
|
||||||
deferredResult.callback();
|
|
||||||
|
|
||||||
return deferredResult;
|
|
||||||
},
|
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
|
|
||||||
'isReadOnly': function() {
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
__syntaxFix__: "syntax fix"
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
//Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.PHP("Proxy.PHP - async test");
|
|
3725
frontend/gamma/css/clipperz.css
Normal file
3725
frontend/gamma/css/clipperz.css
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -24,38 +24,50 @@ refer to http://www.clipperz.com.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* @override https://www.example.com/css/compact.css */
|
/* @override https://www.example.com/css/compact.css */
|
||||||
|
|
||||||
body.compact div#mainDiv {
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
Color list:
|
||||||
|
- login box:
|
||||||
|
light #ff9955
|
||||||
|
dark #ff6622
|
||||||
|
- login button:
|
||||||
|
regular #dd5500
|
||||||
|
hover #773311
|
||||||
|
- login translations:
|
||||||
|
box: #cc6622;
|
||||||
|
not-selected:
|
||||||
|
color: #ddaa99
|
||||||
|
background: #994422
|
||||||
|
selected: #772211;
|
||||||
|
*/
|
||||||
|
body.compact div#mainDiv {
|
||||||
|
/*
|
||||||
width: 250px;
|
width: 250px;
|
||||||
height: 95%;
|
height: 95%;
|
||||||
border: 1px solid #333366;
|
border: 1px solid #333366;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div#compactHeader {
|
body.compact div#compactHeader {
|
||||||
background-color: #333366;
|
background-color: #333366;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div#compactHeader img {
|
body.compact div#compactHeader img {
|
||||||
padding: 2px 20px 2px 4px;
|
padding: 2px 20px 2px 4px;
|
||||||
width: 60;
|
width: 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div#compactHeader a {
|
body.compact div#compactHeader a {
|
||||||
color: white;
|
color: white;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
/* position: absolute; */
|
/* position: absolute; */
|
||||||
|
|
||||||
right: 10px;
|
right: 10px;
|
||||||
top: 6px;
|
top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div#compactHeader a:hover {
|
body.compact div#compactHeader a:hover {
|
||||||
color: #ff9400;
|
color: #ff9400;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact h4 {
|
body.compact h4 {
|
||||||
color: #999999;
|
color: #999999;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -64,87 +76,70 @@ body.compact h4 {
|
|||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div.loginPanel form {
|
body.compact div.loginPanel form {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div.loginPanel dt {
|
body.compact div.loginPanel dt {
|
||||||
color: #aaaaaa;
|
color: #aaaaaa;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div.loginPanel input {
|
body.compact div.loginPanel input {
|
||||||
width: 180px;
|
width: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact ul#directLogins {
|
body.compact ul#directLogins {
|
||||||
background-image: none;
|
background-image: none;
|
||||||
padding: 4px 0px;
|
padding: 4px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact ul#directLogins li {
|
body.compact ul#directLogins li {
|
||||||
width:auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact ul#directLogins li.hover {
|
body.compact ul#directLogins li.hover {
|
||||||
width:auto;
|
width: auto;
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.compact div.lockPanel {
|
body.compact div.lockPanel {
|
||||||
color: #999999;
|
color: #999999;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#compactMiscLinks ul {
|
div#compactMiscLinks ul {
|
||||||
/* text-align: center; */
|
/* text-align: center; */
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
padding-left: 22px;
|
padding-left: 22px;
|
||||||
background-color: #ff9400;
|
background-color: #ff9400;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#compactMiscLinks ul li {
|
div#compactMiscLinks ul li {
|
||||||
display: inline;
|
display: inline;
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#compactHeader div#compactMiscLinks ul li a {
|
div#compactHeader div#compactMiscLinks ul li a {
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#compactHeader div#compactMiscLinks ul li a:hover {
|
div#compactHeader div#compactMiscLinks ul li a:hover {
|
||||||
color: #333366;
|
color: #333366;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#lockBlock {
|
div#lockBlock {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
top: 6px;
|
top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#lockBlock input {
|
div#lockBlock input {
|
||||||
width: auto;
|
width: auto;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#lockBlock span {
|
div#lockBlock span {
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
padding: 0px 5px 0px 4px;
|
padding: 0px 5px 0px 4px;
|
||||||
color: #aaaaaa;
|
color: #aaaaaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#lockBlock a#lock {
|
div#lockBlock a#lock {
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @group Donate */
|
/* @group Donate */
|
||||||
|
|
||||||
a#donateHeaderLink {
|
a#donateHeaderLink {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#compactMiscLinks a#donateHeaderIconLink img#donateHeaderLinkIcon {
|
div#compactMiscLinks a#donateHeaderIconLink img#donateHeaderLinkIcon {
|
||||||
display: inline;
|
display: inline;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -153,7 +148,4 @@ div#compactMiscLinks a#donateHeaderIconLink img#donateHeaderLinkIcon {
|
|||||||
width: 12px;
|
width: 12px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* @end */
|
/* @end */
|
428
frontend/gamma/css/iPhone.css
Normal file
428
frontend/gamma/css/iPhone.css
Normal file
File diff suppressed because one or more lines are too long
@ -23,7 +23,7 @@ Clipperz_IEisBroken = true;
|
|||||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||||
</script><![endif]-->
|
</script><![endif]-->
|
||||||
|
|
||||||
@js_DEBUG@
|
@js_LINKED@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -34,11 +34,16 @@ Clipperz_normalizedNewLine = '\x0d\x0a';
|
|||||||
<h2>loading ...</h2>
|
<h2>loading ...</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@js_INSTALL@
|
@js_EMBEDDED@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="applicationVersionType" class="@application.version.type@"></div>
|
<div id="applicationVersionType" class="@application.version.type@"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@});
|
||||||
|
/*offline_data_placeholder*/
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div id="javaScriptAlert">
|
<div id="javaScriptAlert">
|
||||||
<div class="mask"></div>
|
<div class="mask"></div>
|
||||||
|
@ -62,7 +62,8 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
|
|||||||
|
|
||||||
'callback': function (aValue) {
|
'callback': function (aValue) {
|
||||||
if (this._shouldTrace) {
|
if (this._shouldTrace) {
|
||||||
Clipperz.log("CALLBACK " + this._name, aValue);
|
// Clipperz.log("CALLBACK " + this._name, aValue);
|
||||||
|
console.log("CALLBACK " + this._name, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.chained == false) {
|
if (this.chained == false) {
|
||||||
@ -82,7 +83,8 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
|
|||||||
resultMessage = "RESULT " + this._name + " <==";
|
resultMessage = "RESULT " + this._name + " <==";
|
||||||
// this.addCallback(function(aResult) {
|
// this.addCallback(function(aResult) {
|
||||||
Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) {
|
Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) {
|
||||||
Clipperz.log(resultMessage, aResult);
|
// Clipperz.log(resultMessage, aResult);
|
||||||
|
console.log(resultMessage, aResult);
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
});
|
});
|
||||||
@ -106,8 +108,10 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
|
|||||||
message = "[" + this._count + "] " + this._name + " ";
|
message = "[" + this._count + "] " + this._name + " ";
|
||||||
// this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;});
|
// this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;});
|
||||||
this.addCallbacks(
|
this.addCallbacks(
|
||||||
function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
|
// function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
|
||||||
function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
|
function(aResult) {console.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
|
||||||
|
// function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
|
||||||
|
function(aResult) {console.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,8 +120,10 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
|
|||||||
if (this._shouldTrace) {
|
if (this._shouldTrace) {
|
||||||
// this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;});
|
// this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;});
|
||||||
this.addCallbacks(
|
this.addCallbacks(
|
||||||
function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
|
// function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
|
||||||
function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;}
|
function(aResult) {console.log("-OK- " + message + "<--", aResult); return aResult;},
|
||||||
|
// function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;}
|
||||||
|
function(aResult) {console.log("FAIL " + message + "<--", aResult); return aResult;}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -406,6 +412,7 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, {
|
|||||||
} else if (this.numberOfMethodsDone() == this.methods().length) {
|
} else if (this.numberOfMethodsDone() == this.methods().length) {
|
||||||
this.result().callback();
|
this.result().callback();
|
||||||
} else if (this.numberOfMethodsDone() > this.methods().length) {
|
} else if (this.numberOfMethodsDone() > this.methods().length) {
|
||||||
|
alert("Clipperz.Async.Deferred.handleMethodCallDone -> WTF!");
|
||||||
// WTF!!! :(
|
// WTF!!! :(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
|
|||||||
'processMessage': function (aFunctionName, someParameters, aRequestType) {
|
'processMessage': function (aFunctionName, someParameters, aRequestType) {
|
||||||
var deferredResult;
|
var deferredResult;
|
||||||
|
|
||||||
deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false});
|
deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:true});
|
||||||
deferredResult.addMethod(this, 'payToll', aRequestType);
|
deferredResult.addMethod(this, 'payToll', aRequestType);
|
||||||
deferredResult.addMethod(this, 'sendMessage', aFunctionName);
|
deferredResult.addMethod(this, 'sendMessage', aFunctionName);
|
||||||
deferredResult.addMethod(this, 'setTollCallback');
|
deferredResult.addMethod(this, 'setTollCallback');
|
||||||
|
@ -183,7 +183,7 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
"css": [
|
"css": [
|
||||||
"clipperz/clipperz.css",
|
"clipperz.css",
|
||||||
"clipperz/compact.css"
|
"compact.css"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -3,10 +3,14 @@
|
|||||||
|
|
||||||
import sys, os, json
|
import sys, os, json
|
||||||
import shutil
|
import shutil
|
||||||
import main
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
class BackendBuilder:
|
import main
|
||||||
|
|
||||||
|
#===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class BackendBuilder(object):
|
||||||
|
|
||||||
def __init__ (self, projectTargetDir, frontends, versions, settings):
|
def __init__ (self, projectTargetDir, frontends, versions, settings):
|
||||||
self.projectTargetDir = projectTargetDir
|
self.projectTargetDir = projectTargetDir
|
||||||
@ -14,46 +18,54 @@ class BackendBuilder:
|
|||||||
self.versions = versions
|
self.versions = versions
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
def name (self):
|
def name (self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
def relativePath (self):
|
def relativePath (self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def compileCode (self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def copyCompiledCodeToTargetDir (self):
|
def compileCode (self):
|
||||||
src = self.sourceFolder()
|
raise NotImplementedError()
|
||||||
dst = self.targetFolder()
|
|
||||||
main.createFolder(os.path.dirname(dst))
|
|
||||||
shutil.copytree(src, dst)
|
def createPackage (self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
def sourceFolder (self):
|
def sourceFolder (self):
|
||||||
return main.projectBaseDir() + '/backend/' + self.relativePath() + '/src'
|
return os.path.join(main.projectBaseDir() , 'backend', self.relativePath(), 'src')
|
||||||
|
|
||||||
|
|
||||||
|
def tempFolder (self):
|
||||||
|
return os.path.join(self.projectTargetDir, '.tmp', self.relativePath())
|
||||||
|
|
||||||
|
|
||||||
|
def frontEndTempFolder (self):
|
||||||
|
return self.tempFolder()
|
||||||
|
|
||||||
|
|
||||||
|
def developmentTargetFolder (self):
|
||||||
|
return os.path.join(self.projectTargetDir, 'development', self.relativePath())
|
||||||
|
|
||||||
def targetFolder (self):
|
def targetFolder (self):
|
||||||
return self.projectTargetDir + self.relativePath()
|
return os.path.join(self.projectTargetDir, self.relativePath())
|
||||||
|
|
||||||
def createTargetFolder (self):
|
# --------------------------------------------------------------------------
|
||||||
main.createFolder(self.targetFolder())
|
|
||||||
|
|
||||||
|
def writeToFolder (self, folder, filename, content):
|
||||||
# def copyFrontendResources (self, frontend):
|
file = open(os.path.join(folder, filename), 'w')
|
||||||
# print "copying resources for frontend: " + frontend
|
|
||||||
# print "SETTINGS: " + str(self.settings)
|
|
||||||
|
|
||||||
|
|
||||||
def writeToTargetFolder (self, filename, content):
|
|
||||||
file = open(self.targetFolder() + '/' + filename, 'w')
|
|
||||||
file.write(content.encode('utf-8'))
|
file.write(content.encode('utf-8'))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
def configureIndexContent (self, indexContent):
|
def configureIndexContent (self, indexContent, requestPathPrefix = ".."):
|
||||||
result = indexContent
|
result = indexContent
|
||||||
result = result.replace( '@request.path@', self.settings['request.path'] )
|
result = result.replace( '@request.path@', requestPathPrefix + '/' + self.settings['request.path'] )
|
||||||
result = result.replace( '@should.pay.toll@', self.settings['should.pay.toll'] )
|
result = result.replace( '@should.pay.toll@', self.settings['should.pay.toll'] )
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -68,22 +80,39 @@ class BackendBuilder:
|
|||||||
print message + ": " + sha256Digest + " (sha256)"
|
print message + ": " + sha256Digest + " (sha256)"
|
||||||
|
|
||||||
|
|
||||||
|
def shouldCompileCode (self):
|
||||||
|
return ('debug' in self.versions) or ('install' in self.versions)
|
||||||
|
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
print self.name() + " - RUN"
|
print self.name() + " - RUN"
|
||||||
|
|
||||||
|
if self.shouldCompileCode():
|
||||||
self.compileCode()
|
self.compileCode()
|
||||||
self.copyCompiledCodeToTargetDir()
|
|
||||||
|
|
||||||
for frontend in self.frontends:
|
for frontend in self.frontends:
|
||||||
frontendPath = frontend.module + '/'
|
main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module))
|
||||||
|
|
||||||
if 'debug' in self.versions:
|
if 'debug' in self.versions:
|
||||||
frontend.copyResourcesToTargetFolder(self.targetFolder())
|
frontend.copyResourcesToFolder(self.frontEndTempFolder())
|
||||||
#self.writeToTargetFolder(frontendPath + 'index_debug.html', self.configureIndexContent(frontend.assembleDebugVersion()))
|
|
||||||
self.writeToTargetFolder(frontendPath + 'index_debug.html', self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')))
|
index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG'))
|
||||||
|
self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug.html'), index)
|
||||||
|
|
||||||
if 'install' in self.versions:
|
if 'install' in self.versions:
|
||||||
index = self.configureIndexContent(frontend.assemble())
|
index = self.configureIndexContent(frontend.assemble())
|
||||||
self.writeToTargetFolder(frontendPath + 'index.html', index)
|
self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index.html'), index)
|
||||||
|
|
||||||
self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index.html checksum")
|
self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index.html checksum")
|
||||||
|
|
||||||
|
self.createPackage()
|
||||||
|
|
||||||
|
if 'development' in self.versions:
|
||||||
|
for frontend in self.frontends:
|
||||||
|
main.createFolder(os.path.join(self.developmentTargetFolder(), frontend.module))
|
||||||
|
|
||||||
|
index = self.configureIndexContent(frontend.assemble(assemblyMode='DEVELOPMENT', versionType='DEBUG'), self.settings['development.settings']['url'])
|
||||||
|
self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index_development.html'), index)
|
||||||
|
|
||||||
|
|
||||||
|
#===================================================================
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
from backendBuilder import BackendBuilder
|
from scriptLanguageBuilder import ScriptLanguageBuilder
|
||||||
|
|
||||||
class PhpBuilder(BackendBuilder):
|
class PhpBuilder(ScriptLanguageBuilder):
|
||||||
|
|
||||||
def name(self):
|
def name(self):
|
||||||
return "PHP builder"
|
return "PHP builder"
|
||||||
|
|
||||||
|
|
||||||
def relativePath(self):
|
def relativePath(self):
|
||||||
return 'php'
|
return 'php'
|
||||||
|
|
||||||
|
|
27
scripts/builder/backends/pythonBuilder.py
Normal file
27
scripts/builder/backends/pythonBuilder.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
|
from scriptLanguageBuilder import ScriptLanguageBuilder
|
||||||
|
|
||||||
|
class PythonBuilder(ScriptLanguageBuilder):
|
||||||
|
|
||||||
|
def name(self):
|
||||||
|
return "Python builder"
|
||||||
|
|
||||||
|
|
||||||
|
def relativePath(self):
|
||||||
|
return 'python'
|
||||||
|
|
||||||
|
|
||||||
|
def compileCode (self):
|
||||||
|
src = self.sourceFolder()
|
||||||
|
dst = self.targetFolder()
|
||||||
|
|
||||||
|
shutil.copytree(src, dst)
|
||||||
|
|
||||||
|
|
||||||
|
# def copyCompiledCodeToTargetDir (self):
|
||||||
|
# src = self.sourceFolder()
|
||||||
|
# dst = self.targetFolder()
|
||||||
|
#
|
||||||
|
# shutil.copytree(src, dst)
|
20
scripts/builder/backends/scriptLanguageBuilder.py
Normal file
20
scripts/builder/backends/scriptLanguageBuilder.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
from backendBuilder import BackendBuilder
|
||||||
|
|
||||||
|
class ScriptLanguageBuilder(BackendBuilder):
|
||||||
|
|
||||||
|
def compileCode (self):
|
||||||
|
src = self.sourceFolder()
|
||||||
|
dst = self.tempFolder()
|
||||||
|
|
||||||
|
shutil.copytree(src, dst)
|
||||||
|
|
||||||
|
|
||||||
|
def createPackage (self):
|
||||||
|
src = self.tempFolder()
|
||||||
|
dst = self.targetFolder()
|
||||||
|
|
||||||
|
shutil.copytree(src, dst)
|
@ -9,17 +9,11 @@ import shutil
|
|||||||
import StringIO
|
import StringIO
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
#from mercurial import ui, hg
|
|
||||||
#from mercurial.node import hex
|
|
||||||
from dulwich.repo import Repo
|
|
||||||
|
|
||||||
import main
|
import main
|
||||||
|
|
||||||
|
class FrontendBuilder(object):
|
||||||
|
|
||||||
|
def __init__ (self, frontend, settings, repositoryVersion):
|
||||||
class FrontendBuilder:
|
|
||||||
|
|
||||||
def __init__ (self, frontend, settings):
|
|
||||||
if '.' in frontend:
|
if '.' in frontend:
|
||||||
moduleComponents = frontend.split('.')
|
moduleComponents = frontend.split('.')
|
||||||
self.module = moduleComponents[0]
|
self.module = moduleComponents[0]
|
||||||
@ -30,53 +24,26 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.projectDir = main.projectBaseDir()
|
self.projectDir = main.projectBaseDir()
|
||||||
|
# self.repository = repository.repositoryWithPath(self.projectDir)
|
||||||
|
self.repositoryVersion = repositoryVersion
|
||||||
self.processedFiles = {}
|
self.processedFiles = {}
|
||||||
|
|
||||||
|
|
||||||
def mercurialRepositoryVersion (self):
|
|
||||||
repo = hg.repository(ui.ui(), self.projectDir)
|
|
||||||
context = repo['tip']
|
|
||||||
result = str(context)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def gitRepositoryVersion (self):
|
|
||||||
repo = Repo(self.projectDir)
|
|
||||||
#if repo.is_dirty():
|
|
||||||
# print "WARNING: build run with dirty repository"
|
|
||||||
result = repo.refs['HEAD']
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def repositoryVersion (self):
|
|
||||||
cacheKey = 'repositoryVersion'
|
|
||||||
if not self.processedFiles.has_key(cacheKey):
|
|
||||||
#result = self.mercurialRepositoryVersion()
|
|
||||||
result = self.gitRepositoryVersion()
|
|
||||||
self.processedFiles[cacheKey] = result
|
|
||||||
else:
|
|
||||||
result = self.processedFiles[cacheKey]
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
#def relativePath (self):
|
|
||||||
# return self.module
|
|
||||||
#
|
|
||||||
|
|
||||||
def log (self, message):
|
def log (self, message):
|
||||||
print "frontend [" + self.module + "]: " + message
|
print "frontend [" + self.module + "]: " + message
|
||||||
|
|
||||||
|
|
||||||
def absolutePathForSourceFile (self, folder, basePath, file):
|
def absolutePathForSources (self):
|
||||||
return folder + '/frontend/' + self.module + '/' + basePath + '/' + file
|
return os.path.join(self.projectDir, 'frontend', self.module)
|
||||||
|
|
||||||
|
|
||||||
|
def absolutePathForSourceFile (self, basePath, file):
|
||||||
|
return os.path.join(self.absolutePathForSources(), basePath, file)
|
||||||
|
|
||||||
|
|
||||||
def absolutePathForTargetFile (self, folder, basePath, file):
|
def absolutePathForTargetFile (self, folder, basePath, file):
|
||||||
return folder + '/' + self.module + '/' + basePath + '/' + file
|
return os.path.join(folder, self.module, basePath, file)
|
||||||
|
|
||||||
|
|
||||||
def filterFiles (self, files):
|
def filterFiles (self, files):
|
||||||
result = []
|
result = []
|
||||||
@ -92,13 +59,13 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
def copyResources (self, sourceFolder, destinationFolder, fileType):
|
def copyResources (self, sourceFolder, destinationFolder, fileType):
|
||||||
for file in self.filterFiles(self.settings[fileType]):
|
for file in self.filterFiles(self.settings[fileType]):
|
||||||
src = self.absolutePathForSourceFile(sourceFolder, fileType, file)
|
src = self.absolutePathForSourceFile(fileType, file)
|
||||||
dst = self.absolutePathForTargetFile(destinationFolder, fileType, file)
|
dst = self.absolutePathForTargetFile(destinationFolder, fileType, file)
|
||||||
main.createFolder(os.path.dirname(dst))
|
main.createFolder(os.path.dirname(dst))
|
||||||
shutil.copy2(src, dst)
|
shutil.copy2(src, dst)
|
||||||
|
|
||||||
|
|
||||||
def copyResourcesToTargetFolder (self, targetFolder):
|
def copyResourcesToFolder (self, targetFolder):
|
||||||
self.copyResources(self.projectDir, targetFolder, 'css')
|
self.copyResources(self.projectDir, targetFolder, 'css')
|
||||||
self.copyResources(self.projectDir, targetFolder, 'js')
|
self.copyResources(self.projectDir, targetFolder, 'js')
|
||||||
|
|
||||||
@ -108,7 +75,7 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
for file in self.filterFiles(files):
|
for file in self.filterFiles(files):
|
||||||
try:
|
try:
|
||||||
fileHandler = codecs.open(self.absolutePathForSourceFile(self.projectDir, basePath, file), 'r', 'utf-8')
|
fileHandler = codecs.open(self.absolutePathForSourceFile(basePath, file), 'r', 'utf-8')
|
||||||
except:
|
except:
|
||||||
print "FILE: " + file
|
print "FILE: " + file
|
||||||
|
|
||||||
@ -181,8 +148,8 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
|
|
||||||
def compressJS_jsmin (self, js):
|
def compressJS_jsmin (self, js, description):
|
||||||
self.log("compressing JS code")
|
self.log("compressing " + description + " code")
|
||||||
original = StringIO.StringIO(js)
|
original = StringIO.StringIO(js)
|
||||||
output = StringIO.StringIO()
|
output = StringIO.StringIO()
|
||||||
|
|
||||||
@ -196,7 +163,7 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def compressJS_closureCompiler (self, js):
|
def compressJS_closureCompiler (self, js, description):
|
||||||
# Googles Closure compiler
|
# Googles Closure compiler
|
||||||
# java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js
|
# java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js
|
||||||
|
|
||||||
@ -205,14 +172,14 @@ class FrontendBuilder:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def compressJS (self, js):
|
def compressJS (self, js, description):
|
||||||
return self.compressJS_jsmin(js)
|
return self.compressJS_jsmin(js, description)
|
||||||
#return self.compressJS_closureCompiler(js)
|
#return self.compressJS_closureCompiler(js, description)
|
||||||
|
|
||||||
|
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
|
|
||||||
def packBookmarklet (self, bookmakeletCode):
|
def packBookmarklet (self, bookmakeletCode, version):
|
||||||
replacers = [
|
replacers = [
|
||||||
('isLoginForm', 'ilf'),
|
('isLoginForm', 'ilf'),
|
||||||
('findLoginForm', 'flf'),
|
('findLoginForm', 'flf'),
|
||||||
@ -227,7 +194,7 @@ class FrontendBuilder:
|
|||||||
('parameters', 'p' ),
|
('parameters', 'p' ),
|
||||||
('inputElementValues', 'iev'),
|
('inputElementValues', 'iev'),
|
||||||
]
|
]
|
||||||
result = self.compressJS(bookmakeletCode)
|
result = self.compressJS(bookmakeletCode, version + " bookmarklet")
|
||||||
|
|
||||||
result = re.sub('\n', ' ', result) # Fit all in a single line
|
result = re.sub('\n', ' ', result) # Fit all in a single line
|
||||||
# result = re.sub('\s+', ' ', result) # Collapse "redundant" spaces. WARNING: this could have some evil side effects on constant strings used inside to code!!
|
# result = re.sub('\s+', ' ', result) # Collapse "redundant" spaces. WARNING: this could have some evil side effects on constant strings used inside to code!!
|
||||||
@ -300,7 +267,7 @@ class FrontendBuilder:
|
|||||||
def bookmarklet (self):
|
def bookmarklet (self):
|
||||||
cacheKey = 'bookmarklet'
|
cacheKey = 'bookmarklet'
|
||||||
if not self.processedFiles.has_key(cacheKey):
|
if not self.processedFiles.has_key(cacheKey):
|
||||||
result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js'])) + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js'])) + '";'
|
result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";'
|
||||||
self.processedFiles[cacheKey] = result
|
self.processedFiles[cacheKey] = result
|
||||||
else:
|
else:
|
||||||
result = self.processedFiles[cacheKey]
|
result = self.processedFiles[cacheKey]
|
||||||
@ -308,7 +275,7 @@ class FrontendBuilder:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def replaceTemplatePlaceholders (self, assemblyMode, pageTitle, copyright, css, code, version, versionType):
|
def replaceTemplatePlaceholders (self, pageTitle, copyright, css, code, jsLoadMode, version, versionType):
|
||||||
result = self.template()
|
result = self.template()
|
||||||
|
|
||||||
result = result.replace('@page.title@', pageTitle, 1)
|
result = result.replace('@page.title@', pageTitle, 1)
|
||||||
@ -317,7 +284,7 @@ class FrontendBuilder:
|
|||||||
#result = result.replace('@bookmarklet@', bookmarklet, 1)
|
#result = result.replace('@bookmarklet@', bookmarklet, 1)
|
||||||
result = result.replace('@application.version@', version, 1)
|
result = result.replace('@application.version@', version, 1)
|
||||||
result = result.replace('@application.version.type@', versionType, 1)
|
result = result.replace('@application.version.type@', versionType, 1)
|
||||||
result = result.replace('@js_' + assemblyMode + '@', code, 1)
|
result = result.replace('@js_' + jsLoadMode + '@', code, 1)
|
||||||
|
|
||||||
result = re.sub('@js_[^@]+@', '', result)
|
result = re.sub('@js_[^@]+@', '', result)
|
||||||
|
|
||||||
@ -343,7 +310,7 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
def cssTagsForFiles (self, basePath, files):
|
def cssTagsForFiles (self, basePath, files):
|
||||||
#<link rel="stylesheet" type="text/css" href="./css/reset-min.css" />
|
#<link rel="stylesheet" type="text/css" href="./css/reset-min.css" />
|
||||||
return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="./' + basePath + '/' + file + '" />', files))
|
return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files))
|
||||||
|
|
||||||
|
|
||||||
def cssTagForContent (self, content):
|
def cssTagForContent (self, content):
|
||||||
@ -352,17 +319,17 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
def scriptTagsForFiles (self, basePath, files):
|
def scriptTagsForFiles (self, basePath, files):
|
||||||
#<script type='text/javascript' src='./js/src/bookmarklet.js'></script>
|
#<script type='text/javascript' src='./js/src/bookmarklet.js'></script>
|
||||||
return '\n'.join(map(lambda file: '<script type="text/javascript" src="./' + basePath + '/' + file + '"></script>', files))
|
return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '"></script>', files))
|
||||||
|
|
||||||
|
|
||||||
def scriptTagForContent (self, content):
|
def scriptTagForContent (self, content):
|
||||||
return '<script>' + content + '</script>'
|
return '<script>' + content + '</script>'
|
||||||
|
|
||||||
|
|
||||||
def assembleVersion (self, assemblyMode, pageTitle, copyright, css, js, version, versionType):
|
def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType):
|
||||||
cacheKey = version + "-" + versionType
|
cacheKey = version + "-" + versionType
|
||||||
if not self.processedFiles.has_key(cacheKey):
|
if not self.processedFiles.has_key(cacheKey):
|
||||||
result = self.replaceTemplatePlaceholders(assemblyMode, pageTitle, copyright, css, js, version, versionType)
|
result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType)
|
||||||
self.processedFiles[cacheKey] = result
|
self.processedFiles[cacheKey] = result
|
||||||
else:
|
else:
|
||||||
result = self.processedFiles[cacheKey]
|
result = self.processedFiles[cacheKey]
|
||||||
@ -372,24 +339,48 @@ class FrontendBuilder:
|
|||||||
|
|
||||||
|
|
||||||
def assemble (self, assemblyMode='INSTALL', versionType='LIVE'):
|
def assemble (self, assemblyMode='INSTALL', versionType='LIVE'):
|
||||||
|
|
||||||
|
if versionType == 'LIVE':
|
||||||
pageTitle = "Clipperz - " + self.module
|
pageTitle = "Clipperz - " + self.module
|
||||||
if versionType != 'LIVE':
|
else:
|
||||||
pageTitle += " [" + versionType + " - " + assemblyMode +"]"
|
pageTitle = "Clipperz - " + self.module + " [" + versionType + " - " + assemblyMode +"]"
|
||||||
|
|
||||||
if assemblyMode == 'INSTALL':
|
if assemblyMode == 'INSTALL':
|
||||||
|
copyright = self.assembleCopyrightHeader()
|
||||||
css = self.cssTagForContent(self.compressCSS(self.loadFilesContent('css', self.settings['css'])))
|
css = self.cssTagForContent(self.compressCSS(self.loadFilesContent('css', self.settings['css'])))
|
||||||
js = self.scriptTagForContent(self.bookmarklet() + '\n' + self.compressJS(self.loadFilesContent('js', self.settings['js'])))
|
js = self.scriptTagForContent(
|
||||||
|
self.bookmarklet() +
|
||||||
|
'\n' +
|
||||||
|
self.compressJS(self.loadFilesContent('js', self.settings['js']), "application")
|
||||||
|
)
|
||||||
|
jsLoadMode = 'EMBEDDED'
|
||||||
|
|
||||||
|
elif assemblyMode == 'DEBUG':
|
||||||
|
copyright = self.assembleCopyrightHeader()
|
||||||
|
css = self.cssTagsForFiles('./css', self.filterFiles(self.settings['css']))
|
||||||
|
js = self.scriptTagForContent(self.bookmarklet()) + \
|
||||||
|
'\n' + \
|
||||||
|
self.scriptTagsForFiles('./js', self.filterFiles(self.settings['js']))
|
||||||
|
jsLoadMode = 'LINKED'
|
||||||
|
|
||||||
|
elif assemblyMode == 'DEVELOPMENT':
|
||||||
|
copyright = ""
|
||||||
|
css = self.cssTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'css')), self.filterFiles(self.settings['css']))
|
||||||
|
js = self.scriptTagForContent(self.bookmarklet()) + \
|
||||||
|
'\n' + \
|
||||||
|
self.scriptTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'js')), self.filterFiles(self.settings['js']))
|
||||||
|
jsLoadMode = 'LINKED'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
css = self.cssTagsForFiles('css', self.filterFiles(self.settings['css']))
|
raise NotImplementedError()
|
||||||
js = self.scriptTagForContent(self.bookmarklet()) + '\n' + self.scriptTagsForFiles('js', self.filterFiles(self.settings['js']))
|
|
||||||
|
|
||||||
return self.assembleVersion(
|
return self.assembleVersion(
|
||||||
assemblyMode = assemblyMode,
|
|
||||||
pageTitle = pageTitle,
|
pageTitle = pageTitle,
|
||||||
copyright = self.assembleCopyrightHeader(),
|
copyright = copyright,
|
||||||
css = css,
|
css = css,
|
||||||
js = js,
|
js = js,
|
||||||
version = self.repositoryVersion(),
|
jsLoadMode = jsLoadMode,
|
||||||
|
version = self.repositoryVersion,
|
||||||
versionType = versionType
|
versionType = versionType
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
import sys, os, json
|
import sys
|
||||||
|
import os
|
||||||
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
import pprint
|
import pprint
|
||||||
import frontendBuilder
|
|
||||||
import codecs
|
import codecs
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from phpBuilder import PhpBuilder
|
|
||||||
from pythonBuilder import PythonBuilder
|
import frontendBuilder
|
||||||
|
import repository
|
||||||
|
|
||||||
pp = pprint.PrettyPrinter(indent=4, depth=4)
|
pp = pprint.PrettyPrinter(indent=4, depth=4)
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ def createFolder (path):
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
def loadSettings (component, module):
|
def loadSettings (component, module):
|
||||||
print "MODULE: " + module
|
# print "MODULE: " + module
|
||||||
|
|
||||||
if '.' in module:
|
if '.' in module:
|
||||||
moduleComponents = module.split('.')
|
moduleComponents = module.split('.')
|
||||||
@ -43,7 +44,8 @@ def loadSettings (component, module):
|
|||||||
else:
|
else:
|
||||||
submodule = module
|
submodule = module
|
||||||
|
|
||||||
settings = codecs.open(projectBaseDir() + '/' + component + '/' + module + '/properties/' + submodule + '.properties.json', 'r', 'utf-8')
|
#settings = codecs.open(projectBaseDir() + os.sep + component + os.sep + module + os.sep + 'properties' + os.sep + submodule + '.properties.json', 'r', 'utf-8')
|
||||||
|
settings = codecs.open(os.path.join(projectBaseDir(), component, module, 'properties', submodule + '.properties.json'), 'r', 'utf-8')
|
||||||
result = json.load(settings)
|
result = json.load(settings)
|
||||||
settings.close
|
settings.close
|
||||||
|
|
||||||
@ -71,24 +73,25 @@ def loadSettings (component, module):
|
|||||||
def assembleBackend (backend, frontends, versions):
|
def assembleBackend (backend, frontends, versions):
|
||||||
settings = loadSettings('backend', backend)
|
settings = loadSettings('backend', backend)
|
||||||
|
|
||||||
if backend == 'php':
|
builderModuleName = backend + 'Builder'
|
||||||
backendBuilder = PhpBuilder(projectTargetDir(), frontends, versions, settings)
|
builderClassName = backend.capitalize() + 'Builder'
|
||||||
elif backend == 'python':
|
|
||||||
backendBuilder = PythonBuilder(projectTargetDir(), frontends, versions, settings)
|
|
||||||
#elif backend == 'java':
|
|
||||||
# buildJavaBackend (frontends, versions, settings)
|
|
||||||
else:
|
|
||||||
raise Exception('unrecognized backend: ' + backend)
|
|
||||||
|
|
||||||
|
builderModule = __import__(builderModuleName)
|
||||||
|
builderClass = getattr(builderModule, builderClassName)
|
||||||
|
|
||||||
|
backendBuilder = builderClass(projectTargetDir(), frontends, versions, settings)
|
||||||
backendBuilder.run()
|
backendBuilder.run()
|
||||||
|
|
||||||
#====================================================================
|
#====================================================================
|
||||||
|
|
||||||
def build (settings):
|
def build (settings, repository):
|
||||||
frontends = []
|
frontends = []
|
||||||
|
|
||||||
|
if repository.areTherePendingChanges():
|
||||||
|
print "\nWARNING: repository has pending changes\n"
|
||||||
|
|
||||||
for frontend in settings['frontends']:
|
for frontend in settings['frontends']:
|
||||||
frontends.append(frontendBuilder.FrontendBuilder(frontend, loadSettings('frontend', frontend)))
|
frontends.append(frontendBuilder.FrontendBuilder(frontend, loadSettings('frontend', frontend), repository.version()))
|
||||||
|
|
||||||
for backend in settings['backends']:
|
for backend in settings['backends']:
|
||||||
assembleBackend(backend, frontends, settings['versions'])
|
assembleBackend(backend, frontends, settings['versions'])
|
||||||
@ -96,7 +99,7 @@ def build (settings):
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
def clean ():
|
def clean ():
|
||||||
print "cleaning up …"
|
# print "cleaning up …"
|
||||||
if os.path.exists(projectTargetDir()):
|
if os.path.exists(projectTargetDir()):
|
||||||
shutil.rmtree(projectTargetDir())
|
shutil.rmtree(projectTargetDir())
|
||||||
|
|
||||||
@ -107,35 +110,42 @@ def usage (message):
|
|||||||
print "ERROR: " + message
|
print "ERROR: " + message
|
||||||
|
|
||||||
print
|
print
|
||||||
print "build.py clean"
|
# print "build clean"
|
||||||
print "build.py clean install"
|
# print "build clean install"
|
||||||
print "build.py install --ALL"
|
print "build install --ALL"
|
||||||
print "build.py install debug --ALL"
|
print "build install debug --ALL"
|
||||||
print "build.py clean install debug --ALL"
|
# print "build clean install debug --ALL"
|
||||||
print "build.ph install, debug --backends php java --frontends beta gamma"
|
print "build install debug --backends php python --frontends beta gamma"
|
||||||
print "build.ph install, debug --backends php java --frontends beta gamma gamma.mobile"
|
print "build install debug development --backends php python --frontends beta gamma gamma.mobile"
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
def allFrontends ():
|
||||||
|
return ['beta', 'gamma', 'mobile']
|
||||||
|
|
||||||
|
def allBackends ():
|
||||||
|
return ['php', 'python']
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
def main ():
|
def main ():
|
||||||
settings = {}
|
settings = {}
|
||||||
parameters = list(itertools.islice(sys.argv, 1, None))
|
parameters = list(itertools.islice(sys.argv, 1, None))
|
||||||
|
|
||||||
shouldClean = len(filter(lambda x: x == 'clean', parameters)) > 0
|
sys.path.append(os.path.join(scriptDir(), 'backends'))
|
||||||
if (shouldClean):
|
currentRepository = repository.repositoryWithPath(projectBaseDir())
|
||||||
clean ()
|
|
||||||
|
|
||||||
parameters = filter(lambda x: x != 'clean', parameters)
|
clean()
|
||||||
versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
|
versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
|
||||||
settings['versions'] = versions; #['debug', 'install']
|
settings['versions'] = versions; #['debug', 'install', 'development']
|
||||||
parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
|
parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
|
||||||
|
|
||||||
if len(parameters) > 0:
|
if len(parameters) > 0:
|
||||||
parameter = parameters.popleft()
|
parameter = parameters.popleft()
|
||||||
if parameter == "--ALL":
|
if parameter == "--ALL":
|
||||||
settings['frontends'] = ['beta', 'gamma', 'mobile']
|
settings['frontends'] = allFrontends()
|
||||||
settings['backends'] = ['php', 'python', 'java']
|
settings['backends'] = allBackends()
|
||||||
else:
|
else:
|
||||||
while parameter != None:
|
while parameter != None:
|
||||||
values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
|
values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
|
||||||
@ -158,8 +168,9 @@ def main ():
|
|||||||
if (not settings.has_key('backends')):
|
if (not settings.has_key('backends')):
|
||||||
usage("missing 'backends'")
|
usage("missing 'backends'")
|
||||||
|
|
||||||
build (settings)
|
build(settings, currentRepository)
|
||||||
|
else:
|
||||||
|
usage("Suggestions on how to call the 'build' script:")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
from backendBuilder import BackendBuilder
|
|
||||||
|
|
||||||
class PythonBuilder(BackendBuilder):
|
|
||||||
|
|
||||||
def name(self):
|
|
||||||
return "Python builder"
|
|
||||||
|
|
||||||
def relativePath(self):
|
|
||||||
return 'python'
|
|
||||||
|
|
||||||
|
|
75
scripts/builder/repository.py
Normal file
75
scripts/builder/repository.py
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def repositoryWithPath (path):
|
||||||
|
try:
|
||||||
|
from dulwich.repo import Repo
|
||||||
|
|
||||||
|
repo = Repo(path)
|
||||||
|
result = GitRepository(repo, path)
|
||||||
|
except:
|
||||||
|
from mercurial import ui, hg
|
||||||
|
|
||||||
|
repo = hg.repository(ui.ui(), path)
|
||||||
|
result = HgRepository(repo, path)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
#===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class Repository(object):
|
||||||
|
|
||||||
|
def __init__ (self, repository, path):
|
||||||
|
self.repository = repository
|
||||||
|
self.path = path
|
||||||
|
|
||||||
|
|
||||||
|
def revision (self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
def areTherePendingChanges (self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
def version (self):
|
||||||
|
result = self.revision()
|
||||||
|
if self.areTherePendingChanges():
|
||||||
|
result = '>>> ' + result + ' <<<'
|
||||||
|
|
||||||
|
# print "VERSION: " + result
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
#===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class GitRepository(Repository):
|
||||||
|
|
||||||
|
def revision (self):
|
||||||
|
return repository.refs['HEAD']
|
||||||
|
|
||||||
|
|
||||||
|
def areTherePendingChanges (self):
|
||||||
|
return repository.is_dirty()
|
||||||
|
|
||||||
|
|
||||||
|
#===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class HgRepository(Repository):
|
||||||
|
# http://mercurial.selenic.com/wiki/MercurialApi
|
||||||
|
|
||||||
|
def revision (self):
|
||||||
|
return 'hg:' + str(self.repository['tip'])
|
||||||
|
|
||||||
|
|
||||||
|
def areTherePendingChanges (self):
|
||||||
|
# TODO: FIXME: repository.status() does not report 'unknown(?)' files. :(
|
||||||
|
return not all(map(lambda fileList: len(fileList) == 0, self.repository.status()))
|
||||||
|
|
||||||
|
|
||||||
|
#===================================================================
|
Loading…
Reference in New Issue
Block a user