Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59b7c48a89 | ||
|
|
d13c85be61 | ||
|
|
2714f44b44 | ||
|
|
04cb4343ad | ||
|
|
e94c4eae67 | ||
|
|
47abd95962 | ||
|
|
c346584d46 |
+1
-1
@@ -1 +1 @@
|
|||||||
1.7.2
|
1.8.0
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ templates:
|
|||||||
@make LANG=fr ctemplates
|
@make LANG=fr ctemplates
|
||||||
msgfmt www/lang/texts_fr.po -o www/lang/texts_fr.mo
|
msgfmt www/lang/texts_fr.po -o www/lang/texts_fr.mo
|
||||||
chown www-data:www-data -R www
|
chown www-data:www-data -R www
|
||||||
|
chown www-data:www-data -R lang
|
||||||
|
|
||||||
ctemplates:
|
ctemplates:
|
||||||
(cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt)
|
(cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ j'ai repris sur la base d'un existant pour adapter au marché local réunionnais
|
|||||||
## INSTALL FROM SCRATCH (debian-buster)
|
## INSTALL FROM SCRATCH (debian-buster)
|
||||||
|
|
||||||
* apt install -y curl
|
* apt install -y curl
|
||||||
* curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
* curl -L https://deb.nodesource.com/setup_8.x | bash -
|
||||||
* apt install -y nodejs=8.17.0-1nodesource1
|
* apt install -y nodejs=8.17.0-1nodesource1
|
||||||
* apt install -y sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server
|
* apt install -y sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server
|
||||||
* mysql -u root <<EOF
|
* mysql -u root <<EOF
|
||||||
@@ -28,6 +28,8 @@ EOF
|
|||||||
ServerName cagettepei
|
ServerName cagettepei
|
||||||
DirectoryIndex index.n
|
DirectoryIndex index.n
|
||||||
DocumentRoot /var/www/cagettepei/www/
|
DocumentRoot /var/www/cagettepei/www/
|
||||||
|
|
||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
* sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
* sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||||
|
|||||||
+1
-1
@@ -47,5 +47,5 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/bablukid/cagette/issues"
|
"url": "https://github.com/bablukid/cagette/issues"
|
||||||
},
|
},
|
||||||
"version": "1.7.2"
|
"version": "1.8.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+59
-67
@@ -3,28 +3,26 @@ import thx.semver.Version;
|
|||||||
import Common;
|
import Common;
|
||||||
|
|
||||||
class App extends sugoi.BaseApp {
|
class App extends sugoi.BaseApp {
|
||||||
|
public static var current:App = null;
|
||||||
public static var current : App = null;
|
public static var t:sugoi.i18n.translator.ITranslator;
|
||||||
public static var t : sugoi.i18n.translator.ITranslator;
|
|
||||||
public static var config = sugoi.BaseApp.config;
|
public static var config = sugoi.BaseApp.config;
|
||||||
|
|
||||||
public var eventDispatcher :hxevents.Dispatcher<Event>;
|
public var eventDispatcher:hxevents.Dispatcher<Event>;
|
||||||
public var plugins : Array<sugoi.plugin.IPlugIn>;
|
public var plugins:Array<sugoi.plugin.IPlugIn>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version management
|
* Version management
|
||||||
* @doc https://github.com/fponticelli/thx.semver
|
* @doc https://github.com/fponticelli/thx.semver
|
||||||
*/
|
*/
|
||||||
//public static var VERSION = ([0,9,2] : Version).withPre("july");
|
// 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 = ([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 function new(){
|
public function new() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function main() {
|
public static function main() {
|
||||||
|
|
||||||
App.t = sugoi.form.Form.translator = new sugoi.i18n.translator.TMap(getTranslationArray(), "fr");
|
App.t = sugoi.form.Form.translator = new sugoi.i18n.translator.TMap(getTranslationArray(), "fr");
|
||||||
sugoi.BaseApp.main();
|
sugoi.BaseApp.main();
|
||||||
}
|
}
|
||||||
@@ -35,58 +33,59 @@ class App extends sugoi.BaseApp {
|
|||||||
override public function mainLoop() {
|
override public function mainLoop() {
|
||||||
eventDispatcher = new hxevents.Dispatcher<Event>();
|
eventDispatcher = new hxevents.Dispatcher<Event>();
|
||||||
plugins = [];
|
plugins = [];
|
||||||
//internal plugins
|
// internal plugins
|
||||||
plugins.push(new plugin.Tutorial());
|
plugins.push(new plugin.Tutorial());
|
||||||
|
|
||||||
//optionnal plugins
|
// optionnal plugins
|
||||||
#if plugins
|
#if plugins
|
||||||
plugins.push( new hosted.HostedPlugIn() );
|
plugins.push(new hosted.HostedPlugIn());
|
||||||
plugins.push( new pro.ProPlugIn() );
|
plugins.push(new pro.ProPlugIn());
|
||||||
plugins.push( new connector.ConnectorPlugIn() );
|
plugins.push(new connector.ConnectorPlugIn());
|
||||||
plugins.push( new pro.LemonwayEC() );
|
plugins.push(new pro.LemonwayEC());
|
||||||
plugins.push( new who.WhoPlugIn() );
|
plugins.push(new who.WhoPlugIn());
|
||||||
#end
|
#end
|
||||||
|
|
||||||
super.mainLoop();
|
super.mainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCurrentGroup(){
|
public function getCurrentGroup() {
|
||||||
if (session == null) return null;
|
if (session == null)
|
||||||
if (session.data == null ) return null;
|
return null;
|
||||||
|
if (session.data == null)
|
||||||
|
return null;
|
||||||
var a = session.data.amapId;
|
var a = session.data.amapId;
|
||||||
if (a == null) {
|
if (a == null) {
|
||||||
return null;
|
return null;
|
||||||
}else {
|
} else {
|
||||||
return db.Amap.manager.get(a,false);
|
return db.Amap.manager.get(a, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override function beforeDispatch() {
|
override function beforeDispatch() {
|
||||||
|
// send "current page" event
|
||||||
//send "current page" event
|
event(Page(this.uri));
|
||||||
event( Page(this.uri) );
|
|
||||||
|
|
||||||
super.beforeDispatch();
|
super.beforeDispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPlugin(name:String):sugoi.plugin.IPlugIn {
|
public function getPlugin(name:String):sugoi.plugin.IPlugIn {
|
||||||
for (p in plugins) {
|
for (p in plugins) {
|
||||||
if (p.getName() == name) return p;
|
if (p.getName() == name)
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function log(t:Dynamic) {
|
public static function log(t:Dynamic, ?infos:haxe.PosInfos) {
|
||||||
if(App.config.DEBUG) {
|
if (App.config.DEBUG) {
|
||||||
neko.Web.logMessage(Std.string(t)); //write in Apache error log
|
// neko.Web.logMessage(Std.string(t)); // write in Apache error log
|
||||||
#if weblog
|
neko.Web.logMessage('[${infos.fileName}:${infos.lineNumber} ${infos.className}#${infos.methodName}] ' + Std.string(t));
|
||||||
Weblog.log(t); //write en Weblog console (https://lib.haxe.org/p/weblog/)
|
|
||||||
#end
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function event(e:Event) {
|
public function event(e:Event) {
|
||||||
if(e==null) return null;
|
if (e == null)
|
||||||
|
return null;
|
||||||
this.eventDispatcher.dispatch(e);
|
this.eventDispatcher.dispatch(e);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -95,16 +94,16 @@ class App extends sugoi.BaseApp {
|
|||||||
* Translate DB objects fields in forms
|
* Translate DB objects fields in forms
|
||||||
*/
|
*/
|
||||||
public static function getTranslationArray() {
|
public static function getTranslationArray() {
|
||||||
//var t = sugoi.i18n.Locale.texts;
|
// var t = sugoi.i18n.Locale.texts;
|
||||||
var out = new Map<String,String>();
|
var out = new Map<String, String>();
|
||||||
//out.set("firstName", t._("First name") );
|
// out.set("firstName", t._("First name") );
|
||||||
//out.set("lastName", t._("Last name"));
|
// out.set("lastName", t._("Last name"));
|
||||||
out.set("firstName2", "Prénom du conjoint");
|
out.set("firstName2", "Prénom du conjoint");
|
||||||
out.set("lastName2", "Nom du conjoint");
|
out.set("lastName2", "Nom du conjoint");
|
||||||
out.set("email2", "e-mail du conjoint");
|
out.set("email2", "e-mail du conjoint");
|
||||||
//out.set("pass", t._("Password") );
|
// out.set("pass", t._("Password") );
|
||||||
//out.set("address1", t._("address") );
|
// out.set("address1", t._("address") );
|
||||||
//out.set("address2", t._("address") );
|
// out.set("address2", t._("address") );
|
||||||
out.set("zipCode", "code postal");
|
out.set("zipCode", "code postal");
|
||||||
out.set("city", "commune");
|
out.set("city", "commune");
|
||||||
out.set("phone", "téléphone");
|
out.set("phone", "téléphone");
|
||||||
@@ -231,25 +230,22 @@ class App extends sugoi.BaseApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getMailer():sugoi.mail.IMailer {
|
public static function getMailer():sugoi.mail.IMailer {
|
||||||
|
var mailer:sugoi.mail.IMailer = new sugoi.mail.BufferedMailer();
|
||||||
|
|
||||||
var mailer : sugoi.mail.IMailer = new sugoi.mail.BufferedMailer();
|
if (App.config.DEBUG) {
|
||||||
|
// Dev env : emails are written to tmp folder
|
||||||
if(App.config.DEBUG){
|
|
||||||
|
|
||||||
//Dev env : emails are written to tmp folder
|
|
||||||
mailer = new sugoi.mail.DebugMailer();
|
mailer = new sugoi.mail.DebugMailer();
|
||||||
}else{
|
} else {
|
||||||
|
if (sugoi.db.Variable.get("mailer") == null) {
|
||||||
if (sugoi.db.Variable.get("mailer") == null){
|
|
||||||
var msg = sugoi.i18n.Locale.texts._("Please configure the email settings in a <href='/admin/emails'>this section</a>");
|
var msg = sugoi.i18n.Locale.texts._("Please configure the email settings in a <href='/admin/emails'>this section</a>");
|
||||||
throw sugoi.ControllerAction.ErrorAction("/",msg);
|
throw sugoi.ControllerAction.ErrorAction("/", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sugoi.db.Variable.get("mailer") == "mandrill"){
|
if (sugoi.db.Variable.get("mailer") == "mandrill") {
|
||||||
//Buffered emails with Mandrill
|
// Buffered emails with Mandrill
|
||||||
untyped mailer.defineFinalMailer("mandrill");
|
untyped mailer.defineFinalMailer("mandrill");
|
||||||
}else{
|
} else {
|
||||||
//Buffered emails with SMTP
|
// Buffered emails with SMTP
|
||||||
untyped mailer.defineFinalMailer("smtp");
|
untyped mailer.defineFinalMailer("smtp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,24 +255,23 @@ class App extends sugoi.BaseApp {
|
|||||||
/**
|
/**
|
||||||
* Send an email
|
* Send an email
|
||||||
*/
|
*/
|
||||||
public static function sendMail(m:sugoi.mail.Mail, ?group:db.Amap, ?listId:String, ?sender:db.User){
|
public static function sendMail(m:sugoi.mail.Mail, ?group:db.Amap, ?listId:String, ?sender:db.User) {
|
||||||
|
if (group == null)
|
||||||
if (group == null) group = App.current.user == null ? null:App.current.user.getAmap();
|
group = App.current.user == null ? null : App.current.user.getAmap();
|
||||||
|
|
||||||
current.event(SendEmail(m));
|
current.event(SendEmail(m));
|
||||||
|
|
||||||
var params = group==null ? null : {remoteId:group.id};
|
var params = group == null ? null : {remoteId: group.id};
|
||||||
|
|
||||||
getMailer().send(m,params,function(o){});
|
|
||||||
|
|
||||||
|
getMailer().send(m, params, function(o) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function quickMail(to:String, subject:String, html:String,?group:db.Amap){
|
public static function quickMail(to:String, subject:String, html:String, ?group:db.Amap) {
|
||||||
var e = new sugoi.mail.Mail();
|
var e = new sugoi.mail.Mail();
|
||||||
e.setSubject(subject);
|
e.setSubject(subject);
|
||||||
e.setRecipient(to);
|
e.setRecipient(to);
|
||||||
e.setSender(App.config.get("default_email"),"Cagette.net");
|
e.setSender(App.config.get("default_email"), "Cagette.net");
|
||||||
var html = App.current.processTemplate("mail/message.mtt", {text:html,group:group});
|
var html = App.current.processTemplate("mail/message.mtt", {text: html, group: group});
|
||||||
e.setHtmlBody(html);
|
e.setHtmlBody(html);
|
||||||
App.sendMail(e);
|
App.sendMail(e);
|
||||||
}
|
}
|
||||||
@@ -287,21 +282,18 @@ class App extends sugoi.BaseApp {
|
|||||||
* @param ctx
|
* @param ctx
|
||||||
*/
|
*/
|
||||||
public function processTemplate(tpl:String, ctx:Dynamic):String {
|
public function processTemplate(tpl:String, ctx:Dynamic):String {
|
||||||
|
|
||||||
Reflect.setField(ctx, 'HOST', App.config.HOST);
|
Reflect.setField(ctx, 'HOST', App.config.HOST);
|
||||||
Reflect.setField(ctx, 'hDate', App.current.view.hDate);
|
Reflect.setField(ctx, 'hDate', App.current.view.hDate);
|
||||||
//i18n functions
|
// i18n functions
|
||||||
ctx._ = App.current.view._;
|
ctx._ = App.current.view._;
|
||||||
ctx.__ = App.current.view.__;
|
ctx.__ = App.current.view.__;
|
||||||
|
|
||||||
var tpl = loadTemplate(tpl);
|
var tpl = loadTemplate(tpl);
|
||||||
var html = tpl.execute(ctx);
|
var html = tpl.execute(ctx);
|
||||||
#if php
|
#if php
|
||||||
if ( html.substr(0, 4) == "null") html = html.substr(4);
|
if (html.substr(0, 4) == "null")
|
||||||
|
html = html.substr(4);
|
||||||
#end
|
#end
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+374
-368
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user