Compare commits

...
2 Commits
Author SHA1 Message Date
pvincent 278f69e7d9 tagged as 1.10.2 2021-08-29 21:31:33 +04:00
pvincent 8699728593 version cagettepei 2021-08-29 21:31:16 +04:00
7 changed files with 199 additions and 188 deletions
+1 -1
View File
@@ -1 +1 @@
1.10.1
1.10.2
+1 -1
View File
@@ -199,7 +199,7 @@
<!--
::raw _("Cagette.net is made by <a href='https://www.alilo.fr' target='_blank'><img src='/img/alilo-trans-black.png' /></a>")::<br/>
-->
<span>version ::VERSION::</span>
<span>version cagettepei-<a href="https://git.artcode.re/cagetters/cagettepei/src/tag/::VERSION::">::VERSION::</a></span>
</div>
<div class="row">
+2 -2
View File
@@ -1,5 +1,5 @@
{
"name": "CagettePei",
"name": "cagette-pei",
"description": "le logiciel libre du circuit court",
"license": "AGPL-3.0",
"dependencies": {
@@ -47,5 +47,5 @@
"bugs": {
"url": "https://github.com/bablukid/cagette/issues"
},
"version": "1.10.1"
"version": "1.10.2"
}
+2 -1
View File
@@ -16,7 +16,8 @@ class App extends sugoi.BaseApp {
*/
// public static var VERSION = ([0,9,2] : Version).withPre("july");
// public static var VERSION = ([0,9,2] : Version).withPre(MyMacros.getGitShortSHA(), MyMacros.getGitCommitDate());
public static var VERSION = "cagette-péi " + MyMacros.getGitCommitDate();
// public static var VERSION = "cagette-péi " + MyMacros.getGitCommitDate();
public static var VERSION = "cagette-pei"; // empty yet, cf.BaseApp.loadConfig
public function new() {
super();
+45 -35
View File
@@ -1,9 +1,9 @@
package sugoi;
import sugoi.i18n.TemplateTranslator;
import sugoi.Web;
class BaseApp {
public var cnx:sys.db.Connection;
public var template:templo.Loader;
public var maintain:Bool;
@@ -16,10 +16,10 @@ class BaseApp {
public var uri:String;
public static var config:Config;
// public static var classPathes = sugoi.tools.Macros.getClassPathes();
public function new() {
if (config == null) {
loadConfig();
}
@@ -28,24 +28,33 @@ class BaseApp {
cookieDomain = "." + App.config.HOST;
#if plugins
if( false ) sugoi.plugin.PlugIn.copyTpl();
if (false)
sugoi.plugin.PlugIn.copyTpl();
#end
// This macro generates translated templates for each langage
#if i18n_generation
if( false ) TemplateTranslator.parse("lang/master");
if (false)
TemplateTranslator.parse("lang/master");
#end
}
public function loadConfig() {
App.config = BaseApp.config = new sugoi.Config();
var PATH = Web.getCwd() + "../";
var json = haxe.Json.parse(sys.io.File.getContent(PATH + "package.json"));
App.VERSION = json.version;
App.log('configuration has been reloaded, VERSION=${App.VERSION}');
}
public function loadTemplate(t:String) {
templo.Loader.OPTIMIZED = App.config.DEBUG == false;
templo.Loader.BASE_DIR = App.config.TPL;
templo.Loader.TMP_DIR = App.config.TPL_TMP;
if ( t == null ) return null;
if (t == null)
return null;
#if neko
return new templo.Loader(t, App.config.getBool("cachetpl"));
#else
@@ -58,8 +67,8 @@ class BaseApp {
}
public function initLang(lang:String) {
if (lang == null || lang == "") lang = config.LANG;
if (lang == null || lang == "")
lang = config.LANG;
// Define template path
var path;
@@ -83,8 +92,8 @@ class BaseApp {
}
function saveAndClose() {
if( cnx == null ) return;
if (cnx == null)
return;
if (session.sid != null)
session.update();
@@ -97,10 +106,12 @@ class BaseApp {
function executeTemplate(?save) {
view.init();
var result = template.execute(view);
if ( save ) saveAndClose();
if (save)
saveAndClose();
#if php
// strange bug with templo in PHP
if (result.substr(0, 4) == "null") result = result.substr(4);
if (result.substr(0, 4) == "null")
result = result.substr(4);
#end
Sys.print(result);
}
@@ -137,14 +148,13 @@ class BaseApp {
return App.config.LANG;
}
/**
* Setup current app language
*/
function setupLang() {
// this app is monolingual and doesn't manage i18n
if (App.config.LANG == "master") return;
if (App.config.LANG == "master")
return;
// lang is taken from user object or from HTTP headers
if (session.lang == null || !Lambda.has(App.config.LANGS, session.lang)) {
@@ -155,7 +165,6 @@ class BaseApp {
var lang = params.get("lang");
if (lang != null && Lambda.has(App.config.LANGS, lang)) {
session.lang = lang;
}
// init lang
@@ -170,7 +179,8 @@ class BaseApp {
}
public function rollback() {
if( cnx != null ) cnx.rollback();
if (cnx != null)
cnx.rollback();
sys.db.Manager.cleanup();
if (user != null && session != null)
user = session.user;
@@ -189,8 +199,10 @@ class BaseApp {
// Get session
var sids = [];
var cookieSid = Web.getCookies().get(cookieName);
if( params.exists("sid") ) sids.push(params.get("sid"));
if( cookieSid != null ) sids.push(cookieSid);
if (params.exists("sid"))
sids.push(params.get("sid"));
if (cookieSid != null)
sids.push(cookieSid);
session = sugoi.db.Session.init(sids);
// Check for maintenance
@@ -200,7 +212,6 @@ class BaseApp {
// setup langage
setupLang();
if (maintain && ((user != null && user.isAdmin())))
maintain = false;
@@ -214,9 +225,9 @@ class BaseApp {
// dispatching
try {
uri = Web.getURI();
if ( StringTools.endsWith(uri, "/index.n") ) uri = uri.substr(0, -8);
if (StringTools.endsWith(uri, "/index.n"))
uri = uri.substr(0, -8);
// "before dispatch" callback
beforeDispatch();
@@ -224,9 +235,7 @@ class BaseApp {
var d = new haxe.web.Dispatch(uri, params);
d.onMeta = onMeta;
d.dispatch(new controller.Main());
} catch (e:haxe.web.Dispatch.DispatchError) {
// dispatch / routing error
if (App.config.DEBUG) {
#if neko
@@ -238,9 +247,7 @@ class BaseApp {
cnx.rollback();
Web.redirect("/");
return;
} catch (e:sugoi.ControllerAction) {
switch (e) {
case RedirectAction(url):
Web.redirect(url);
@@ -251,8 +258,12 @@ class BaseApp {
url = Web.getURI();
}
Web.redirect(url);
var error = switch(e) { case ErrorAction(_): true; default: false; };
if( error ) rollback();
var error = switch (e) {
case ErrorAction(_): true;
default: false;
};
if (error)
rollback();
if (error) {
session.addMessage(text, true);
} else {
@@ -274,9 +285,7 @@ class BaseApp {
* Override this function if you want
* to insert some actions
*/
public function beforeDispatch() {
}
public function beforeDispatch() {}
public function logError(e:Dynamic, ?stack:String) {
var stack = if (stack != null) stack else haxe.CallStack.toString(haxe.CallStack.exceptionStack());
@@ -316,7 +325,6 @@ class BaseApp {
setTemplate("error.mtt");
executeTemplate(false);
} catch (e:Dynamic) {
Sys.print("<pre>");
Sys.println("Error : " + try Std.string(e) catch (e:Dynamic) "???");
@@ -380,9 +388,11 @@ class BaseApp {
}
function run() {
// Will close the connection
sys.db.Transaction.main(cnx, cloneApp, function(e) { var b : BaseApp = App.current; b.errorHandler(e); });
sys.db.Transaction.main(cnx, cloneApp, function(e) {
var b:BaseApp = App.current;
b.errorHandler(e);
});
App.current = null;
}
@@ -396,13 +406,13 @@ class BaseApp {
}
static function main() {
/**
* this macro will parse the code and generate the allTexts.pot file
* which will be used as a template for translation files (*.po and *.mo)
*/
#if i18n_parsing
if( false ) sugoi.i18n.GetText.parse(["src", "lang/master","js","common"], "www/lang/allTexts.pot");
if (false)
sugoi.i18n.GetText.parse(["src", "lang/master", "js", "common"], "www/lang/allTexts.pot");
#end
App.current = new App();
+2 -2
View File
@@ -32,8 +32,8 @@ class Mail implements IMail {
public function setSender(email, ?name, ?userId) {
if (!isValid(email))
throw "invalid sender email : \"" + email + "\"";
sender = {name: name, email: email, userId: userId};
var finalName = (name != null) ? thx.text.Diactrics.clean(name) : null;
sender = {name: finalName, email: email, userId: userId};
return this;
}
+3 -3
View File
@@ -1538,7 +1538,7 @@ msgid ""
"Group and user 'admin' created. Your email is 'admin@cagette.net' and your "
"password is 'admin'"
msgstr ""
"Groupe et utilisateur 'admin' créé. Votre email est 'admin@cagette.net' et "
"Groupe et utilisateur 'admin' créé. Votre email est 'admin@cagettepei.re' et "
"votre mot de passe est 'admin'"
#: src/controller/Install.hx:4677
@@ -4551,7 +4551,7 @@ msgstr "Extrait non exhaustif des produits proposés :"
#: lang/master/tpl/group/view.mtt:5027
msgid "http://www.cagette.net"
msgstr "http://www.cagette.net"
msgstr "https://git.artcode.re/cagetters/cagettepei"
#: lang/master/tpl/group/view.mtt:5060
msgid "Cagette.net, the free software of food direct-selling"
@@ -4618,7 +4618,7 @@ msgid ""
"Cagette.net is made by <a href='https://www.alilo.fr' target='_blank'><img "
"src='/img/alilo-trans-black.png' /></a>"
msgstr ""
"CagettePéi est une fourche du logiciel Cagette.net réalisé par <a href='https://www.alilo.fr' "
"CagettePéi est un logiciel libre, fourche du logiciel Cagette "
"target='_blank'><img src='/img/alilo-trans-black.png' /></a>"
#: lang/master/tpl/validate/user.mtt:2124