Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :modifiche necessarie alla 10.0 per integrarsi con il nuovo setup


git-svn-id: svn://10.65.10.50/trunk@15916 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-12-19 11:41:00 +00:00
parent 9f78f19950
commit 75e4c8fde0
3 changed files with 233 additions and 163 deletions

View File

@ -107,7 +107,7 @@ bool update_dninst(bool force)
//legge dal diskpath di install.ini la directory da cui aggiornarsi;se il dninst.zip di tale.. //legge dal diskpath di install.ini la directory da cui aggiornarsi;se il dninst.zip di tale..
//..directory e' piu' nuovo di quello in locale -> lo copia in locale //..directory e' piu' nuovo di quello in locale -> lo copia in locale
const TFilename local_name = "dninst.zip"; const TFilename local_name = "setup/dninst.zip";
TConfig ini("install.ini", "Main"); TConfig ini("install.ini", "Main");
TFilename remote_name = ini.get("DiskPath"); TFilename remote_name = ini.get("DiskPath");
remote_name.add(local_name); remote_name.add(local_name);
@ -124,7 +124,10 @@ bool update_dninst(bool force)
} }
} }
if (force) if (force)
{
make_dir(local_name.path());
fcopy(remote_name, local_name); fcopy(remote_name, local_name);
}
} }
return true; return true;
} }
@ -139,7 +142,7 @@ bool update_assistance_year()
update_dninst(true); update_dninst(true);
const TFilename dninst = "dninst.zip"; const TFilename dninst = "setup/dninst.zip";
if (dninst.exist()) if (dninst.exist())
{ {
char dninst_key[8] = ""; char dninst_key[8] = "";
@ -165,19 +168,18 @@ bool update_assistance_year()
dongle().set_year_assist(ass_year); dongle().set_year_assist(ass_year);
if (dongle().burn()) if (dongle().burn())
{ {
message_box(FR("Il contratto %d è stato attivato automaticamente"));
return true; return true;
} }
else else
{ {
show_error(FR("Errore di scrittura sulla chiave di protezione")); show_error(FR("Errore di scrittura sulla chiave di protezione"));
return false; return false;
} } //if(dongle().burn...
} } //if(sn==serno...
} } //while(!keys.eof()...
show_error(TR("Il numero di serie di questa postazione non è presente sul database")); show_error(TR("Il numero di serie di questa postazione non è presente sul database"));
} }
else else //if(ass_year>dongle...
show_error(TR("L'anno di assistenza sul database e' inferiore a quello registrato sulla chiave di protezione")); show_error(TR("L'anno di assistenza sul database e' inferiore a quello registrato sulla chiave di protezione"));
} }
else else

View File

@ -27,11 +27,15 @@
#define C_ISPATCH 9 #define C_ISPATCH 9
#define C_BASEPATCH 10 #define C_BASEPATCH 10
#ifdef _DEMO_
const char* const http_default_path = "/aga/demo/zip/"; ///////////////////////////////////////////////////////
#else // Metodi di utility
const char* const http_default_path = "/aga/program/zip/"; ///////////////////////////////////////////////////////
#endif HIDDEN const char* http_default_path()
{
//da compilare in base al producer!
return "www.aga.it/agarel100/";
}
HIDDEN int compare_version(const char* v1, int p1, const char* v2, int p2) HIDDEN int compare_version(const char* v1, int p1, const char* v2, int p2)
{ {
@ -60,6 +64,21 @@ HIDDEN word version2year(const char* v)
return atoi(ver); return atoi(ver);
} }
static int compare_modules(const TObject** o1, const TObject** o2)
{
TToken_string& ts1 = *(TToken_string*)(*o1);
TToken_string& ts2 = *(TToken_string*)(*o2);
int res = 0;
for (int i = 2; i < 5 && res == 0; i++)
{
TString16 s1 = ts1.get(i);
const char* s2 = ts2.get(i);
res = s1.compare(s2);
}
return res;
}
bool is_internet_path(const TString& addr) bool is_internet_path(const TString& addr)
{ {
if (addr.compare("www.", 4, true) == 0) if (addr.compare("www.", 4, true) == 0)
@ -84,8 +103,7 @@ class TInstaller_mask : public TArray_sheet
static TInstaller_mask* _curr_mask; static TInstaller_mask* _curr_mask;
int _station_type; //intero che definisce il tipo di installazione (1=std,2=server,3=client) int _station_type; //intero che definisce il tipo di installazione (1=std,2=server,3=client)
bool _installed; // Flag per verificare se almeno un modulo e' stato installato bool _installed; // Flag per verificare se almeno un modulo e' stato installato
bool _sys_installed; //Flag per controllare l'installazione del modulo di sistema SY bool _setup_run; //Flag che indica se e' stato lanciato il programma setup.exe
bool _modules_pending; //Flag per controllare se ci sono altri moduli da installare oltre a sy
enum { NONE=0, NEW_MENU=1, enum { NONE=0, NEW_MENU=1,
NEW_MENUPRG=2, NEW_INSTALLER=4, NEW_DLL=8, NEW_SYS=14, NEW_MENUPRG=2, NEW_INSTALLER=4, NEW_DLL=8, NEW_SYS=14,
@ -94,7 +112,6 @@ class TInstaller_mask : public TArray_sheet
protected: // TSheet protected: // TSheet
virtual bool on_key(KEY key); virtual bool on_key(KEY key);
static bool quit_handler(TMask_field& f, KEY k);
static bool tutti_handler(TMask_field& f, KEY k); static bool tutti_handler(TMask_field& f, KEY k);
int get_module_number(const TString& module) const; int get_module_number(const TString& module) const;
bool has_module(int modnumber) const; bool has_module(int modnumber) const;
@ -102,16 +119,17 @@ protected: // TSheet
void create_dirs(const char* path) const; void create_dirs(const char* path) const;
bool copy_tree(const char* src_study, const char* dst_study) const; bool copy_tree(const char* src_study, const char* dst_study) const;
int test_type() const; int test_station_type() const;
protected: protected:
static bool path_handler(TMask_field& fld, KEY key); static bool path_handler(TMask_field& fld, KEY key);
static bool web_handler(TMask_field& fld, KEY key);
static bool sheet_notify(TSheet_field& s, int r, KEY k); static bool sheet_notify(TSheet_field& s, int r, KEY k);
static bool install_handler(TMask_field& fld, KEY key); static bool install_handler(TMask_field& fld, KEY key);
static bool update_handler(TMask_field& f, KEY k); static bool update_handler(TMask_field& f, KEY k);
bool add_module(TConfig& ini, const TString& module, bool patch, int pos=-1); bool add_module(TConfig& ini, const TString& module, bool patch, int pos=-1);
bool add_header(TConfig& ini, const TString& module, bool patch); bool add_header(TConfig& ini, const TString& module);
int precheck_modules(bool only_newer=true); int precheck_modules(bool only_newer=true);
void update_version(); void update_version();
@ -127,13 +145,12 @@ protected:
bool do_process(TToken_string& commands) const; bool do_process(TToken_string& commands) const;
bool pre_process(TInstall_ini& ini, const char* module) const; bool pre_process(TInstall_ini& ini, const char* module) const;
bool post_process(TInstall_ini& ini, const char* module) const; bool post_process(TInstall_ini& ini, const char* module) const;
bool get_internet_path(TFilename& ininame) const; bool get_patches_path(TFilename& path) const;
void parse_internet_path(TString& http_server, TFilename& http_path) const; void parse_internet_path(TString& http_server, TFilename& http_path) const;
public: public:
bool installed() const { return _installed;} bool installed() const { return _installed;}
bool sys_installed() const { return _sys_installed;} bool setup_run() const { return _setup_run; }
bool modules_pending() const { return _modules_pending && sys_installed();}
int station_type() const {return _station_type;} int station_type() const {return _station_type;}
bool autoload(); bool autoload();
bool install(const TString& module, int patch); bool install(const TString& module, int patch);
@ -141,7 +158,7 @@ public:
void backup() const; void backup() const;
bool run_conversion() const bool run_conversion() const
{ return installed() && !sys_installed() && (_reboot_program & NEW_TRR) != 0; } { return installed() && (_reboot_program & NEW_TRR) != 0; }
TInstaller_mask(); TInstaller_mask();
virtual ~TInstaller_mask(); virtual ~TInstaller_mask();
@ -182,8 +199,8 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch
return true; return true;
} }
// Copia nello sheet i dati di un modulo prendendoli da un .ini // Copia nello sheet l'intestazione di un modulo prendendola da un .ini
bool TInstaller_mask::add_header(TConfig& ini, const TString& module, bool patch) bool TInstaller_mask::add_header(TConfig& ini, const TString& module)
{ {
ini.write_protect(); ini.write_protect();
bool ok = ini.set_paragraph(module); bool ok = ini.set_paragraph(module);
@ -198,21 +215,6 @@ bool TInstaller_mask::add_header(TConfig& ini, const TString& module, bool patch
return ok; return ok;
} }
static int compare_modules(const TObject** o1, const TObject** o2)
{
TToken_string& ts1 = *(TToken_string*)(*o1);
TToken_string& ts2 = *(TToken_string*)(*o2);
int res = 0;
for (int i = 2; i < 5 && res == 0; i++)
{
TString16 s1 = ts1.get(i);
const char* s2 = ts2.get(i);
res = s1.compare(s2);
}
return res;
}
bool TInstaller_mask::has_module(int modnumber) const bool TInstaller_mask::has_module(int modnumber) const
{ {
//se sei un server hai tutti i moduli da installare //se sei un server hai tutti i moduli da installare
@ -224,7 +226,7 @@ bool TInstaller_mask::has_module(int modnumber) const
} }
//che tipo di installazione e'? //che tipo di installazione e'?
int TInstaller_mask::test_type() const int TInstaller_mask::test_station_type() const
{ {
TConfig ini(CONFIG_INSTALL, "Main"); TConfig ini(CONFIG_INSTALL, "Main");
int type = ini.get_int("Type"); int type = ini.get_int("Type");
@ -255,7 +257,7 @@ int TInstaller_mask::precheck_modules(bool only_newer)
int patchlevel,modnumber,currpatch; int patchlevel,modnumber,currpatch;
bool check_enabled = true; bool check_enabled = true;
_modules_pending = false; _setup_run = false; //inizializzazione del flag di controllo di lancio di setup.exe
TString_array& array = rows_array(); TString_array& array = rows_array();
FOR_EACH_ARRAY_ROW(array, r, row) FOR_EACH_ARRAY_ROW(array, r, row)
@ -270,18 +272,14 @@ int TInstaller_mask::precheck_modules(bool only_newer)
if (modnumber >= 0 && has_module(modnumber) && if (modnumber >= 0 && has_module(modnumber) &&
!release.blank() && !release.blank() &&
((release > currrelease) || ((release > currrelease) ||
(release == currrelease && (only_newer ? patchlevel>currpatch: patchlevel>=currpatch) )) (release == currrelease && (only_newer ? patchlevel > currpatch : patchlevel >= currpatch) ))
) )
{ {
// checca il modulo o la patch se ho installata la stessa versione // checca il modulo o la patch se ho installata la stessa versione
const bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease; const bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease;
if (check_enabled) if (check_enabled)
check(r, chk); check(r, chk);
else
{
if (chk)
_modules_pending = true;
}
if (chk && only_newer && cod_module == "sy") //se viene checkato il modulo sy (sistema) deve togliere.. if (chk && only_newer && cod_module == "sy") //se viene checkato il modulo sy (sistema) deve togliere..
{ //..la possibilita' di installare altri moduli.. { //..la possibilita' di installare altri moduli..
for (int i = 0; i < array.items(); i++) for (int i = 0; i < array.items(); i++)
@ -289,9 +287,9 @@ int TInstaller_mask::precheck_modules(bool only_newer)
disable(DLG_USER); disable(DLG_USER);
check_enabled = false; //..ed uscire check_enabled = false; //..ed uscire
} }
} } //if(modnumber>=0...
} } //FOR_EACH_ARRAY_ROW...
force_update(); // Indispensabile per vedere le righe aggiornate force_update(); // Indispensabile per vedere le righe aggiornate sullo sheet
return items(); return items();
} }
@ -345,21 +343,23 @@ bool TInstaller_mask::autoload()
TString http_server; TString http_server;
TFilename http_path; TFilename http_path;
TFilename path ; TFilename path;
TFilename ininame; TFilename ininame;
const bool internet = get_internet_path(path); //controla se si e' scelto un path di installazione internet o da disco
const bool internet = get_patches_path(path);
//se e' un aggiornamento via internet...
if (internet) if (internet)
{ {
parse_internet_path(http_server,http_path); parse_internet_path(http_server, http_path); //controlla il path internet scritto nel campo sulla maschera
make_dir(path); make_dir(path); //crea la directory temporanaea di installazione dove depositare e scompattare gli zip
ininame = path; ininame = path;
ininame.add(TInstall_ini::default_name()); ininame.add(TInstall_ini::default_name());
if (ininame.exist() && yesno_box(TR("Si desidera svuotare la cache dei files scaricati dal sito?"))) //se si ritrova dei vecchi .ini nella directory temporanea->pulisce la directory temporanea x evitare casini
if (ininame.exist()) //&& yesno_box(TR("Si desidera svuotare la cache dei files scaricati dal sito?"))) domanda del cazzo!
{ {
TString_array list; TString_array list;
TFilename name = path; name.add("*.*"); TFilename name = path; name.add("*.*");
@ -370,16 +370,14 @@ bool TInstaller_mask::autoload()
} }
if (!ininame.exist()) if (!ininame.exist())
{ {
bool httpresult = http_isredirected_server(http_server, http_path);
TFilename remote_ini = http_path; TFilename remote_ini = http_path;
remote_ini << TInstall_ini::default_name(); remote_ini << TInstall_ini::default_name();
{ {
TIndwin contacting(60,TR("Connessione al server HTTP..."),false,false); TIndwin contacting(60,TR("Connessione al server HTTP..."), false, false);
httpresult=http_get(http_server, remote_ini, ininame); http_get(http_server, remote_ini, ininame);
} }
} }
} } //if(internet...
if (path.exist()) if (path.exist())
{ {
@ -411,7 +409,7 @@ bool TInstaller_mask::autoload()
if (module[0] == '_' || module.len() == 2) if (module[0] == '_' || module.len() == 2)
{ {
if (module[0] == '_') if (module[0] == '_')
add_header(ini, module, false); add_header(ini, module);
else else
{ {
TFilename mod_ini = ininame.path(); TFilename mod_ini = ininame.path();
@ -427,8 +425,8 @@ bool TInstaller_mask::autoload()
else else
add_module(ini, module, false); add_module(ini, module, false);
} }
} } //if(module[0]...
} } //FOR_EACH_ARRAY_ROW(...
} }
else else
{ {
@ -608,9 +606,6 @@ bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
#ifndef _DEMO_ #ifndef _DEMO_
if (year > dongle().year_assist()) if (year > dongle().year_assist())
{ {
/* Scommentare solo se ci si sente soli e si desidera ricevere telefonate in piu'
warning_box(FR("Per installare la versione %s del modulo '%s'\noccorre il contratto di assistenza per l'anno %s."),
(const char*)version, module, split_ass(year));*/
if (!update_assistance_year()) if (!update_assistance_year())
return false; return false;
} }
@ -715,8 +710,8 @@ bool TInstaller_mask::move_file(const TFilename& src, const TFilename& dst) cons
const bool is_zip = is_zip_file(src); const bool is_zip = is_zip_file(src);
const long filesize = fsize(src) * (is_zip ? 4 : 1); const long filesize = fsize(src) * (is_zip ? 4 : 1);
if (xvt_fsys_test_disk_free_space(dest, filesize) == 0) if (xvt_fsys_test_disk_free_space(dest.path(), filesize) == 0)
return error_box(TR("Lo spazio sull'unita' di destinazione e' insufficiente!")); return error_box(TR("Lo spazio disponibile e' insufficiente!"));
const bool write_ok = ::fcopy(src, dest); const bool write_ok = ::fcopy(src, dest);
if (write_ok && is_zip) if (write_ok && is_zip)
@ -875,7 +870,7 @@ KEY TInstaller_mask::askdisk(TString & path, TFilename & cmdline, int d, int dis
bool TInstaller_mask::install(const TString& module, int patchlevel) bool TInstaller_mask::install(const TString& module, int patchlevel)
{ {
bool cancelled=false; bool cancelled = false;
bool ok = false; bool ok = false;
TString msg; // stringa per i messaggi TString msg; // stringa per i messaggi
TString16 lastrelease; // release che sto installando TString16 lastrelease; // release che sto installando
@ -885,11 +880,11 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
TString http_server; TString http_server;
TFilename http_path; TFilename http_path;
const bool internet = get_internet_path(path); const bool internet = get_patches_path(path);
if (internet) if (internet)
parse_internet_path(http_server,http_path ); parse_internet_path(http_server,http_path );
const bool is_a_patch=(patchlevel > 0); const bool is_a_patch = (patchlevel > 0);
TFilename ininame = path; TFilename ininame = path;
ininame.add(module); ininame.add(module);
@ -1158,6 +1153,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
{ {
TInstall_ini ini; TInstall_ini ini;
ini.set("DiskPath", get(F_PATH)); ini.set("DiskPath", get(F_PATH));
ini.set("WebPath", get(F_WEB));
ini.set("Data", TDate(TODAY), module); ini.set("Data", TDate(TODAY), module);
ini.update_prices(ininame); ini.update_prices(ininame);
} }
@ -1178,34 +1174,46 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
} }
bool TInstaller_mask::get_internet_path(TFilename &ininame) const bool TInstaller_mask::get_patches_path(TFilename& path) const
{ {
ininame = get(F_PATH); const TEdit_field& www = efield(F_WEB);
if (is_internet_path(ininame)) path = get(F_WEB);
if (www.active() && path.full() && is_internet_path(path))
{ {
ininame.tempdir(); path.tempdir();
ininame.add("www"); path.add("www");
return true; return true;
} }
else
path = get(F_PATH);
return false; return false;
} }
void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http_path) const void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http_path) const
{ {
http_server = get(F_PATH); http_server = get(F_WEB);
if (http_server.blank())
{
http_server = http_default_path();
((TMask*)this)->set(F_WEB, http_server);
}
if (http_server.compare("http://", 7, true) == 0) if (http_server.compare("http://", 7, true) == 0)
http_server.ltrim(7); http_server.ltrim(7);
const int slash = http_server.find('/'); const int slash = http_server.find('/');
if (slash > 0) if (slash > 0)
{ {
http_path = http_server.mid(slash); http_path = http_server.mid(slash);
if (http_path.right(1) != "/")
http_path << '/';
http_server.cut(slash); http_server.cut(slash);
} }
else
http_path = http_default_path; //aggiunge lo slash finale se l'utonto l'ha omesso
if (!http_path.ends_with("/"))
http_path << '/';
//e' un server redirezionato?
http_isredirected_server(http_server, http_path);
} }
bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch, bool only_newer) bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch, bool only_newer)
@ -1213,7 +1221,7 @@ bool TInstaller_mask::install_patches(const TString& module, const TString& last
bool ok = true; bool ok = true;
TString_array modules; TString_array modules;
TFilename ininame; TFilename ininame;
get_internet_path(ininame); get_patches_path(ininame);
ininame.add(module); ininame.add(module);
ininame << "????a.ini"; ininame << "????a.ini";
@ -1269,11 +1277,30 @@ bool TInstaller_mask::path_handler(TMask_field& fld, KEY key)
return ok; return ok;
} }
bool TInstaller_mask::web_handler(TMask_field& fld, KEY key)
{
bool ok = true;
if (key == K_TAB && fld.focusdirty())
{
TFilename path = fld.get();
if (path.not_empty())
{
if (!path.ends_with("/"))
{
path << '/';
fld.set(path);
}
ok = ::is_internet_path(path);
if (!ok)
ok = fld.error_box(TR("Specificare un indirizzo valido"));
}
}
return ok;
}
void TInstaller_mask::install_selection() void TInstaller_mask::install_selection()
{ {
TString_array& arr = rows_array(); TString_array& arr = rows_array();
_sys_installed = false;
int nModules = 0; int nModules = 0;
{ {
@ -1341,7 +1368,8 @@ void TInstaller_mask::install_selection()
TString256 msg; TString256 msg;
msg.format(FR("Si desidera ritornare alla patch %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modulo); msg.format(FR("Si desidera ritornare alla patch %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modulo);
ok = noyes_box(msg); ok = noyes_box(msg);
} } }
} //if(ok&&is_patch...
if (ok) if (ok)
{ {
@ -1358,48 +1386,98 @@ void TInstaller_mask::install_selection()
is_patch = false; // Quando la versione installata precede la patch base devo reinstallare il modulo! is_patch = false; // Quando la versione installata precede la patch base devo reinstallare il modulo!
} }
} }
TFilename path;
const bool internet = get_patches_path(path);
//richiesto aggiornamento da disco del modulo SY da manutenzione/installazione moduli!
if (modulo == "sy")
{
if (!internet)
{
bool file_copied = false;
//trova il path della directory setup che e' nell'area con gli zip del cd
TFilename disk_path = path;
disk_path.add("setup/");
TString_array ar;
const int items = list_files(disk_path, ar);
if (items > 0)
{
//copia la dir setup dal disco sovrascrivendo eventuali files gia' presenti
make_dir("setup");
TFilename local_file, remote_file;
FOR_EACH_ARRAY_ROW(ar, r, row)
{
local_file = row->mid(path.len() + 1);
remote_file = *row;
file_copied = fcopy(remote_file, local_file); //occhio alle maiuscole!!!!
}
}
//lancia setup in modalita' aggiornamento da disco
TExternal_app app("setup\\setup.exe -ud");
_setup_run = app.run(true) != 0;
}
//richiesto aggiornamento via web del modulo SY da manutenzione/installazione moduli!
else
{
bool file_copied = false;
//trova l'indirizzo web completo
TString http_server;
TFilename http_path;
parse_internet_path(http_server, http_path);
//copia la dir setup dalla remote dir sovrascrivendo eventuali files gia' presenti
http_path.add("setup/");
TString_array ar;
http_dir(http_server, http_path, ar);
if (ar.items() > 0)
{
make_dir("setup");
TFilename local_file, remote_file;
FOR_EACH_ARRAY_ROW(ar, r, row)
{
local_file = "setup";
local_file.add(*row);
remote_file = http_path;
remote_file.add(*row);
file_copied = http_get(http_server, remote_file, local_file); //occhio alle maiuscole!!!!
}
//lancia setup in modalita' aggiornamento web
TExternal_app app("setup\\setup.exe -uw");
_setup_run = app.run(true) != 0;
}
}
if (_setup_run) //se riesce a lanciare setup.exe...
{
//si suicida...Banzai!
uncheck(r);
send_key(K_SPACE, DLG_QUIT);
return;
}
}
//installa solo le patch del modulo...
if (is_patch) if (is_patch)
{ {
ok = install_patches(modulo, oldver, oldpatch, false) ; // installa l'ultima patch ok = install_patches(modulo, oldver, oldpatch, false) ; // installa l'ultima patch
if (!ok) if (!ok)
message_box(TR("Impossibile installare le patch del modulo '%s'"),(const char *)modulo); message_box(TR("Impossibile installare le patch del modulo '%s'"),(const char *)modulo);
} }
else else //..installa anche il pacco del modulo
{ {
ok = install(modulo, 0); // installa il modulo ok = install(modulo, 0); // installa il modulo
} }
if (ok) if (ok)
{ {
_installed = true; // Setta il flag di almeno un modulo installato _installed = true; // Setta il flag di almeno un modulo installato
if (modulo == "sy") //se ha installato il modulo 'sy' esce
{
_sys_installed = true;
enable_row(r); //deve abilitare la riga di system senno' non la puo' uncheckare dopo
uncheck(-1); //uncheck di tutti i moduli
break;
}
uncheck(r); //finalmente unchecka i moduli installati uncheck(r); //finalmente unchecka i moduli installati
} }
} } //if(ok)...
else else
uncheck(r); // se non ci sono patch o moduli -> uncheck uncheck(r); // se non ci sono patch o moduli -> uncheck
} } //FOR_EACH_ARRAY_ROW(arr...
force_update(); //serve per togliere il check al modulo 'sy' quando viene installato
if (installed())
{
if (_sys_installed)
{
if (_modules_pending)
warning_box(TR("Modulo SY installato: gli altri moduli verranno installati successivamente"));
else
message_box(TR("Modulo SY installato: il programma si riavviera' automaticamente"));
send_key(K_SPACE, DLG_QUIT); force_update(); //serve per togliere il check al modulo 'sy' quando viene installato
}
else
message_box(TR("Installazione conclusa"));
}
} }
bool TInstaller_mask::install_handler(TMask_field& fld, KEY key) bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
@ -1421,22 +1499,6 @@ bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
} }
bool TInstaller_mask::quit_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TInstaller_mask & m=(TInstaller_mask &) f.mask();
const bool check_on = _curr_mask->check_enabled();
_curr_mask->enable_check(true);
const bool some = _curr_mask->one_checked();
_curr_mask->enable_check(check_on);
if (some)
return noyes_box(TR("Alcuni moduli sono selezionati per l'installazione.\nConfermare l'uscita"));
}
return true;
}
bool TInstaller_mask::tutti_handler(TMask_field& f, KEY k) bool TInstaller_mask::tutti_handler(TMask_field& f, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
@ -1468,33 +1530,59 @@ bool TInstaller_mask::on_key(KEY key)
TInstaller_mask::TInstaller_mask() TInstaller_mask::TInstaller_mask()
: TArray_sheet(0, 0, 0, 0, TR("Installazione"), : TArray_sheet(0, 0, 0, 0, TR("Installazione"),
HR("@1|Modulo@32|Cod.@3|Versione da\ninstallare@11|Liv.\nPatch@6|Data\nRilascio@10|Versione\nInstallata@10|Liv.\nPatch@6|Data\nInstallazione@13|Aggiornamento|Patch Base"), HR("@1|Modulo@32|Cod.@3|Versione da\ninstallare@11|Liv.\nPatch@6|Data\nRilascio@10|Versione\nInstallata@10|Liv.\nPatch@6|Data\nInstallazione@13|Aggiornamento|Patch Base"),
0x18, 3) 0x18, 4)
{ {
_station_type = test_type(); _station_type = test_station_type();
_curr_mask = this; _curr_mask = this;
_installed = false; _installed = false;
_sys_installed = false;
_reboot_program= NONE; _reboot_program= NONE;
add_string(F_PATH, 0, PR("Installa da "), 1, 1, 80, "", 60); //in base al tipo di installazione che rileva decide se puo' effettuare aggiornamenti via web (un client..
add_string(F_CURPATH, 0, PR("Installa in "), 1, 2, 80, "D", 60); //..non puo' fare aggiornamenti da web!!!)
TRadio_field& rf = add_radio(F_TYPE, 0, "", 1, 0, 21, "0|1", "Installa da disco|Installa da internet");
*rf.message(0, true) = "DISABLE,207|ENABLE,201";
*rf.message(1, true) = "DISABLE,201|ENABLE,207";
add_string(F_PATH, 0, "", 22, 1, 256, "", 58);
add_string(F_WEB, 0, "", 22, 2, 256, "", 58);
set(F_TYPE, "0", 0x1);
//un client non puo' scegliere a caso da dove aggiornarsi!Solo dal suo server!
if (_station_type == 3)
rf.disable();
add_string(F_CURPATH, 0, PR("Installa in "), 1, 3, 80, "D", 58);
add_button(F_UPDATE, BR("Rileggi", 9), '\0'); add_button(F_UPDATE, BR("Rileggi", 9), '\0');
add_button(F_INSTALL, BR("Installa", 9), '\0'); // NON mettere 'I' add_button(F_INSTALL, BR("Installa", 9), '\0'); // NON mettere 'I'
set_handler(F_PATH, path_handler); set_handler(F_PATH, path_handler);
set_handler(F_WEB, web_handler);
set_handler(F_INSTALL, install_handler); set_handler(F_INSTALL, install_handler);
set_handler(F_UPDATE, update_handler); set_handler(F_UPDATE, update_handler);
set_handler(DLG_QUIT, quit_handler);
set_handler(DLG_USER, tutti_handler); set_handler(DLG_USER, tutti_handler);
TInstall_ini ini; TInstall_ini ini;
TFilename path = ini.get("DiskPath"); TFilename path = ini.get("DiskPath");
set(F_PATH, path); TFilename webpath = ini.get("WebPath");
const bool floppy = xvt_fsys_is_removable_drive(path) != 0; set(F_PATH, path);
if (path.not_empty() && !floppy && !is_internet_path(path)) set(F_WEB, webpath);
//..fine costruzione maschera di installazione
//decide quale e' il percorso di installazione
//ha un cd o un disco di rete -> si aggiorna da questo...
if (path.exist())
autoload(); autoload();
else //senno' cerca su internet se trova un path internet completo e la connessione funzionante
{
if (_station_type != 3 && webpath.full())
{
set(F_TYPE, "1", 0x1);
if (xvt_net_get_status() & 0x2) //la connessione web funziona?...
//if (yesno_box(TR("E' possibile l'aggiornamento via internet. Si desidera connettersi ora?")))
autoload(); //...quindi scarica l'elenco dei moduli da aggiornare!
}
}
DIRECTORY dir; DIRECTORY dir;
xvt_fsys_get_dir(&dir); xvt_fsys_get_dir(&dir);
@ -1505,26 +1593,6 @@ TInstaller_mask::TInstaller_mask()
TInstaller_mask::~TInstaller_mask() TInstaller_mask::~TInstaller_mask()
{ {
_curr_mask = NULL; _curr_mask = NULL;
if (_reboot_program != NONE)
{
TString msg;
msg << TR("Sono stati aggiornati i seguenti elementi:") < '\n';
if (_reboot_program & NEW_MENU)
msg << TR("voci di menu;");
if (_reboot_program & NEW_MENUPRG)
msg << TR("navigatore dei menu;");
if (_reboot_program & NEW_INSTALLER)
msg << TR("installatore;");
if (_reboot_program & NEW_DLL)
msg << TR("librerie di base;");
if (_reboot_program & NEW_TRR)
msg << TR("tracciati record;");
msg.rtrim(1);
warning_box(msg);
}
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -1569,7 +1637,6 @@ bool TInstaller::create()
if (_m->station_type() == 3) if (_m->station_type() == 3)
{ {
_m->disable_check(); _m->disable_check();
_m->disable(F_PATH);
_m->disable(F_UPDATE); _m->disable(F_UPDATE);
_m->disable(DLG_USER); _m->disable(DLG_USER);
} }
@ -1604,16 +1671,15 @@ void TInstaller::main_loop()
convert_archives(); convert_archives();
} }
const bool pending = _m->modules_pending(); //controlla se ha lanciato setup.exe prima di chiudersi; se non lo ha fatto -> e' a fine installazione..
//..normale (moduli non SY) e quindi lancia ba0.exe
const bool setup_launched = _m->setup_run();
delete _m; _m = NULL; delete _m; _m = NULL;
//le graffe servono per salvare il file campo.ini!! NON eliminarle if (!setup_launched)
{ {
TConfig campo(CONFIG_INSTALL, "ba0close"); TExternal_app ba0("ba0.exe");
campo.set("ModulesPending", pending ? "1" : "0"); ba0.run(true, true, false); // run asynchronous and not iconized!
} }
TExternal_app ba0close("ba0close.exe");
ba0close.run(true, true, false); // run asynchronous and not iconized!
} }
int ba1700(int argc, char* argv[]) int ba1700(int argc, char* argv[])

View File

@ -3,3 +3,5 @@
#define F_INSTALL 203 #define F_INSTALL 203
#define F_SELECT 204 #define F_SELECT 204
#define F_UPDATE 205 #define F_UPDATE 205
#define F_TYPE 206
#define F_WEB 207