Patch level : 12.0 642

Files correlati     : sy
Commento            : Rifatta gestione DNINST, adesso al posto dell'FTP utilizza file explorer
This commit is contained in:
Mattia Tollari 2018-11-14 11:49:09 +01:00
parent ebd6dcdd1d
commit f40dc8cb0e
3 changed files with 70 additions and 22 deletions

View File

@ -14,6 +14,7 @@
#include <xml.h> #include <xml.h>
#include "ba2800a.h" #include "ba2800a.h"
#include "../ve/veconf.h"
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Utilities // Utilities
@ -182,9 +183,21 @@ bool Tdnist_full::save(int version) const
if (done) if (done)
{ {
int ass_year = 2151; int ass_year = 0;
if (version < 12) switch (version)
ass_year = version < 11 ? 2101 : 2121; {
case 10:
ass_year = 2101;
break;
case 11:
ass_year = 2121;
break;
case 12:
default:
ass_year = 2151;
break;
}
ofstream out(DNINST_TXT); ofstream out(DNINST_TXT);
out << ass_year << endl; out << ass_year << endl;
FOR_EACH_ARRAY_ITEM(_chiavi, key, obj) FOR_EACH_ARRAY_ITEM(_chiavi, key, obj)
@ -200,8 +213,9 @@ bool Tdnist_full::save(int version) const
{ {
done = dninst.encode(DNINST_TXT); done = dninst.encode(DNINST_TXT);
#ifdef DBG #ifdef DBG
if (version == 12) TString dninst_encoded = "../src/setup/dninst_";
fcopy(DNINST_TXT, "../src/setup/dninst.txt"); dninst_encoded << version << ".txt";
fcopy(DNINST_TXT, dninst_encoded);
#endif #endif
} }
@ -278,6 +292,7 @@ void Tdninst_mask::overnight_batch()
{ {
log(0, TR("Inizio procedura aggiornamento DNINST")); log(0, TR("Inizio procedura aggiornamento DNINST"));
set(F_FLD_ON, "X");
set(F_ZIP_ON, "X"); set(F_ZIP_ON, "X");
set(F_DSN_ON, "X"); set(F_DSN_ON, "X");
set(F_XML_ON, ""); set(F_XML_ON, "");
@ -346,7 +361,8 @@ int Tdninst_mask::dongle_compare(const TSortable& o1, const TSortable& o2, void*
const TString& Tdninst_mask::remote_dninst(int version) const const TString& Tdninst_mask::remote_dninst(int version) const
{ {
if (!get_bool(F_ZIP_ON) || field(F_ZIP_WWW).empty())
if (!get_bool(F_FLD_ON) && (!get_bool(F_ZIP_ON) || field(F_ZIP_WWW).empty()))
return EMPTY_STRING; return EMPTY_STRING;
if (version < 10) if (version < 10)
@ -356,13 +372,20 @@ const TString& Tdninst_mask::remote_dninst(int version) const
} }
TString& path = get_tmp_string(); TString& path = get_tmp_string();
path << "ftp://" << get(F_ZIP_USR) if (get_bool(F_FLD_ON))
<< ':' << get(F_ZIP_PWD) {
<< '@' << get(F_ZIP_WWW) path << "//SIRIOUPDATE/ftp/guastalla/release/v_" << version
<< '/' << get(F_ZIP_USR) << ".0/program/" << DNINST_ZIP;
<< "/release/v_" << version }
<< ".0/program/" << DNINST_ZIP; else
{
path << "ftp://" << get(F_ZIP_USR)
<< ':' << get(F_ZIP_PWD)
<< '@' << get(F_ZIP_WWW)
<< '/' << get(F_ZIP_USR)
<< "/release/v_" << version
<< ".0/program/" << DNINST_ZIP;
}
return path; return path;
} }
@ -856,13 +879,31 @@ void Tdninst_mask::save_sheet()
main_app().get_version_info(y, v, t, p); main_app().get_version_info(y, v, t, p);
const int curr = v; const int curr = v;
for (int prev = 10; prev <= curr; prev++) if (_dninst.save(prev)) for (int prev = 10; prev <= curr; prev++)
{ {
fill_sheet(); if (_dninst.save(prev))
const TFilename ftp = remote_dninst(prev); {
if (ftp != DNINST_ZIP && ftp.starts_with("ftp://")) fill_sheet();
if (!is_running() || yesno_box(FR("Copiare il DNINST locale in %s?"), (const char*)ftp)) const TFilename remote_path = remote_dninst(prev);
send_remote_dninst(ftp); if (remote_path != DNINST_ZIP)
{
bool ok = false;
// Se il percorso è ftp uso il classico metodo
if (remote_path.starts_with("ftp://"))
{
if (!is_running() || yesno_box(FR("Copiare il DNINST locale in %s?"), static_cast<const char*>(remote_path)))
ok = send_remote_dninst(remote_path);
}
// Altrimenti copio
else
{
ok = yesno_box("Copiare il DNINST locale su SIRIOUPDATE?") && fcopy(DNINST_ZIP, remote_path);
}
// Stampo il messaggio
ok ? message_box("DNINST copiato correttamente!") : error_box(FR("Errore durante la copia per la versione %d", prev));
}
}
} }
fcopy(DNINST_BAK, DNINST_ZIP); fcopy(DNINST_BAK, DNINST_ZIP);
@ -948,9 +989,9 @@ bool Tdninst_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
if (e == fe_button) if (e == fe_button)
save_sheet(); save_sheet();
break; break;
case F_ZIP_ON: case F_FLD_ON:
if (e == fe_init && o.get().empty()) if (e == fe_init && o.get().empty())
set(F_ZIP_ON, "X", 0x1); set(F_FLD_ON, "X");
break; break;
case F_ZIP_WWW: case F_ZIP_WWW:
if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty()) if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty())

View File

@ -13,6 +13,8 @@
#define F_XML_USR 223 #define F_XML_USR 223
#define F_XML_PWD 224 #define F_XML_PWD 224
#define F_FLD_ON 225
#define F_SORT 198 #define F_SORT 198
#define F_DNSHEET 199 #define F_DNSHEET 199

View File

@ -116,9 +116,14 @@ BEGIN
GROUP 3 GROUP 3
END END
BOOLEAN F_FLD_ON
BEGIN
PROMPT 1 3 "Explorer"
END
LIST F_SORT 1 16 LIST F_SORT 1 16
BEGIN BEGIN
PROMPT 1 3 "Ordinamento " PROMPT 46 3 "Ordinamento "
ITEM "0|Chiave" ITEM "0|Chiave"
ITEM "1|Rivenditore" ITEM "1|Rivenditore"
ITEM "2|Cliente" ITEM "2|Cliente"