Compare commits

...
11 Commits
Author SHA1 Message Date
pvincent 59b7c48a89 tagged as 1.8.0 2021-08-25 22:23:45 +04:00
pvincent d13c85be61 force semver 2021-08-25 22:23:28 +04:00
pvincent 2714f44b44 README 2021-08-25 22:21:59 +04:00
pvincent 04cb4343ad semver 2021-08-25 22:20:29 +04:00
pvincent e94c4eae67 App.log for DEBUG 2021-08-25 22:17:03 +04:00
pvincent 47abd95962 tagged as 1.7.3 2021-08-25 19:23:35 +04:00
pvincent c346584d46 change readme 2021-08-25 19:23:20 +04:00
cagettepei.lxd bbeea934e4 tagged as 1.7.2 2021-08-25 19:10:48 +04:00
cagettepei.lxd 3c8a2507d9 no package-lock.json 2021-08-25 19:10:35 +04:00
cagettepei.lxd 6c0e632ef2 tagged as 1.7.1 2021-08-25 19:06:37 +04:00
cagettepei.lxd f94e005a91 fix Makefile 2021-08-25 19:06:24 +04:00
8 changed files with 644 additions and 6835 deletions
+1 -2
View File
@@ -1,7 +1,7 @@
*.n
*.php
config.xml
/package-lock.json
package-lock.json
www/plugin/*
tmp/*
*node_modules*
@@ -35,4 +35,3 @@ www/css/.sass-cache
www/css/*.css
!www/css/bootstrap.min.css
+1 -1
View File
@@ -1 +1 @@
1.7.0
1.8.0
+1 -3
View File
@@ -26,9 +26,6 @@ install_dev:
#template tools
haxelib run templo
sudo mv temploc2 /usr/bin
#extra plugins
@if [ $(PLUGINS) = 1 ]; then \
fi
#install npm dependencies
npm install
npm run libs:dev
@@ -77,6 +74,7 @@ templates:
@make LANG=fr ctemplates
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 lang
ctemplates:
(cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt)
+3 -1
View File
@@ -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)
* 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 sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server
* mysql -u root <<EOF
@@ -28,6 +28,8 @@ EOF
ServerName cagettepei
DirectoryIndex index.n
DocumentRoot /var/www/cagettepei/www/
</VirtualHost>
```
* sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
-6188
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -47,5 +47,5 @@
"bugs": {
"url": "https://github.com/bablukid/cagette/issues"
},
"version": "1.7.0"
"version": "1.8.0"
}
+108 -116
View File
@@ -1,110 +1,109 @@
import db.User;
import thx.semver.Version;
import Common;
class App extends sugoi.BaseApp {
public static var current : App = null;
public static var t : sugoi.i18n.translator.ITranslator;
class App extends sugoi.BaseApp {
public static var current:App = null;
public static var t:sugoi.i18n.translator.ITranslator;
public static var config = sugoi.BaseApp.config;
public var eventDispatcher :hxevents.Dispatcher<Event>;
public var plugins : Array<sugoi.plugin.IPlugIn>;
public var eventDispatcher:hxevents.Dispatcher<Event>;
public var plugins:Array<sugoi.plugin.IPlugIn>;
/**
* Version management
* @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(MyMacros.getGitShortSHA(), MyMacros.getGitCommitDate());
*/
// 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 function new(){
public function new() {
super();
}
public static function main() {
App.t = sugoi.form.Form.translator = new sugoi.i18n.translator.TMap(getTranslationArray(), "fr");
sugoi.BaseApp.main();
}
/**
* Init plugins and event dispatcher just before launching the app
*/
override public function mainLoop() {
eventDispatcher = new hxevents.Dispatcher<Event>();
plugins = [];
//internal plugins
// internal plugins
plugins.push(new plugin.Tutorial());
//optionnal plugins
// optionnal plugins
#if plugins
plugins.push( new hosted.HostedPlugIn() );
plugins.push( new pro.ProPlugIn() );
plugins.push( new connector.ConnectorPlugIn() );
plugins.push( new pro.LemonwayEC() );
plugins.push( new who.WhoPlugIn() );
plugins.push(new hosted.HostedPlugIn());
plugins.push(new pro.ProPlugIn());
plugins.push(new connector.ConnectorPlugIn());
plugins.push(new pro.LemonwayEC());
plugins.push(new who.WhoPlugIn());
#end
super.mainLoop();
}
public function getCurrentGroup(){
if (session == null) return null;
if (session.data == null ) return null;
public function getCurrentGroup() {
if (session == null)
return null;
if (session.data == null)
return null;
var a = session.data.amapId;
if (a == null) {
return null;
}else {
return db.Amap.manager.get(a,false);
} else {
return db.Amap.manager.get(a, false);
}
}
override function beforeDispatch() {
//send "current page" event
event( Page(this.uri) );
// send "current page" event
event(Page(this.uri));
super.beforeDispatch();
}
public function getPlugin(name:String):sugoi.plugin.IPlugIn {
for (p in plugins) {
if (p.getName() == name) return p;
if (p.getName() == name)
return p;
}
return null;
}
public static function log(t:Dynamic) {
if(App.config.DEBUG) {
neko.Web.logMessage(Std.string(t)); //write in Apache error log
#if weblog
Weblog.log(t); //write en Weblog console (https://lib.haxe.org/p/weblog/)
#end
public static function log(t:Dynamic, ?infos:haxe.PosInfos) {
if (App.config.DEBUG) {
// neko.Web.logMessage(Std.string(t)); // write in Apache error log
neko.Web.logMessage('[${infos.fileName}:${infos.lineNumber} ${infos.className}#${infos.methodName}] ' + Std.string(t));
}
}
public function event(e:Event) {
if(e==null) return null;
if (e == null)
return null;
this.eventDispatcher.dispatch(e);
return e;
}
/**
* Translate DB objects fields in forms
*/
public static function getTranslationArray() {
//var t = sugoi.i18n.Locale.texts;
var out = new Map<String,String>();
//out.set("firstName", t._("First name") );
//out.set("lastName", t._("Last name"));
// var t = sugoi.i18n.Locale.texts;
var out = new Map<String, String>();
// out.set("firstName", t._("First name") );
// out.set("lastName", t._("Last name"));
out.set("firstName2", "Prénom du conjoint");
out.set("lastName2", "Nom du conjoint");
out.set("email2", "e-mail du conjoint");
//out.set("pass", t._("Password") );
//out.set("address1", t._("address") );
//out.set("address2", t._("address") );
// out.set("pass", t._("Password") );
// out.set("address1", t._("address") );
// out.set("address2", t._("address") );
out.set("zipCode", "code postal");
out.set("city", "commune");
out.set("phone", "téléphone");
@@ -123,24 +122,24 @@ class App extends sugoi.BaseApp {
out.set("txtHome", "Texte en page d'accueil pour les adhérents connectés");
out.set("txtDistrib", "Texte à faire figurer sur les listes d'émargement lors des distributions");
out.set("extUrl", "URL du site du groupe.");
out.set("distributor1", "Distributeur 1");
out.set("distributor2", "Distributeur 2");
out.set("distributor3", "Distributeur 3");
out.set("distributor4", "Distributeur 4");
out.set("distributorNum", "Nbre de distributeurs nécessaires (de 0 à 4)");
out.set("startDate", "Date de début");
out.set("endDate", "Date de fin");
out.set("orderStartDate", "Date ouverture des commandes");
out.set("orderEndDate", "Date fermeture des commandes");
out.set("openingHour", "Heure d'ouverture");
out.set("closingHour", "Heure de fermeture");
out.set("date", "Date de distribution");
out.set("active", "actif");
out.set("orderEndDate", "Date fermeture des commandes");
out.set("openingHour", "Heure d'ouverture");
out.set("closingHour", "Heure de fermeture");
out.set("date", "Date de distribution");
out.set("active", "actif");
out.set("contact", "Reponsable");
out.set("vendor", "Producteur");
out.set("text", "Texte");
@@ -170,7 +169,7 @@ class App extends sugoi.BaseApp {
out.set("pname", "Produit");
out.set("organic", "Agriculture biologique");
out.set("hasFloatQt", "Autoriser quantités \"à virgule\"");
out.set("membershipRenewalDate", "Adhésions : Date de renouvellement");
out.set("membershipPrice", "Adhésions : Coût de l'adhésion");
out.set("UsersCanOrder", "Les adhérents peuvent saisir leur commande en ligne");
@@ -193,12 +192,12 @@ class App extends sugoi.BaseApp {
out.set("ref", "Référence");
out.set("linkText", "Intitulé du lien");
out.set("linkUrl", "URL du lien");
out.set("Amap", "AMAP");
out.set("GroupedOrders", "Groupement d'achat");
out.set("ProducerDrive", "Collectif de producteurs");
out.set("FarmShop", "Vente à la ferme");
out.set("regOption", "Inscription de nouveaux adhérents");
out.set("Closed", "Fermé : Le coordinateur ajoute les nouveaux adhérents");
out.set("WaitingList", "Liste d'attente");
@@ -206,102 +205,95 @@ class App extends sugoi.BaseApp {
out.set("Full", "Complet : Le groupe n'accepte plus de nouveaux adhérents");
out.set("percent", "Pourcentage");
out.set("pinned", "Mets en avant les produits");
out.set("CagetteNetwork", "Me lister dans l'annuaire des groupes Cagette.net");
out.set("unitType", "Unité");
out.set("qt", "Quantité");
out.set("Unit", "Pièce");
out.set("Kilogram", "Kilogrammes");
out.set("Gram", "Grammes");
out.set("Litre", "Litres");
out.set("Litre", "Litres");
out.set("htPrice", "Prix H.T");
out.set("amount", "Montant");
out.set("HasPayments", "Gestion des paiements");
out.set("byMember", "Par adhérent");
out.set("byProduct", "Par produit");
out.set("variablePrice", "Variable price based on weight");
return out;
}
public function populateAmapMembers() {
public function populateAmapMembers() {
return user.amap.getMembersFormElementData();
}
public static function getMailer():sugoi.mail.IMailer {
var mailer : sugoi.mail.IMailer = new sugoi.mail.BufferedMailer();
if(App.config.DEBUG){
//Dev env : emails are written to tmp folder
public static function getMailer():sugoi.mail.IMailer {
var mailer:sugoi.mail.IMailer = new sugoi.mail.BufferedMailer();
if (App.config.DEBUG) {
// Dev env : emails are written to tmp folder
mailer = new sugoi.mail.DebugMailer();
}else{
if (sugoi.db.Variable.get("mailer") == null){
} else {
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>");
throw sugoi.ControllerAction.ErrorAction("/",msg);
throw sugoi.ControllerAction.ErrorAction("/", msg);
}
if (sugoi.db.Variable.get("mailer") == "mandrill"){
//Buffered emails with Mandrill
untyped mailer.defineFinalMailer("mandrill");
}else{
//Buffered emails with SMTP
if (sugoi.db.Variable.get("mailer") == "mandrill") {
// Buffered emails with Mandrill
untyped mailer.defineFinalMailer("mandrill");
} else {
// Buffered emails with SMTP
untyped mailer.defineFinalMailer("smtp");
}
}
return mailer;
}
/**
* Send an email
*/
public static function sendMail(m:sugoi.mail.Mail, ?group:db.Amap, ?listId:String, ?sender:db.User){
if (group == null) group = App.current.user == null ? null:App.current.user.getAmap();
current.event(SendEmail(m));
var params = group==null ? null : {remoteId:group.id};
public static function sendMail(m:sugoi.mail.Mail, ?group:db.Amap, ?listId:String, ?sender:db.User) {
if (group == null)
group = App.current.user == null ? null : App.current.user.getAmap();
getMailer().send(m,params,function(o){});
current.event(SendEmail(m));
var params = group == null ? null : {remoteId: group.id};
getMailer().send(m, params, function(o) {});
}
public static function quickMail(to:String, subject:String, html:String,?group:db.Amap){
var e = new sugoi.mail.Mail();
public static function quickMail(to:String, subject:String, html:String, ?group:db.Amap) {
var e = new sugoi.mail.Mail();
e.setSubject(subject);
e.setRecipient(to);
e.setSender(App.config.get("default_email"),"Cagette.net");
var html = App.current.processTemplate("mail/message.mtt", {text:html,group:group});
e.setRecipient(to);
e.setSender(App.config.get("default_email"), "Cagette.net");
var html = App.current.processTemplate("mail/message.mtt", {text: html, group: group});
e.setHtmlBody(html);
App.sendMail(e);
}
/**
* process a template and returns the generated string
* @param tpl
* @param ctx
*/
public function processTemplate(tpl:String, ctx:Dynamic):String {
Reflect.setField(ctx, 'HOST', App.config.HOST);
Reflect.setField(ctx, 'hDate', App.current.view.hDate);
//i18n functions
// i18n functions
ctx._ = App.current.view._;
ctx.__ = App.current.view.__;
var tpl = loadTemplate(tpl);
var html = tpl.execute(ctx);
var html = tpl.execute(ctx);
#if php
if ( html.substr(0, 4) == "null") html = html.substr(4);
if (html.substr(0, 4) == "null")
html = html.substr(4);
#end
return html;
}
}
File diff suppressed because it is too large Load Diff