2007-09-20 09:53:21 +00:00
# include "wxinc.h"
# include "key.h"
# include "wizard.h"
# define HGAP 4
# define VGAP 2
////////////////////////////////////////////////////////////////////////////////////////////
//Campo wizard page (pagina generica del programma, di cui saranno figlie le singole pagine)
class CampoWizardPage : public wxWizardPageSimple
{
wxHtmlWindow * m_pText ;
protected :
CampoWizard & GetWizard ( ) const { return * ( CampoWizard * ) GetParent ( ) ; }
void SetHTMLText ( const wxString strTitle , const wxString strBody ) ;
void SetHTMLPage ( const wxString strFile ) ;
wxString Bold ( const wxString strStr ) const ;
void AddLabel ( wxSizer * pSizer , const wxChar * label ) ;
void AddLabel ( wxGridBagSizer * pSizer , const wxChar * label , unsigned int row , unsigned int column ) ;
2007-10-03 15:34:32 +00:00
bool CheckDataDir ( wxString strDataPath ) const ;
bool CheckPrgDir ( const wxString & strPrgPath ) const ;
2007-09-20 09:53:21 +00:00
public :
virtual bool ForwardValidate ( ) { return true ; }
wxString Get ( wxWindowID id ) const ;
bool GetBool ( wxWindowID id ) const ;
bool Set ( wxWindowID id , const wxString & str ) ;
2007-10-04 13:21:29 +00:00
bool Set ( wxWindowID id , bool bOk ) ;
2007-09-20 09:53:21 +00:00
int GetSelection ( wxWindowID id ) const ;
CampoWizardPage ( wxWizard * parent ) ;
} ;
wxString CampoWizardPage : : Get ( wxWindowID id ) const
{
wxWindow * pWnd = FindWindowById ( id ) ;
return pWnd ? pWnd - > GetLabel ( ) : wxEmptyString ;
}
bool CampoWizardPage : : GetBool ( wxWindowID id ) const
{
wxCheckBox * pWnd = ( wxCheckBox * ) FindWindowById ( id ) ;
return pWnd ! = NULL & & pWnd - > IsChecked ( ) ;
}
bool CampoWizardPage : : Set ( wxWindowID id , const wxString & str )
{
wxWindow * pWnd = FindWindowById ( id ) ;
if ( pWnd )
pWnd - > SetLabel ( str ) ;
return ( pWnd ! = NULL ) ;
}
bool CampoWizardPage : : Set ( wxWindowID id , const bool bul )
{
wxCheckBox * pWnd = ( wxCheckBox * ) FindWindowById ( id ) ;
if ( pWnd )
pWnd - > SetValue ( bul ) ;
return ( pWnd ! = NULL ) ;
}
int CampoWizardPage : : GetSelection ( wxWindowID id ) const
{
int n = - 1 ;
wxWindow * pWnd = FindWindowById ( id ) ;
if ( pWnd )
{
wxChoice * pList = ( wxChoice * ) pWnd ;
n = pList - > GetSelection ( ) ;
}
return n ;
}
void CampoWizardPage : : SetHTMLPage ( const wxString strFile )
{
m_pText - > LoadPage ( strFile ) ;
}
//parte html della finestra standard
void CampoWizardPage : : SetHTMLText ( wxString strTitle , wxString strBody )
{
2008-11-28 10:59:10 +00:00
wxString strAppNameFull = wxT ( " <i> " ) ; strAppNameFull + = Bold ( APPNAMEFULL ) ; strAppNameFull + = wxT ( " </i> " ) ;
wxString strAppName = APPNAME ;
strTitle . Replace ( wxT ( " APPNAMEFULL " ) , strAppNameFull ) ;
strBody . Replace ( wxT ( " APPNAMEFULL " ) , strAppNameFull ) ;
2007-09-20 09:53:21 +00:00
strTitle . Replace ( wxT ( " APPNAME " ) , strAppName ) ;
strBody . Replace ( wxT ( " APPNAME " ) , strAppName ) ;
wxString str ;
str + = wxT ( " <html><body> " ) ;
str + = wxT ( " <p align=center><b> " ) ; str + = strTitle ; str + = wxT ( " </b></p> " ) ;
str + = wxT ( " <hr> " ) ;
str + = wxT ( " <div align=justify> " ) ; str + = strBody ; str + = wxT ( " </div> " ) ;
str + = wxT ( " </body></html> " ) ;
m_pText - > SetPage ( str ) ;
}
wxString CampoWizardPage : : Bold ( const wxString strStr ) const
{
wxString strBold ;
strBold < < " <b> " < < strStr < < " </b> " ;
return strBold ;
}
//metodo per aggiungere i prompt agli oggetti contenuti nelle GridSize e similia
void CampoWizardPage : : AddLabel ( wxSizer * pSizer , const wxChar * label )
{
pSizer - > Add ( new wxStaticText ( this , wxID_ANY , label ) , 0 , wxALL | wxALIGN_CENTER_VERTICAL ) ;
}
void CampoWizardPage : : AddLabel ( wxGridBagSizer * pSizer , const wxChar * label , unsigned int row , unsigned int column )
{
pSizer - > Add ( new wxStaticText ( this , wxID_ANY , label ) , wxGBPosition ( row , column ) ) ;
}
//metodo per il controllo della validita' di un'area dati
2007-10-03 15:34:32 +00:00
bool CampoWizardPage : : CheckDataDir ( wxString strDataPath ) const
2007-09-20 09:53:21 +00:00
{
bool ok_data = false ;
2007-10-03 15:34:32 +00:00
wxDir dirDataPath ( strDataPath ) ;
2007-09-20 09:53:21 +00:00
//deve esistere non vuota, e contenere la sottodirectory "com" con i dati comuni
if ( dirDataPath . Exists ( strDataPath ) & & dirDataPath . HasSubDirs ( " com " ) )
{
strDataPath < < " /com " ;
wxFileName fnFileToCheck ( strDataPath , " tabcom " ) ;
fnFileToCheck . SetExt ( " dbf " ) ;
if ( fnFileToCheck . FileExists ( ) )
2007-10-03 15:34:32 +00:00
{
ok_data = fnFileToCheck . IsFileWritable ( ) ;
}
2007-09-20 09:53:21 +00:00
}
return ok_data ;
}
2007-10-03 15:34:32 +00:00
//metodo per il controllo della validita' di un'area programmi
bool CampoWizardPage : : CheckPrgDir ( const wxString & strPrgPath ) const
{
bool ok_prg = false ;
wxDir dirPrgPath ( strPrgPath ) ;
//deve esistere non vuota e con sottodirecrory (almeno res e recdesc ci vogliono)
if ( dirPrgPath . Exists ( strPrgPath ) & & dirPrgPath . HasFiles ( ) & & dirPrgPath . HasSubDirs ( ) )
{
wxFileName fnFileToCheck ( strPrgPath , " campo " ) ;
fnFileToCheck . SetExt ( " ini " ) ;
if ( fnFileToCheck . FileExists ( ) )
{
fnFileToCheck . SetName ( " install " ) ;
fnFileToCheck . SetExt ( " ini " ) ;
if ( fnFileToCheck . FileExists ( ) )
{
fnFileToCheck . SetName ( " campo " ) ;
fnFileToCheck . SetExt ( " aut " ) ;
if ( fnFileToCheck . FileExists ( ) )
{
fnFileToCheck . SetName ( " ba0 " ) ;
fnFileToCheck . SetExt ( " exe " ) ;
if ( fnFileToCheck . FileExists ( ) )
{
ok_prg = true ;
} //if(ba0..
} //if(campo..
} //if(install..
} //if(ini...
} //if(dirPrgPath..
return ok_prg ;
}
2007-09-20 09:53:21 +00:00
//costruttore della finestra standard
CampoWizardPage : : CampoWizardPage ( wxWizard * parent )
: wxWizardPageSimple ( parent )
{
wxBoxSizer * pSizer = new wxBoxSizer ( wxVERTICAL ) ;
m_pText = new wxHtmlWindow ( this , 100 , wxDefaultPosition , wxSize ( 512 , 312 ) ) ;
pSizer - > Add ( m_pText , 0 , wxALL , 0 ) ;
pSizer - > AddSpacer ( 5 ) ;
SetSizer ( pSizer ) ;
}
/**********************************************************************************************************/
/* 1 Pagina di benvenuto */
/**********************************************************************************************************/
class CampoWizardPage1 : public CampoWizardPage
{
public :
CampoWizardPage1 ( wxWizard * parent ) ;
} ;
CampoWizardPage1 : : CampoWizardPage1 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
//contenuto della prima schermata (pagina benvenuto)
2008-11-28 10:59:10 +00:00
wxString strTitle = wxT ( " Benvenuti in <b>APPNAMEFULL</b> " ) ;
2007-09-20 09:53:21 +00:00
wxString strBody = wxT ( " <p>Questo programma vi guider<65> passo a passo nell'installazione / aggiornamento del software.</p> " ) ;
2007-09-28 10:22:37 +00:00
strBody + = wxT ( " <p><u><b>LEGGERE ATTENTAMENTE LE ISTRUZIONI</u> che saranno visualizzate nelle finestre di questo programma di installazione!</b></p> " ) ;
strBody + = wxT ( " <p><b>Prima di proseguire con l'installazione / aggiornamento assicurarsi:</b></p> " ) ;
2007-09-28 10:43:10 +00:00
strBody + = wxT ( " <p><b>1) </b>di avere effettuato il login a Windows con un utente di tipo 'Amministratore' di sistema.</p> " ) ;
2007-10-16 13:52:19 +00:00
strBody + = wxT ( " <p><b>2) </b>di avere terminato ogni altro programma in funzione</b></p> " ) ;
2007-09-28 10:22:37 +00:00
strBody + = wxT ( " <p><b>In caso di aggiornamento assicurarsi inoltre:</b></p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p><b>3) </b>di avere effettuato un backup di sicurezza dei dati.</p> " ) ;
strBody + = wxT ( " <p><b>4) </b>che il programma APPNAMEFULL NON sia in funzione.</p> " ) ;
strBody + = wxT ( " <p><b>5) </b>che l'eventuale gestore dei servizi di APPNAMEFULL, se presente, NON sia in funzione.</p> " ) ;
2007-09-20 09:53:21 +00:00
SetHTMLText ( strTitle , strBody ) ;
}
/**********************************************************************************************************/
// 2 Pagina con Accetta / Rifiuta la licenza
//*********************************************************************************************************/
class CampoWizardPage2 : public CampoWizardPage
{
protected :
virtual bool ForwardValidate ( ) ;
public :
CampoWizardPage2 ( wxWizard * parent ) ;
} ;
bool CampoWizardPage2 : : ForwardValidate ( )
{
if ( GetSelection ( 201 ) = = 1 )
return ErrorBox ( " Impossibile proseguire se non si accetta la licenza sul software!! " ) ;
return true ;
}
CampoWizardPage2 : : CampoWizardPage2 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
SetHTMLPage ( " licenza.htm " ) ;
//radiobutton Accetta / Rifiuta
wxArrayString asAccRef ;
asAccRef . Add ( " Accetta " ) ;
asAccRef . Add ( " Rifiuta " ) ;
wxRadioBox * radio_box = new wxRadioBox ( this , 201 , " Selezionare 'Accetta' per proseguire con l'installazione, 'Rifiuta' per terminare l'installazione " , wxDefaultPosition ,
wxDefaultSize , asAccRef , 0 , wxRA_SPECIFY_COLS ) ;
radio_box - > SetSelection ( 1 ) ;
GetSizer ( ) - > Add ( radio_box ) ;
}
/**********************************************************************************************************/
/* 3 Pagina con la scelta di Aggiornamento / Tipo Installazione */
/**********************************************************************************************************/
class CampoWizardPage3 : public CampoWizardPage
{
wxRadioBox * m_pRadioBox ;
protected :
virtual bool ForwardValidate ( ) ;
bool LocalDongleTest ( ) const ;
public :
CampoWizardPage3 ( wxWizard * parent ) ;
} ;
//metodo per cercare se c'e' una chiave fisicamente collegata (serve per abilitare l'installazione demo)
bool CampoWizardPage3 : : LocalDongleTest ( ) const
{
unsigned short serno = 0xFFFF ;
int yearKey = 0 ;
serno = HardlockLogin ( yearKey ) ;
if ( serno = = 0xFFFF )
serno = EutronLogin ( yearKey ) ;
return serno ! = 0xFFFF & & yearKey > 0 ;
}
bool CampoWizardPage3 : : ForwardValidate ( )
{
const int iLastRow = m_pRadioBox - > GetRowCount ( ) - 1 ;
const int iSelectedRow = m_pRadioBox - > GetSelection ( ) ;
wxString strPrgPath ;
wxString strSrvAuth ;
wxString strSrvDict ;
//analizza il campo.ini dell'installazione selezionata (si usa < perche' l'ultima row e' la nuova installazione!)
if ( iSelectedRow < iLastRow )
{
2007-10-03 14:05:34 +00:00
strPrgPath = m_pRadioBox - > GetStringSelection ( ) . BeforeLast ( ' ( ' ) ;
strPrgPath . Trim ( ) ;
2007-09-20 09:53:21 +00:00
CampoIniFile CampoIni ( strPrgPath + " /campo.ini " , " Main " ) ;
2007-09-28 10:22:37 +00:00
//cerca il tipo dell'installazione
2007-10-18 14:51:26 +00:00
InstallationType nType = CampoIni . GetInstallationType ( ) ;
2007-10-03 14:05:34 +00:00
2007-09-28 10:22:37 +00:00
//se risulta un client...
2007-10-18 14:51:26 +00:00
if ( nType = = it_client )
2007-09-20 09:53:21 +00:00
{
CampoIniFile InstallIni ( strPrgPath + " /install.ini " , " Main " ) ;
wxString strDiskPath = InstallIni . Get ( " DiskPath " ) ;
wxString strMsg = " Per aggiornare questa stazione di lavoro e' necessario aggiornare prima il Server di " ;
2008-11-28 10:59:10 +00:00
strMsg < < APPNAMEFULL < < " in " < < strDiskPath < < " ! \n " ;
strMsg < < " Questa stazione di lavoro si aggiornera' automaticamente alla prima esecuzione del programma " < < APPNAMEFULL ;
2007-09-20 09:53:21 +00:00
return ErrorBox ( strMsg ) ;
}
2007-10-03 15:34:32 +00:00
const wxString strStudy = CampoIni . Get ( " Study " ) ;
2007-09-20 09:53:21 +00:00
CampoIniFile CampoServerIni ( strPrgPath + " /campo.ini " , " Server " ) ;
strSrvAuth = CampoServerIni . Get ( " Dongle " ) ;
strSrvDict = CampoServerIni . Get ( " Dictionary " ) ;
if ( ! CheckDataDir ( strStudy ) )
2007-10-03 15:34:32 +00:00
return ErrorBox ( " La cartella indicata come area dati NON e' valida! \n Interrompere l'installazione e selezionare un'area dati valida \n con il programma " ) ;
2007-09-20 09:53:21 +00:00
GetWizard ( ) . SetDataPath ( strStudy ) ;
if ( ! strSrvAuth . IsEmpty ( ) )
GetWizard ( ) . SetSrvAuth ( strSrvAuth ) ;
if ( ! strSrvDict . IsEmpty ( ) )
GetWizard ( ) . SetSrvDict ( strSrvDict ) ;
//setta alla pagina riassuntiva i valori della pagina attuale...
GetWizard ( ) . SetDestinationPath ( strPrgPath ) ; //va alla pagina riassuntiva
GetWizard ( ) . SetPrgLocPath ( strPrgPath ) ; //questo serve solo per la creazione del link sul desktop!
2007-10-18 14:51:26 +00:00
GetWizard ( ) . SetInstallationType ( it_upgrade ) ; //e' un aggiornamento!!
2007-09-20 09:53:21 +00:00
GetWizard ( ) . SetDesktopShortcut ( false ) ; //e' sempre un aggiornamento!
}
else //resetta il path in caso si scelga nuova installazione dopo aver scelto aggiornamento
{
//continuiamo a sconsigliare l'installazione DEMO, ma ognuno fa come crede...
if ( GetBool ( 302 ) )
{
const wxString strPrgDemoPath = " c:/campodemo " ;
wxDir dirPrgDemoPath ( strPrgDemoPath ) ;
if ( dirPrgDemoPath . Exists ( strPrgDemoPath ) & & ( dirPrgDemoPath . HasFiles ( ) | | dirPrgDemoPath . HasSubDirs ( ) ) )
return ErrorBox ( " Impossibile installare la versione DEMO! \n La cartella c:/campodemo NON e' vuota! " ) ;
GetWizard ( ) . SetInstDemoVersion ( true ) ;
}
//questo lo fa in ogni caso!
GetWizard ( ) . SetDestinationPath ( " " ) ;
GetWizard ( ) . SetDesktopShortcut ( true ) ;
}
return true ;
}
CampoWizardPage3 : : CampoWizardPage3 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
//deve cercare campo.stp
2007-09-28 10:43:10 +00:00
CampoIniFile iniCampoStp ( " C: \\ campo.stp " , " " ) ;
wxString strGroup ;
long nIndex ;
const wxString strProgram = " Program " ;
2007-09-20 09:53:21 +00:00
wxArrayString asGroups , asCampi ;
//cerca se esiste campo.stp;se lo trova cerca quelle che sono le installazioni valide;se ne trova..
//..le aggiunge ad un array di stringhe (asCampi) da cui genera un radiobutton di scelte
2007-09-28 10:43:10 +00:00
for ( bool ok = iniCampoStp . GetFirstGroup ( strGroup , nIndex ) ; ok ; ok = iniCampoStp . GetNextGroup ( strGroup , nIndex ) )
2007-09-20 09:53:21 +00:00
{
2007-09-28 10:43:10 +00:00
asGroups . Add ( strGroup ) ;
2007-09-20 09:53:21 +00:00
}
int prechecked = - 1 ;
2007-10-16 16:06:54 +00:00
for ( int i = 0 ; i < ( int ) asGroups . GetCount ( ) ; i + + )
2007-09-20 09:53:21 +00:00
{
2007-09-28 10:43:10 +00:00
CampoIniFile iniCampoStp ( " C: \\ campo.stp " , asGroups [ i ] ) ;
wxString strPath = iniCampoStp . Get ( strProgram ) ;
2007-09-20 09:53:21 +00:00
2007-10-16 16:06:54 +00:00
//sono installazioni valide quelle che passano il vaglio della CheckPrgdir, metodo che testa l'integrita'..
//..di una cartella programmi di campo
2007-10-03 15:34:32 +00:00
if ( CheckPrgDir ( strPath ) )
2007-09-20 09:53:21 +00:00
{
2007-10-03 14:05:34 +00:00
//controlla il tipo di installazione rilevata (Standalone,Server,Client)
2007-10-03 15:34:32 +00:00
CampoIniFile iniCampo ( strPath + " /campo.ini " , " Main " ) ;
2007-10-18 14:51:26 +00:00
const InstallationType nType = iniCampo . GetInstallationType ( ) ;
2007-10-03 14:05:34 +00:00
switch ( nType )
{
2007-10-18 14:51:26 +00:00
case it_server :
2007-10-18 11:13:15 +00:00
strPath < < " (Server) " ;
2007-10-03 14:05:34 +00:00
break ;
2007-10-18 14:51:26 +00:00
case it_client :
2007-10-18 11:13:15 +00:00
strPath < < " (Client) " ;
2007-10-03 14:05:34 +00:00
break ;
default :
2007-10-18 14:51:26 +00:00
strPath < < " (Standard) " ;
2007-10-03 14:05:34 +00:00
break ;
}
2007-09-28 10:43:10 +00:00
asCampi . Add ( strPath ) ;
2007-10-03 14:05:34 +00:00
//prechecca l'eventuale installazione server o standalone se ci sono piu' installazioni..
//..sulla stessa macchina
2007-09-20 09:53:21 +00:00
if ( prechecked < 0 )
2007-10-03 14:05:34 +00:00
{
2007-10-18 14:51:26 +00:00
if ( nType = = it_standalone | | nType = = it_server )
2007-09-20 09:53:21 +00:00
prechecked = i ;
}
2007-10-16 16:06:54 +00:00
} //if(CheckPrgDir(strPath)...
else //se una installazione su campo.stp non e' buona cancella la voce da campo.stp stesso..
//..per non fare casini in futuro
{
wxString strGroup = " / " ;
strGroup + = asGroups [ i ] ;
iniCampoStp . DeleteGroup ( strGroup ) ;
}
2007-10-03 14:05:34 +00:00
} //for(unsigned int i=0...
2007-09-20 09:53:21 +00:00
wxString strTitle , strBody ;
//se non ci sono delle installazioni da aggiornare propone solo installazioni..
if ( asCampi . IsEmpty ( ) )
{
strTitle + = wxT ( " Scelta Installazione " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>E' possibile <b>INSTALLARE <i>APPNAMEFULL</i></b> in un nuovo direttorio.</p> " ) ;
2007-09-20 09:53:21 +00:00
asCampi . Add ( " Nuova installazione " ) ; //voce di nuova installazione!
m_pRadioBox = new wxRadioBox ( this , 301 , " Installazione del software " , wxDefaultPosition ,
wxDefaultSize , asCampi , 0 , wxRA_SPECIFY_ROWS ) ;
}
//..senno' propone di aggiornare
else
{
strTitle + = wxT ( " Scelta Aggiornamento / Installazione " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>E' possibile <b>AGGIORNARE (scelta consigliata)</b> una installazione di <b><i>APPNAMEFULL</i></b> gia' presente oppure <b>INSTALLARE</b> in un nuovo direttorio.</p> " ) ;
2007-10-03 15:34:32 +00:00
strBody + = wxT ( " <p>Selezionare l'opzione desiderata nel riquadro sottostante. In caso di piu' di una installazione presente sul computer " ) ;
strBody + = wxT ( " sara' preselezionata la eventuale installazione di tipo <b>Server</b> o <b>Standard</b>, in quanto <u>deve essere aggiornata per prima</u>! " ) ;
2007-09-20 09:53:21 +00:00
strBody + = wxT ( " <p>In questo caso procedere all'aggiornamento di tale installazione Server e <u>aggiornare successivamente le postazioni client " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " lanciando il programma <b><i>APPNAMEFULL</i></b> su di esse</u></p> " ) ;
2007-09-20 09:53:21 +00:00
//radiobutton con le scelte aggiornamento
asCampi . Add ( " Nuova installazione " ) ;
2007-10-03 15:34:32 +00:00
m_pRadioBox = new wxRadioBox ( this , 301 , " Selezionare l'installazione da aggiornare (consigliato) o Nuova installazione " ,
wxDefaultPosition , wxDefaultSize , asCampi , 0 , wxRA_SPECIFY_ROWS ) ;
2007-10-25 15:48:37 +00:00
if ( prechecked > = 0 )
2007-09-20 09:53:21 +00:00
m_pRadioBox - > SetSelection ( prechecked ) ;
}
2007-10-03 14:05:34 +00:00
2007-09-20 09:53:21 +00:00
GetSizer ( ) - > Add ( m_pRadioBox ) ;
//se NON ci sono installazioni gia' presenti e NON c'e' alcuna chiave collegata -> puo' installare la DEMO
if ( asCampi . GetCount ( ) = = 1 & & ! LocalDongleTest ( ) )
{
//checkbox per installare la DEMO (non fatelo, vi prego!!!)
wxCheckBox * chDemoPrg = new wxCheckBox ( this , 302 , wxT ( " Installare la versione DEMO " ) ) ;
chDemoPrg - > SetValue ( false ) ;
GetSizer ( ) - > AddSpacer ( 16 ) ;
GetSizer ( ) - > Add ( chDemoPrg ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>E' possibile anche installare la versione <b>DEMO di <i>APPNAMEFULL</i></b>. <u>Questa versione e' a scopo puramente " ) ;
2007-09-20 09:53:21 +00:00
strBody + = wxT ( " dimostrativo e <b>NON</b> va di norma installata! Non e' utilizzabile come la versione normale</u> in quanto limitata nel " ) ;
strBody + = wxT ( " numero e nella data delle registrazioni e nel tempo di uso giornaliero (max 2 ore). La cartella di installazione della " ) ;
strBody + = wxT ( " versione dimostrativa e' C:/campodemo e dispone di un'area dati parzialmente precompilata.</p> " ) ;
}
SetHTMLText ( strTitle , strBody ) ;
}
/**********************************************************************************************************/
/* 4 Pagina con la gestione della chiave di protezione */
/**********************************************************************************************************/
class CampoWizardPage4 : public CampoWizardPage
{
protected :
DECLARE_EVENT_TABLE ( ) ;
void OnHLPick ( wxCommandEvent & e ) ;
void OnEUPick ( wxCommandEvent & e ) ;
void OnSRPick ( wxCommandEvent & e ) ;
virtual bool ForwardValidate ( ) ;
virtual bool TransferDataToWindow ( ) ;
wxString DecodeString ( const wxString & data ) ;
int VersionYear ( ) ;
void BuildKey ( char * key ) ;
public :
2008-01-03 11:21:17 +00:00
int DongleTest ( ) ;
2007-09-20 09:53:21 +00:00
CampoWizardPage4 ( wxWizard * parent ) ;
} ;
//metodi per la gestione dei bottoni per l'esecuzione dei programmi di installazione delle chiavi
BEGIN_EVENT_TABLE ( CampoWizardPage4 , CampoWizardPage )
EVT_BUTTON ( 401 , OnHLPick )
EVT_BUTTON ( 402 , OnEUPick )
EVT_BUTTON ( 403 , OnSRPick )
END_EVENT_TABLE ( )
void CampoWizardPage4 : : OnHLPick ( wxCommandEvent & e )
{
wxString path ( " ../../chiavi/hardlock/hldrv32.exe " ) ;
wxExecute ( path , wxEXEC_SYNC ) ;
}
void CampoWizardPage4 : : OnEUPick ( wxCommandEvent & e )
{
wxString path ( " ../../chiavi/eutron/sdi.exe " ) ;
wxExecute ( path , wxEXEC_SYNC ) ;
}
void CampoWizardPage4 : : OnSRPick ( wxCommandEvent & e )
{
static bool bSemaforo = false ;
if ( ! bSemaforo )
{
bSemaforo = true ;
wxBusyCursor hourglass ;
wxString strSrvName ;
int year = 0 ;
unsigned short serno = ServerLogin ( year , strSrvName ) ;
if ( ! strSrvName . IsEmpty ( ) )
Set ( 404 , strSrvName ) ;
bSemaforo = false ;
}
}
bool CampoWizardPage4 : : ForwardValidate ( )
{
//per poter proseguire deve aver trovato una chiave o un server!
GetWizard ( ) . SetSrvAuth ( Get ( 404 ) ) ;
int nDongleType = DongleTest ( ) ;
if ( nDongleType = = 0 )
return ErrorBox ( " Per proseguire e' NECESSARIO installare una chiave locale o collegarsi ad una chiave di rete! " ) ;
return true ;
}
bool CampoWizardPage4 : : TransferDataToWindow ( )
{
FindWindowById ( 401 ) - > Disable ( ) ;
FindWindowById ( 402 ) - > Disable ( ) ;
FindWindowById ( 403 ) - > Disable ( ) ;
FindWindowById ( 404 ) - > Disable ( ) ;
//controlla preventivamente se la chiave c'e' ed eventualmente quale e' (hardlock,eutron,server di chiavi)
const int nDongleType = DongleTest ( ) ;
GetWizard ( ) . SetDongleType ( nDongleType ) ;
wxString strTitle = wxT ( " Controllo della chiave hardware di protezione " ) ;
wxString strBody = wxT ( " <p>La versione commerciale del software richiede l'installazione e la presenza della chiave hardware di protezione</p> " ) ;
switch ( nDongleType )
{
case 1 :
strBody + = wxT ( " <p>E' stata rilevata una chiave tipo <b>Hardlock</b>:</p> " ) ;
2007-12-13 14:49:46 +00:00
strBody + = wxT ( " <p align=center><img src= \" ../../campo/servers/hardlock.gif \" /></p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>APPNAMEFULL</i></b>. Premere il pulsante \" Avanti \" .</p> " ) ;
2007-09-20 09:53:21 +00:00
break ;
case 2 :
strBody + = wxT ( " <p>E' stata rilevata una chiave tipo <b>Eutron</b>:</p> " ) ;
2007-12-13 14:49:46 +00:00
strBody + = wxT ( " <p align=center><img src= \" ../../campo/servers/eutron.gif \" /></p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>APPNAMEFULL</i></b>. Premere il pulsante \" Avanti \" .</p> " ) ;
2007-09-20 09:53:21 +00:00
break ;
case 3 :
strBody + = wxT ( " <p>E' stato rilevata una chiave remota condivisa in rete con il servizio di gestione autorizzazioni:</p> " ) ;
2007-12-13 14:49:46 +00:00
strBody + = wxT ( " <p align=center><img src= \" ../../campo/servers/autho.gif \" /></p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>APPNAMEFULL</i></b>. Premere il pulsante \" Avanti \" .</p> " ) ;
2007-09-20 09:53:21 +00:00
Set ( 404 , GetWizard ( ) . GetSrvAuth ( ) ) ;
break ;
default :
strBody + = wxT ( " <p><b>Non e' stata rilevata alcuna chiave hardware installata sul computer!</b></p> " ) ;
strBody + = wxT ( " <p>Per procedere all'installazione della chiave hardware, <b>collegarla al computer e premere il bottone corrispondente</b> alla tipologia della chiave stessa per installarne i driver.</p> " ) ;
strBody + = wxT ( " <p>Se si utilizza una chiave remota collegata ad un altro computer e condivisa in rete attraverso il servizio gestione di autorizzazioni " ) ;
strBody + = wxT ( " premere il bottone <u>Cerca</u> per attivare la ricerca automatica della chiave remota. Qualora tale ricerca fallisse digitare il nome del computer " ) ;
strBody + = wxT ( " (o l'indirizzo IP) cui e' collegata la chiave di rete e su cui e' <b>installato e attivo</b> il gestore di autorizzazioni. " ) ;
FindWindowById ( 401 ) - > Enable ( ) ;
FindWindowById ( 402 ) - > Enable ( ) ;
FindWindowById ( 403 ) - > Enable ( ) ;
FindWindowById ( 404 ) - > Enable ( ) ;
break ;
}
SetHTMLText ( strTitle , strBody ) ;
return true ;
}
void CampoWizardPage4 : : BuildKey ( char * key )
{
for ( int i = 0 ; i < 8 ; i + + )
key [ i ] = ' A ' + rand ( ) % 26 ;
}
wxString CampoWizardPage4 : : DecodeString ( const wxString & data )
{
char key [ 8 ] = " " ;
BuildKey ( key ) ;
char tmp [ 256 ] ;
int i ;
for ( i = 0 ; data [ i ] ; i + + )
tmp [ i ] = data [ i ] - ( i < 8 ? key [ i ] : tmp [ i - 8 ] ) ;
tmp [ i ] = ' \0 ' ;
return tmp ;
}
int CampoWizardPage4 : : VersionYear ( )
{
char ver [ 32 ] ;
2007-12-13 14:49:46 +00:00
GetPrivateProfileString ( " ba " , " Versione " , " " , ver , sizeof ( ver ) , " ../install.ini " ) ;
2007-09-20 09:53:21 +00:00
ver [ 4 ] = ' \0 ' ;
return atoi ( ver ) ;
}
int CampoWizardPage4 : : DongleTest ( )
{
int dongle_type = 0 ;
int yearKey = 0 ;
unsigned int serno = 0xFFFF ;
wxString strSrvName = GetWizard ( ) . GetSrvAuth ( ) ; //nome del server di autorizzazioni (se c'e')
if ( ! strSrvName . IsEmpty ( ) )
{
serno = ServerLogin ( yearKey , strSrvName ) ;
if ( serno ! = 0xFFFF )
dongle_type = 3 ; //chiave remota
}
if ( serno = = 0xFFFF )
{
serno = HardlockLogin ( yearKey ) ;
if ( serno = = 0xFFFF )
{
serno = EutronLogin ( yearKey ) ;
if ( serno ! = 0xFFFF )
dongle_type = 2 ; //chiave eutron
}
else
dongle_type = 1 ; //chiave hardlock
}
2007-12-13 14:49:46 +00:00
2007-09-20 09:53:21 +00:00
return dongle_type ;
}
CampoWizardPage4 : : CampoWizardPage4 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
//procedura per la costruzione dei bottoni e delle immagini per l'installazione dei driver di chiave
//"griglia" contenitrice degli oggetti
//griglia per sistemare i campi
wxGridBagSizer * gbsButtSizer = new wxGridBagSizer ( VGAP , HGAP ) ;
GetSizer ( ) - > Add ( gbsButtSizer ) ;
//prima riga della griglia
//Hardlock label
AddLabel ( gbsButtSizer , " Installa chiave locale di tipo Hardlock " , 0 , 0 ) ;
//Hardlock image
2007-12-13 14:49:46 +00:00
wxBitmap bmp_HL ( " ../../campo/servers/hardlock.gif " , wxBITMAP_TYPE_GIF ) ;
2007-09-20 09:53:21 +00:00
wxStaticBitmap * s_bmp_HL = new wxStaticBitmap ( this , wxID_ANY , bmp_HL ) ;
gbsButtSizer - > Add ( s_bmp_HL , wxGBPosition ( 0 , 1 ) ) ;
//bottone Hardlock
wxButton * bHlButton = new wxButton ( this , 401 , wxT ( " Hardlock " ) , wxDefaultPosition , wxSize ( 64 , - 1 ) ) ;
gbsButtSizer - > Add ( bHlButton , wxGBPosition ( 0 , 2 ) , wxDefaultSpan , wxALIGN_CENTER_VERTICAL ) ;
//seconda riga della griglia
//Eutron label
AddLabel ( gbsButtSizer , " Installa chiave locale di tipo Eutron " , 1 , 0 ) ;
//Eutron image
2007-12-13 14:49:46 +00:00
wxBitmap bmp_EU ( " ../../campo/servers/eutron.gif " , wxBITMAP_TYPE_GIF ) ;
2007-09-20 09:53:21 +00:00
wxStaticBitmap * s_bmp_EU = new wxStaticBitmap ( this , wxID_ANY , bmp_EU ) ;
gbsButtSizer - > Add ( s_bmp_EU , wxGBPosition ( 1 , 1 ) ) ;
//bottone Eutron
wxButton * bEuButton = new wxButton ( this , 402 , wxT ( " Eutron " ) , wxDefaultPosition , wxSize ( 64 , - 1 ) ) ;
gbsButtSizer - > Add ( bEuButton , wxGBPosition ( 1 , 2 ) , wxDefaultSpan , wxALIGN_CENTER_VERTICAL ) ;
//terza riga della griglia
//Server label
AddLabel ( gbsButtSizer , " Nome o indirizzo IP del server di autorizzazioni " , 2 , 0 ) ;
//nome Server
wxTextCtrl * tcSrvName = new wxTextCtrl ( this , 404 , " " , wxDefaultPosition , wxSize ( 128 , - 1 ) ) ;
gbsButtSizer - > Add ( tcSrvName , wxGBPosition ( 2 , 1 ) ) ;
//bottone Eutron
wxButton * bSrvButton = new wxButton ( this , 403 , wxT ( " Cerca " ) , wxDefaultPosition , wxSize ( 64 , - 1 ) ) ;
gbsButtSizer - > Add ( bSrvButton , wxGBPosition ( 2 , 2 ) , wxDefaultSpan , wxALIGN_CENTER_VERTICAL ) ;
}
/**********************************************************************************************************/
// 5 Scelta tipo installazione
/**********************************************************************************************************/
class CampoWizardPage5 : public CampoWizardPage
{
wxRadioBox * m_pRadioBox ;
protected :
virtual bool ForwardValidate ( ) ;
public :
CampoWizardPage5 ( wxWizard * parent ) ;
} ;
bool CampoWizardPage5 : : ForwardValidate ( )
{
2007-10-18 14:51:26 +00:00
// controlla il tipo di installazione!
2007-12-13 14:49:46 +00:00
InstallationType nType = it_standalone ;
2007-12-03 14:22:50 +00:00
const int nSessionId = GetSessionId ( ) ;
//nessun SessionId -> installazione comune -> selection dal radiobutton
if ( nSessionId = = 0 )
2007-12-13 14:49:46 +00:00
nType = InstallationType ( m_pRadioBox - > GetSelection ( ) + 1 ) ;
2007-12-03 14:22:50 +00:00
else //SessionId != 0 -> Terminal Server -> installazione di tipo Server obbligata!!!
2007-12-13 14:49:46 +00:00
nType = it_server ;
2007-12-03 14:22:50 +00:00
2007-12-13 14:49:46 +00:00
GetWizard ( ) . SetInstallationType ( nType ) ;
2007-09-20 09:53:21 +00:00
return true ;
}
CampoWizardPage5 : : CampoWizardPage5 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
2007-12-03 14:22:50 +00:00
//chiede al sistema se e' in modalita' termserv (win2003/2008srv)
const int nSessionId = GetSessionId ( ) ;
2007-09-20 09:53:21 +00:00
//Istruzioni per l'uso!
wxString strTitle = wxT ( " Scelta del tipo di installazione " ) ;
2007-12-03 14:22:50 +00:00
wxString strBody ;
if ( nSessionId = = 0 )
{
strBody = wxT ( " <p><b>Standard (scelta consigliata)</b>. Installazione su postazione singola, con programmi e dati sul disco locale del computer</p> " ) ;
strBody + = wxT ( " <p><b>Installazioni di rete</b> (per utenti esperti)</p> " ) ;
strBody + = wxT ( " <p><b>Server</b>: Computer in rete sul quale sono presenti una copia, utilizzata o meno, dei programmi (server programmi) e l<> area dati (server dati). " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " In una installazione in rete di <b><i>APPNAMEFULL</i></b> e' necessario sia presente un unica postazione di tipo server, " ) ;
2007-12-03 14:22:50 +00:00
strBody + = wxT ( " e deve essere installata per prima!</p> " ) ;
strBody + = wxT ( " <p><b>Client</b>: Computer in rete sul quale e' presente una copia dei programmi ma non l'area dati. " ) ;
strBody + = wxT ( " I client possono essere installati solo dopo l'installazione del server!</p> " ) ;
}
else
{
strBody + = wxT ( " <p><b>Terminal Server</b>: Computer con sistema operativo tipo Windows 2003/2008 Server. " ) ;
strBody + = wxT ( " L'installazione e' unica e viene utilizzata dagli utenti di sistema quando aprono una sessione sul server.</p> " ) ;
strBody + = wxT ( " <p>Selezionando configurazione Terminal Server <i>e' necessario</i> installare il gestore delle autorizzazioni per " ) ;
strBody + = wxT ( " poter gestire l'accesso contemporaneo di piu' utenti.</p> " ) ;
}
2007-09-20 09:53:21 +00:00
SetHTMLText ( strTitle , strBody ) ;
//radiobutton con i tipi di installazione
wxArrayString asInstType ;
2007-12-03 14:22:50 +00:00
if ( nSessionId = = 0 )
{
asInstType . Add ( " Standard " ) ;
asInstType . Add ( " Server " ) ;
asInstType . Add ( " Client " ) ;
}
else
asInstType . Add ( " Terminal Server " ) ;
2007-09-20 09:53:21 +00:00
m_pRadioBox = new wxRadioBox ( this , 501 , " Selezionare il tipo di installazione " , wxDefaultPosition ,
wxDefaultSize , asInstType , 0 , wxRA_SPECIFY_ROWS ) ;
//setta il default a Standard
m_pRadioBox - > SetSelection ( 0 ) ;
GetSizer ( ) - > Add ( m_pRadioBox ) ;
}
/**********************************************************************************************************/
// 6 Installazione standard
/**********************************************************************************************************/
class CampoWizardPage6 : public CampoWizardPage
{
protected :
DECLARE_EVENT_TABLE ( ) ;
void OnDirPick ( wxCommandEvent & e ) ;
virtual bool ForwardValidate ( ) ;
public :
CampoWizardPage6 ( wxWizard * parent ) ;
} ;
BEGIN_EVENT_TABLE ( CampoWizardPage6 , CampoWizardPage )
EVT_BUTTON ( 602 , OnDirPick )
EVT_BUTTON ( 604 , OnDirPick )
END_EVENT_TABLE ( )
void CampoWizardPage6 : : OnDirPick ( wxCommandEvent & e )
{
const wxWindowID wiTargetField = e . GetId ( ) - 1 ;
wxString strPath = Get ( wiTargetField ) ;
wxDirDialog dlg ( this , wxDirSelectorPromptStr , strPath ,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ) ;
if ( dlg . ShowModal ( ) = = wxID_OK )
{
strPath = dlg . GetPath ( ) ;
Set ( wiTargetField , strPath ) ;
}
}
//metodo per il controllo dell'area dati;se la directory indicata non e' vuota non puoi usarla ne' crearla
bool CampoWizardPage6 : : ForwardValidate ( )
{
//controllo esistenza directory vuota per i programmi in locale
const wxString strPrgLocPath = Get ( 601 ) ;
wxDir dirPrgLocPath ( strPrgLocPath ) ;
if ( dirPrgLocPath . Exists ( Get ( 601 ) ) & & ( dirPrgLocPath . HasFiles ( ) | | dirPrgLocPath . HasSubDirs ( ) ) )
return ErrorBox ( " La cartella selezionata per l'installazione dei programmi NON e' valida! Selezionarne un'altra! " ) ;
const wxString strDataPath = Get ( 603 ) ;
wxDir dirDataPath ( strDataPath ) ;
if ( dirDataPath . Exists ( strDataPath ) & & ( dirDataPath . HasFiles ( ) | | dirDataPath . HasSubDirs ( ) ) )
return ErrorBox ( " La cartella indicata per la creazione dell'area dati non e' vuota! Selezionarne un'altra! " ) ;
//setta alla pagina riassuntiva i valori della pagina attuale...
GetWizard ( ) . SetPrgLocPath ( strPrgLocPath ) ;
GetWizard ( ) . SetDataPath ( strDataPath ) ;
//...e pure quegli stupidi datidemo che nessuno ha mai installato!!
const bool bInstDemoData = GetBool ( 605 ) ;
GetWizard ( ) . SetInstDemoData ( bInstDemoData ) ;
return true ;
}
CampoWizardPage6 : : CampoWizardPage6 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
wxString strTitle = wxT ( " Installazione di tipo Standard " ) ;
wxString strBody = wxT ( " <p>Digitare nel campo <b>'Cartella programma'</b> il percorso completo della cartella dove si desidera installare il programma. " ) ;
strBody + = wxT ( " Il percorso di default (consigliato) e' <i>C: \\ APPNAME</i> </p> " ) ;
strBody + = wxT ( " <p>Digitare nel campo <b>'Cartella Dati'</b> il percorso completo della cartella dove si desidera installare l'area dati. " ) ;
strBody + = wxT ( " Il percorso di default (consigliato) e' <i>C: \\ APPNAME \\ dati</i> </p> " ) ;
2007-09-28 10:22:37 +00:00
/*strBody += wxT("<p><b>Dati dimostrativi:</b> area dati precompilata per installazioni di tipo dimostrativo del funzionamento del software. ");
strBody + = wxT ( " <b>NON</b> vanno caricati nel caso di una normale installazione!</p> " ) ; */
2007-09-20 09:53:21 +00:00
SetHTMLText ( strTitle , strBody ) ;
//griglia per sistemare i campi
wxGridBagSizer * gbsSizer = new wxGridBagSizer ( VGAP , HGAP ) ;
GetSizer ( ) - > Add ( gbsSizer ) ;
//prima riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella programmi " , 0 , 0 ) ;
//campo testo
wxString strPath ;
strPath = " C: \\ " ;
strPath + = APPNAME ;
wxTextCtrl * tcPrgPath = new wxTextCtrl ( this , 601 , strPath , wxDefaultPosition , wxSize ( 320 , - 1 ) ) ;
gbsSizer - > Add ( tcPrgPath , wxGBPosition ( 0 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bPrgButton = new wxButton ( this , 602 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bPrgButton , wxGBPosition ( 0 , 2 ) ) ;
//seconda riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella dati " , 1 , 0 ) ;
//campo testo
strPath + = " /dati " ;
wxTextCtrl * tcDataPath = new wxTextCtrl ( this , 603 , strPath , wxDefaultPosition , wxSize ( 320 , - 1 ) ) ;
gbsSizer - > Add ( tcDataPath , wxGBPosition ( 1 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bDataButton = new wxButton ( this , 604 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bDataButton , wxGBPosition ( 1 , 2 ) ) ;
2007-09-28 10:22:37 +00:00
//terza riga della griglia ***per ora i datidemo li installiamo solo con la demo (anzi,per sempre)
/* wxCheckBox* chDataDemo = new wxCheckBox(this, 605, wxT("Carica i dati dimostrativi"));
2007-09-20 09:53:21 +00:00
chDataDemo - > SetValue ( false ) ;
2007-09-28 10:22:37 +00:00
gbsSizer - > Add ( chDataDemo , wxGBPosition ( 2 , 1 ) ) ; */
2007-09-20 09:53:21 +00:00
}
/**********************************************************************************************************/
// 7 Installazione server
/**********************************************************************************************************/
class CampoWizardPage7 : public CampoWizardPage
{
wxRadioBox * m_pRadioBox ;
protected :
DECLARE_EVENT_TABLE ( ) ;
virtual bool ForwardValidate ( ) ;
void OnDirPick ( wxCommandEvent & e ) ;
void OnSrvClick ( wxCommandEvent & e ) ;
public :
CampoWizardPage7 ( wxWizard * parent ) ;
} ;
BEGIN_EVENT_TABLE ( CampoWizardPage7 , CampoWizardPage )
EVT_BUTTON ( 702 , OnDirPick )
EVT_BUTTON ( 704 , OnDirPick )
EVT_CHECKBOX ( 705 , OnSrvClick )
EVT_CHECKBOX ( 707 , OnSrvClick )
END_EVENT_TABLE ( )
void CampoWizardPage7 : : OnDirPick ( wxCommandEvent & e )
{
const wxWindowID wiTargetField = e . GetId ( ) - 1 ;
wxString strPath = Get ( wiTargetField ) ;
wxDirDialog dlg ( this , wxDirSelectorPromptStr , strPath ,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ) ;
if ( dlg . ShowModal ( ) = = wxID_OK )
{
strPath = dlg . GetPath ( ) ;
Set ( wiTargetField , strPath ) ;
}
}
void CampoWizardPage7 : : OnSrvClick ( wxCommandEvent & e )
{
//nome del server
wxWindow * pWnd = FindWindowById ( e . GetId ( ) + 1 ) ;
if ( pWnd )
pWnd - > Enable ( e . IsChecked ( ) ) ;
//tipo installazione server
pWnd = FindWindowById ( 709 ) ;
if ( pWnd )
pWnd - > Enable ( GetBool ( 705 ) | | GetBool ( 707 ) ) ;
}
bool CampoWizardPage7 : : ForwardValidate ( )
{
//controllo esistenza directory vuota per i programmi in locale
const wxString strPrgLocPath = Get ( 701 ) ;
wxDir dirPrgLocPath ( strPrgLocPath ) ;
if ( dirPrgLocPath . Exists ( strPrgLocPath ) & & ( dirPrgLocPath . HasFiles ( ) | | dirPrgLocPath . HasSubDirs ( ) ) )
return ErrorBox ( " La cartella selezionata per l'installazione dei programmi NON e' valida! Selezionarne un'altra! " ) ;
//controllo della directory dell'area dati: deve essere nuova o vuota affinche' possa essere utilizzata!!
const wxString strDataPath = Get ( 703 ) ;
wxDir dirDataPath ( strDataPath ) ;
if ( dirDataPath . Exists ( strDataPath ) & & ( dirDataPath . HasFiles ( ) | | dirDataPath . HasSubDirs ( ) ) )
return ErrorBox ( " La cartella indicata per la creazione dell'area dati non e' vuota! Selezionarne un'altra! " ) ;
//setta alla pagina riassuntiva i valori della pagina attuale...
GetWizard ( ) . SetPrgLocPath ( strPrgLocPath ) ;
GetWizard ( ) . SetDataPath ( strDataPath ) ;
//...compresi eventuali stupidi servers!
const bool bInstAuth = GetBool ( 705 ) ;
if ( bInstAuth )
{
GetWizard ( ) . SetInstUseAuth ( bInstAuth ) ;
const wxString strSrvAuth = Get ( 706 ) ;
if ( strSrvAuth . IsEmpty ( ) )
return ErrorBox ( " Specificare il server gestore delle autorizzazioni! " ) ;
GetWizard ( ) . SetSrvAuth ( strSrvAuth ) ;
}
else
GetWizard ( ) . SetSrvAuth ( " " ) ;
const bool bInstDict = GetBool ( 707 ) ;
if ( bInstDict )
{
GetWizard ( ) . SetInstUseDict ( bInstDict ) ;
const wxString strSrvDict = Get ( 708 ) ;
if ( strSrvDict . IsEmpty ( ) )
return ErrorBox ( " Specificare il server gestore dei dizionari! " ) ;
GetWizard ( ) . SetSrvDict ( strSrvDict ) ;
}
else
GetWizard ( ) . SetSrvDict ( " " ) ;
//..e loro modalita' di esecuzione
if ( bInstAuth | | bInstDict )
{
2007-12-03 14:40:08 +00:00
int nType = m_pRadioBox - > GetSelection ( ) + 1 ; //+1 perch<63> 0 corrisponde a lm_none
2007-10-18 14:51:26 +00:00
GetWizard ( ) . SetSrvAutostartMode ( ( LurchMode ) nType ) ;
2007-09-20 09:53:21 +00:00
}
else
2007-10-18 14:51:26 +00:00
GetWizard ( ) . SetSrvAutostartMode ( lm_none ) ;
2007-09-20 09:53:21 +00:00
return true ;
}
CampoWizardPage7 : : CampoWizardPage7 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
2007-12-03 14:22:50 +00:00
const int nSessionId = GetSessionId ( ) ;
wxString strTitle ;
wxString strBody ;
if ( nSessionId = = 0 )
{
strTitle = wxT ( " Installazione di tipo Server " ) ;
strBody = wxT ( " <p>Digitare nel campo <b>'Cartella programma'</b> il percorso completo della cartella dove si desidera installare il programma. " ) ;
strBody + = wxT ( " Il percorso consigliato e' <i>C: \\ APPNAME</i> </p> " ) ;
strBody + = wxT ( " <p>Digitare nel campo <b>'Cartella dati'</b> il percorso completo della cartella dove si desidera installare l'area dati. " ) ;
strBody + = wxT ( " Il percorso consigliato e' <i>C: \\ APPNAME \\ dati</i> </p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>Le cartelle del programma e dei dati <b><u>dovranno essere condivise in modalita' lettura/scrittura</u></b> agli utenti di sistema e di rete che utilizzeranno il software <b><i>APPNAMEFULL</i></b>. " ) ;
2007-12-03 14:22:50 +00:00
strBody + = wxT ( " In mancanza di tale condivisione nessun client potra' accedere al server!</p> " ) ;
strBody + = wxT ( " <p><b>Gestore autorizzazioni:</b> e' il software che permette di gestire una chiave di protezione hardware multiutenza condivisa in rete. " ) ;
strBody + = wxT ( " Installando tale software e' necessario specificare il computer su cui e' montata la chiave di protezione multiutenza. " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " Viene di default proposto il computer su cui si sta eseguendo l'installazione di APPNAMEFULL (localhost).</p> " ) ;
strBody + = wxT ( " <p><b>Gestore dizionari:</b> e' il software che permette di utilizzare APPNAMEFULL in lingue diverse dall'italiano. " ) ;
strBody + = wxT ( " Per l'installazione di questo software viene di default proposto il computer su cui si sta eseguendo l'installazione di APPNAMEFULL (localhost).</p> " ) ;
2007-12-03 14:22:50 +00:00
strBody + = wxT ( " <p><b>Modalita' di esecuzione programmi di gestione</b><br> " ) ;
strBody + = wxT ( " <u>Come servizi:</u> i programmi di gestione vengono eseguiti come servizi di Windows; questa e' la modalita' consigliata ed e' obbligatoria in caso di installazione con Windows 2003/2008<br> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <u>Nel menu esecuzione automatica:</u> i programmi di gestione vengono eseguiti automaticamente al primo accesso di un utente al server di APPNAMEFULL; usare questa modalita' solo nell'impossibilita' di utilizzare la precedente</p> " ) ;
2007-12-03 14:22:50 +00:00
}
else
{
strTitle = wxT ( " Installazione di tipo Terminal Server " ) ;
strBody = wxT ( " <p>Digitare nel campo <b>'Cartella programma'</b> il percorso completo della cartella dove si desidera installare il programma. " ) ;
strBody + = wxT ( " Il percorso consigliato e' <i>C: \\ APPNAME</i> </p> " ) ;
strBody + = wxT ( " <p>Digitare nel campo <b>'Cartella dati'</b> il percorso completo della cartella dove si desidera installare l'area dati. " ) ;
strBody + = wxT ( " Il percorso consigliato e' <i>C: \\ APPNAME \\ dati</i> </p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>Le cartelle del programma e dei dati <b><u>dovranno essere accessibili in modalita' lettura/scrittura</u></b> agli utenti di sistema e di rete che utilizzeranno il software <b><i>APPNAMEFULL</i></b>. " ) ;
strBody + = wxT ( " In mancanza di tale modalita' nessun utente potra' utilizzare il software <b><i>APPNAMEFULL</i></b> !</p> " ) ;
2007-12-03 14:22:50 +00:00
strBody + = wxT ( " <p><b>Gestore autorizzazioni:</b> e' il software che permette di gestire una chiave di protezione hardware multiutenza condivisa in rete. " ) ;
strBody + = wxT ( " E' <b>necessario</b> installare questo software specificando <i>localhost</i> come computer su cui e' montata la chiave di protezione multiutenza.</p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p><b>Gestore dizionari:</b> e' il software che permette di utilizzare APPNAMEFULL in lingue diverse dall'italiano. " ) ;
2007-12-03 14:22:50 +00:00
strBody + = wxT ( " E' <b>necessario</b> installare questo software specificando <i>localhost</i> come computer su cui installare il servizio.</p> " ) ;
strBody + = wxT ( " <p><b>Modalita' di esecuzione programmi di gestione:</b> <i><u>obbligatorio come servizi</u></i>!<br> " ) ;
}
2007-09-20 09:53:21 +00:00
SetHTMLText ( strTitle , strBody ) ;
//griglia per sistemare i campi
wxGridBagSizer * gbsSizer = new wxGridBagSizer ( VGAP , HGAP ) ;
GetSizer ( ) - > Add ( gbsSizer ) ;
//prima riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella programmi " , 0 , 0 ) ;
//campo testo
wxString strPath ;
strPath = " C: \\ " ;
strPath + = APPNAME ;
wxTextCtrl * tcPrgPath = new wxTextCtrl ( this , 701 , strPath , wxDefaultPosition , wxSize ( 320 , - 1 ) ) ;
gbsSizer - > Add ( tcPrgPath , wxGBPosition ( 0 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bPrgButton = new wxButton ( this , 702 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bPrgButton , wxGBPosition ( 0 , 2 ) ) ;
//seconda riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella dati " , 1 , 0 ) ;
//campo testo
strPath + = " /dati " ;
wxTextCtrl * tcDataPath = new wxTextCtrl ( this , 703 , strPath , wxDefaultPosition , wxSize ( 320 , - 1 ) ) ;
gbsSizer - > Add ( tcDataPath , wxGBPosition ( 1 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bDataButton = new wxButton ( this , 704 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bDataButton , wxGBPosition ( 1 , 2 ) ) ;
//terza riga della griglia
//check installa authoriz
wxCheckBox * chAuthoriz = new wxCheckBox ( this , 705 , wxT ( " Installa il gestore delle autorizzazioni " ) ) ;
2007-12-03 14:22:50 +00:00
//e' obbligatorio installare authoriz in caso di terminal server!
if ( nSessionId = = 0 )
chAuthoriz - > SetValue ( false ) ;
else
chAuthoriz - > SetValue ( true ) ;
2007-09-20 09:53:21 +00:00
gbsSizer - > Add ( chAuthoriz , wxGBPosition ( 2 , 1 ) ) ;
//server authoriz
wxTextCtrl * tcAuthoriz = new wxTextCtrl ( this , 706 , " localhost " , wxDefaultPosition , wxSize ( 96 , - 1 ) ) ;
tcAuthoriz - > Disable ( ) ;
gbsSizer - > Add ( tcAuthoriz , wxGBPosition ( 2 , 2 ) ) ;
//quarta riga della griglia
//check installa diction
wxCheckBox * chDictionary = new wxCheckBox ( this , 707 , wxT ( " Installa il gestore dei dizionari " ) ) ;
chDictionary - > SetValue ( false ) ;
gbsSizer - > Add ( chDictionary , wxGBPosition ( 3 , 1 ) ) ;
//server diction
wxTextCtrl * tcDiction = new wxTextCtrl ( this , 708 , " localhost " , wxDefaultPosition , wxSize ( 96 , - 1 ) ) ;
tcDiction - > Disable ( ) ;
gbsSizer - > Add ( tcDiction , wxGBPosition ( 3 , 2 ) ) ;
//quinta riga della griglia
//radiobutton con i tipi di installazione
2007-12-03 14:22:50 +00:00
wxArrayString asInstType ;
if ( nSessionId = = 0 )
{
asInstType . Add ( " Come servizi (consigliato) " ) ;
asInstType . Add ( " Nel menu esecuzione automatica " ) ;
}
else
asInstType . Add ( " Come servizi (obbligatorio) " ) ;
2007-09-20 09:53:21 +00:00
m_pRadioBox = new wxRadioBox ( this , 709 , " Modalita' di esecuzione gestori " , wxDefaultPosition ,
2007-12-03 14:22:50 +00:00
wxDefaultSize , asInstType , 0 , wxRA_SPECIFY_COLS ) ;
2007-09-20 09:53:21 +00:00
//setta il default a "come servizio"
m_pRadioBox - > SetSelection ( 0 ) ;
m_pRadioBox - > Disable ( ) ;
gbsSizer - > Add ( m_pRadioBox , wxGBPosition ( 4 , 1 ) ) ;
}
/**********************************************************************************************************/
// 8 Installazione client
/**********************************************************************************************************/
class CampoWizardPage8 : public CampoWizardPage
{
protected :
DECLARE_EVENT_TABLE ( ) ;
virtual bool ForwardValidate ( ) ;
virtual bool TransferDataToWindow ( ) ;
void OnDirPick ( wxCommandEvent & e ) ;
void OnSrvClick ( wxCommandEvent & e ) ;
public :
CampoWizardPage8 ( wxWizard * parent ) ;
} ;
BEGIN_EVENT_TABLE ( CampoWizardPage8 , CampoWizardPage )
EVT_BUTTON ( 802 , OnDirPick )
EVT_BUTTON ( 804 , OnDirPick )
EVT_BUTTON ( 806 , OnDirPick )
EVT_CHECKBOX ( 807 , OnSrvClick )
END_EVENT_TABLE ( )
void CampoWizardPage8 : : OnDirPick ( wxCommandEvent & e )
{
const wxWindowID wiTargetField = e . GetId ( ) - 1 ;
wxString strPath = Get ( wiTargetField ) ;
wxDirDialog dlg ( this , wxDirSelectorPromptStr , strPath ,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ) ;
if ( dlg . ShowModal ( ) = = wxID_OK )
{
strPath = dlg . GetPath ( ) ;
Set ( wiTargetField , strPath ) ;
}
}
void CampoWizardPage8 : : OnSrvClick ( wxCommandEvent & e )
{
wxWindow * pWnd = FindWindowById ( e . GetId ( ) + 1 ) ;
if ( pWnd )
pWnd - > Enable ( e . IsChecked ( ) ) ;
}
bool CampoWizardPage8 : : TransferDataToWindow ( )
{
2007-12-13 14:49:46 +00:00
bool bNoPrg = Get ( 803 ) . IsEmpty ( ) ;
bool bNoData = Get ( 805 ) . IsEmpty ( ) ;
if ( bNoPrg | | bNoData )
{
//cerca le unita' condivise in rete
wxArrayString asList ;
const size_t nShared = ListNetworkDisks ( asList ) ;
//se ne trova controlla se sono valide come directory di programmi e dati
for ( size_t i = 0 ; i < nShared ; i + + )
{
wxString strWrk = asList [ i ] ;
if ( ! wxEndsWithPathSeparator ( strWrk ) )
strWrk < < wxFILE_SEP_PATH ;
UINT nDriveType = GetDriveType ( strWrk ) ;
if ( nDriveType = = DRIVE_REMOTE )
{
if ( bNoPrg & & CheckPrgDir ( strWrk ) )
{
bNoPrg = false ;
Set ( 803 , strWrk ) ;
}
if ( bNoData & & CheckDataDir ( strWrk ) )
{
bNoData = false ;
Set ( 805 , strWrk ) ;
}
}
} //for(size_t...
} //if(noPrg...
2007-09-20 09:53:21 +00:00
return true ;
}
bool CampoWizardPage8 : : ForwardValidate ( )
{
2007-10-18 11:13:15 +00:00
//controlli su directory selezionate
//1) directory di installazione programmi
const wxString strPrgLocPath = Get ( 801 ) ;
//la directory di installazione programmi deve essere su un disco locale (sei un client!)
2008-11-19 14:19:37 +00:00
UINT nPrgDriveType = : : GetDriveType ( strPrgLocPath . Left ( 3 ) ) ;
2007-10-18 11:13:15 +00:00
if ( nPrgDriveType ! = DRIVE_FIXED )
return ErrorBox ( " La cartella selezionata per l'installazione dei programmi deve trovarsi su un disco locale! " ) ;
2007-09-20 09:53:21 +00:00
//controllo esistenza directory vuota per i programmi in locale
wxDir dirPrgLocPath ( strPrgLocPath ) ;
if ( dirPrgLocPath . Exists ( strPrgLocPath ) & & ( dirPrgLocPath . HasFiles ( ) | | dirPrgLocPath . HasSubDirs ( ) ) )
return ErrorBox ( " La cartella selezionata per l'installazione dei programmi NON e' valida! Selezionarne un'altra! " ) ;
2007-10-18 11:13:15 +00:00
//2) directory di origine dei programmi sul server
2007-09-20 09:53:21 +00:00
const wxString strPrgNetPath = Get ( 803 ) ;
2008-11-19 14:19:37 +00:00
//il server non puo' essere un cd o roba simile
UINT nPrgNetDriveType = : : GetDriveType ( strPrgNetPath . Left ( 3 ) ) ;
if ( nPrgNetDriveType ! = DRIVE_REMOTE )
return ErrorBox ( " Il server deve essere su un disco di rete! " ) ;
//il server deve contenere i programmi di Campo gia<69> installati correttamente
2007-10-03 15:34:32 +00:00
if ( ! CheckPrgDir ( strPrgNetPath ) )
2007-09-20 09:53:21 +00:00
return ErrorBox ( " La cartella selezionata come origine dei programmi NON e' valida! " ) ;
2007-10-18 11:13:15 +00:00
//3) directory dati sul server
2007-10-03 15:34:32 +00:00
const wxString strDataPath = Get ( 805 ) ;
2007-10-18 11:13:15 +00:00
//la cartella dei dati deve essere in remoto,senno' sei una postazione locale o un server
2008-11-19 14:19:37 +00:00
UINT nDataDriveType = : : GetDriveType ( strDataPath . Left ( 3 ) ) ;
2007-10-18 11:13:15 +00:00
if ( nDataDriveType ! = DRIVE_REMOTE )
return ErrorBox ( " La cartella dei dati deve trovarsi su un server remoto e non su un disco locale! " ) ;
//la cartella dei dati deve contenerli ed essere scrivibile
2007-09-20 09:53:21 +00:00
if ( ! CheckDataDir ( strDataPath ) )
2007-10-03 15:34:32 +00:00
return ErrorBox ( " La cartella selezionata come area dati NON e' valida o non accessibile in scrittura! " ) ;
2007-09-20 09:53:21 +00:00
2007-10-18 11:13:15 +00:00
2007-09-20 09:53:21 +00:00
//setta alla pagina riassuntiva i valori della pagina attuale
GetWizard ( ) . SetPrgLocPath ( strPrgLocPath ) ;
GetWizard ( ) . SetPrgNetPath ( strPrgNetPath ) ;
GetWizard ( ) . SetDataPath ( strDataPath ) ;
//...compresi eventuali stupidi servers!
const wxString strSrvDict = Get ( 807 ) ;
//se c'e' un nome di dictionary server e non lo trova si incazza
if ( ! strSrvDict . IsEmpty ( ) & & ! DictionaryLogin ( strSrvDict ) )
{
wxString strMsg ;
strMsg < < " Impossibile contattare il server " < < strSrvDict < < " per la gestione dei dizionari! " ;
return ErrorBox ( strMsg ) ;
}
else
GetWizard ( ) . SetSrvDict ( strSrvDict ) ;
return true ;
}
CampoWizardPage8 : : CampoWizardPage8 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
wxString strTitle = wxT ( " Installazione di tipo Client " ) ;
wxString strBody = wxT ( " <p>Digitare nel campo <b>'Cartella locale programma'</b> il percorso completo della cartella dove si desidera installare il programma. " ) ;
strBody + = wxT ( " Il percorso consigliato e' <i>C: \\ APPNAME</i> </p> " ) ;
2007-12-13 14:49:46 +00:00
strBody + = wxT ( " <p>Il campo <b>'Cartella remota origine programmi'</b> contiene il percorso completo della cartella di rete dove sono i files origine del programma. " ) ;
strBody + = wxT ( " E' la cartella di programmi condivisa dal server precedentemente installato. Se condivisa e connessa correttamente viene rilevata automaticamente e proposta dal programma. " ) ;
strBody + = wxT ( " Se non viene proposta automaticamente, digitare il percorso completo (es. <i><b>Z: \\ APPNAME</b></i>)</p> " ) ;
strBody + = wxT ( " <p>Il campo <b>'Cartella remota dati da utilizzare'</b> contiene il percorso completo della cartella di rete dove sono i dati. " ) ;
strBody + = wxT ( " E' la cartella dei dati condivisa dal server precedentemente installato. Se condivisa e connessa correttamente viene rilevata automaticamente e proposta dal programma. " ) ;
strBody + = wxT ( " Se non viene proposta automaticamente, digitare il percorso completo (es. <i><b>Z: \\ APPNAME \\ Dati</b></i>)</p> " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p><b>Gestore dizionari:</b> e' il computer gestore dei dizionari di APPNAMEFULL in lingue diverse dall'italiano. Generalmente e' il computer agente da server di APPNAMEFULL in rete. " ) ;
2007-09-20 09:53:21 +00:00
strBody + = wxT ( " Premere il bottone <u>Cerca</u> per attivare la ricerca automatica di tale computer. Qualora tale ricerca fallisse digitare il nome del computer gestore dei dizionari</p> " ) ;
SetHTMLText ( strTitle , strBody ) ;
//griglia per sistemare i campi
wxGridBagSizer * gbsSizer = new wxGridBagSizer ( VGAP , HGAP ) ;
GetSizer ( ) - > Add ( gbsSizer ) ;
//prima riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella locale programma " , 0 , 0 ) ;
//campo testo
wxString strPath ;
strPath = " C: \\ " ;
strPath + = APPNAME ;
wxTextCtrl * tcDestPrgPath = new wxTextCtrl ( this , 801 , strPath , wxDefaultPosition , wxSize ( 256 , - 1 ) ) ;
gbsSizer - > Add ( tcDestPrgPath , wxGBPosition ( 0 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bDestPrgButton = new wxButton ( this , 802 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bDestPrgButton , wxGBPosition ( 0 , 2 ) ) ;
//seconda riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella remota origine programmi " , 1 , 0 ) ;
//campo testo
2007-12-13 14:49:46 +00:00
wxTextCtrl * tcSrcPrgPath = new wxTextCtrl ( this , 803 , " " , wxDefaultPosition , wxSize ( 256 , - 1 ) ) ;
2007-09-20 09:53:21 +00:00
gbsSizer - > Add ( tcSrcPrgPath , wxGBPosition ( 1 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bSrcPrgButton = new wxButton ( this , 804 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bSrcPrgButton , wxGBPosition ( 1 , 2 ) ) ;
//terza riga della griglia
//prompt
AddLabel ( gbsSizer , " Cartella remota dati da utilizzare " , 2 , 0 ) ;
//campo testo
2007-12-13 14:49:46 +00:00
wxTextCtrl * tcDataPath = new wxTextCtrl ( this , 805 , " " , wxDefaultPosition , wxSize ( 256 , - 1 ) ) ;
2007-09-20 09:53:21 +00:00
gbsSizer - > Add ( tcDataPath , wxGBPosition ( 2 , 1 ) ) ;
//bottone 'sfoglia'
wxButton * bDataButton = new wxButton ( this , 806 , wxT ( " Sfoglia " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bDataButton , wxGBPosition ( 2 , 2 ) ) ;
//terza riga della griglia
//Server dizionari label
AddLabel ( gbsSizer , " Nome o indirizzo IP del server dei dizionari " , 3 , 0 ) ;
//nome Server dizionari
wxTextCtrl * tcSrvName = new wxTextCtrl ( this , 807 , " " , wxDefaultPosition , wxSize ( 256 , - 1 ) ) ;
gbsSizer - > Add ( tcSrvName , wxGBPosition ( 3 , 1 ) ) ;
//bottone Cerca
wxButton * bSrvButton = new wxButton ( this , 808 , wxT ( " Cerca " ) , wxDefaultPosition , wxSize ( 48 , - 1 ) ) ;
gbsSizer - > Add ( bSrvButton , wxGBPosition ( 3 , 2 ) , wxDefaultSpan , wxALIGN_CENTER_VERTICAL ) ;
}
/**********************************************************************************************************/
2008-11-24 11:09:05 +00:00
// 9 pagina con la creazione icona sul desktop, lanciatore del lurch e installatore teleassistenza
2007-09-20 09:53:21 +00:00
/**********************************************************************************************************/
class CampoWizardPage9 : public CampoWizardPage
{
protected :
virtual bool TransferDataToWindow ( ) ;
virtual bool ForwardValidate ( ) ;
public :
CampoWizardPage9 ( wxWizard * parent ) ;
} ;
bool CampoWizardPage9 : : TransferDataToWindow ( )
{
2007-10-04 13:21:29 +00:00
//setta il checkbox del link
Set ( 901 , GetWizard ( ) . GetDesktopShortcut ( ) ) ;
//controlla se il programma di teleassistenza e' gia' installato sul computer e decide se spuntare o meno..
//..il checkbox
bool bChkTeleass = true ;
const wxString strWinProgDir = GetWindowsProgramDirectory ( ) ;
wxString strUVNCDir = strWinProgDir + " /UltraVNC " ;
wxDir dirUVNCDir ( strUVNCDir ) ;
if ( dirUVNCDir . Exists ( strUVNCDir ) )
{
wxFileName fnFileToCheck ( strUVNCDir , " winvnc " ) ;
fnFileToCheck . SetExt ( " exe " ) ;
if ( fnFileToCheck . FileExists ( ) )
2007-10-04 14:46:14 +00:00
bChkTeleass = false ;
2007-10-04 13:21:29 +00:00
}
Set ( 902 , bChkTeleass ) ;
return true ;
2007-09-20 09:53:21 +00:00
}
bool CampoWizardPage9 : : ForwardValidate ( )
{
2007-10-04 13:21:29 +00:00
//link sul desktop
2007-09-20 09:53:21 +00:00
const bool bDesktopShortcut = GetBool ( 901 ) ;
GetWizard ( ) . SetDesktopShortcut ( bDesktopShortcut ) ;
2007-10-04 13:21:29 +00:00
//installazione programma teleassistenza
const bool bInstallTeleass = GetBool ( 902 ) ;
if ( bInstallTeleass )
{
2007-10-16 13:52:19 +00:00
wxString strPath ( " ../../teleassistenza/UltraVNC-102-Setup.exe " ) ;
2007-10-04 13:21:29 +00:00
wxExecute ( strPath , wxEXEC_SYNC ) ;
}
2007-09-20 09:53:21 +00:00
return true ;
}
CampoWizardPage9 : : CampoWizardPage9 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
2008-11-24 11:09:05 +00:00
//l'installatore della teleassistenza ci va solo nella versione AGA;quindi controlla il producer nell'install.ini...
//..che c'<27> appena sopra di lui in program
const bool bIsAgaVersion = IsAgaVersion ( " ../install.ini " ) ;
2007-10-04 13:21:29 +00:00
wxString strTitle = wxT ( " Collegamenti e Teleassistenza " ) ;
2007-09-20 09:53:21 +00:00
wxString strBody ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " <p>E' possibile creare l'icona di APPNAMEFULL sul desktop.</p> " ) ;
2008-11-24 11:09:05 +00:00
if ( bIsAgaVersion )
{
strBody + = wxT ( " <p>E' possibile installare il programma di teleassistenza. E' il software che consente " ) ;
2008-11-28 10:59:10 +00:00
strBody + = wxT ( " ai tecnici dell'assistenza di controllare il computer su cui si installa APPNAMEFULL in caso di problemi gravi. " ) ;
2008-11-24 11:09:05 +00:00
strBody + = wxT ( " Se la casella risulta NON spuntata in automatico il programma di teleassistenza e' gia' presente " ) ;
strBody + = wxT ( " sul computer e non deve essere reinstallato.</p> " ) ;
}
2007-09-20 09:53:21 +00:00
SetHTMLText ( strTitle , strBody ) ;
wxCheckBox * pIcon = new wxCheckBox ( this , 901 , wxT ( " Creare l'icona sul desktop " ) ) ;
GetSizer ( ) - > Add ( pIcon , 0 , wxALL , 0 ) ;
2007-10-04 13:21:29 +00:00
GetSizer ( ) - > AddSpacer ( 10 ) ;
wxCheckBox * pTeleass = new wxCheckBox ( this , 902 , wxT ( " Installare il programma di teleassistenza " ) ) ;
GetSizer ( ) - > Add ( pTeleass , 0 , wxALL , 0 ) ;
2008-11-24 11:09:05 +00:00
if ( ! bIsAgaVersion )
pTeleass - > Hide ( ) ;
2007-09-20 09:53:21 +00:00
//wxCheckBox* pLink = new wxCheckBox(this, 1002, wxT("Associare i file .caz al programma"));
//pLink->SetValue(true);
//GetSizer()->Add(pLink, 0, wxALL, 0);
}
/**********************************************************************************************************/
// 10 pagina con la selezione di destinazione
/**********************************************************************************************************/
class CampoWizardPage10 : public CampoWizardPage
{
2007-10-18 14:51:26 +00:00
InstallationType _uInstallType ;
2007-09-20 09:53:21 +00:00
wxString _strInstallType ;
wxString _strPrgLocPath ;
wxString _strPrgNetPath ;
wxString _strDataPath ;
wxString _strSrvAuth ;
wxString _strSrvDict ;
unsigned int _iSrvAutostartMode ;
bool _bInstDemoData ;
bool _bInstDemoVersion ;
bool _bDesktopShortcut ;
protected :
virtual bool TransferDataToWindow ( ) ;
public :
CampoWizardPage10 ( wxWizard * parent ) ;
} ;
bool CampoWizardPage10 : : TransferDataToWindow ( )
{
CampoWizard & cw = GetWizard ( ) ;
_uInstallType = cw . GetInstallationType ( ) ;
switch ( _uInstallType )
{
2007-10-18 14:51:26 +00:00
case it_server : //server
2007-12-03 14:22:50 +00:00
if ( GetSessionId ( ) > 0 )
_strInstallType = " Terminal Server " ;
else
_strInstallType = " Server " ;
2007-09-20 09:53:21 +00:00
_strPrgLocPath = cw . GetPrgLocPath ( ) ;
_strDataPath = cw . GetDataPath ( ) ;
_strSrvAuth = cw . GetSrvAuth ( ) ;
_strSrvDict = cw . GetSrvDict ( ) ;
if ( ! _strSrvAuth . IsEmpty ( ) | | ! _strSrvDict . IsEmpty ( ) )
_iSrvAutostartMode = cw . GetSrvAutostartMode ( ) ;
break ;
2007-10-18 14:51:26 +00:00
case it_client : //client
2007-09-20 09:53:21 +00:00
_strInstallType = " Client " ;
_strPrgLocPath = cw . GetPrgLocPath ( ) ;
_strPrgNetPath = cw . GetPrgNetPath ( ) ;
_strDataPath = cw . GetDataPath ( ) ;
_strSrvAuth = cw . GetSrvAuth ( ) ;
_strSrvDict = cw . GetSrvDict ( ) ;
break ;
2007-10-18 14:51:26 +00:00
case it_upgrade : //aggiornamento
2007-09-20 09:53:21 +00:00
_strInstallType = " " ;
_strPrgLocPath = cw . GetDestinationPath ( ) ;
_strDataPath = cw . GetDataPath ( ) ;
_strSrvAuth = cw . GetSrvAuth ( ) ;
_strSrvDict = cw . GetSrvDict ( ) ;
break ;
default : //standard
if ( cw . GetInstDemoVersion ( ) )
{
_strInstallType = " DEMO " ;
_strPrgLocPath = " c:/campodemo " ;
}
else
{
_strInstallType = " Standard " ;
_strPrgLocPath = cw . GetPrgLocPath ( ) ;
_strDataPath = cw . GetDataPath ( ) ;
_bInstDemoData = cw . GetInstDemoData ( ) ;
}
break ;
}
//questo vale per tutti
_bDesktopShortcut = cw . GetDesktopShortcut ( ) ;
//se installazione o aggiornamento cambia sia il titolo che i contenuti
wxString strTitle ;
wxString strBody ;
//Aggiornamento
2007-10-18 14:51:26 +00:00
if ( _uInstallType = = it_upgrade )
2007-09-20 09:53:21 +00:00
{
strTitle + = wxT ( " AGGIORNAMENTO: riepilogo configurazione " ) ;
strBody = wxT ( " <p>Cartella programma da aggiornare: " ) ;
strBody + = wxT ( Bold ( _strPrgLocPath ) + " </p> " ) ;
strBody + = wxT ( " <p>Cartella dati in uso: " ) ;
strBody + = wxT ( Bold ( _strDataPath ) + " </p> " ) ;
}
else //Installazione
{
strTitle + = wxT ( " INSTALLAZIONE: riepilogo configurazione " ) ;
//DEMO (aaarrgh!)
if ( cw . GetInstDemoVersion ( ) )
{
strBody = wxT ( " <p>Tipo installazione selezionata: " ) ;
strBody + = wxT ( " <b>DEMO</b></p> " ) ;
strBody + = wxT ( " <p>Cartella dove installare il programma: " ) ;
strBody + = wxT ( " <b>C:/campodemo</b></p> " ) ;
}
else //tutte le altre
{
strBody = wxT ( " <p>Tipo installazione selezionata: " ) ;
strBody + = wxT ( Bold ( _strInstallType ) + " </p> " ) ;
strBody + = wxT ( " <p>Cartella dove installare il programma: " ) ;
strBody + = wxT ( Bold ( _strPrgLocPath ) + " </p> " ) ;
2007-12-03 14:22:50 +00:00
if ( _uInstallType = = it_client )
2007-09-20 09:53:21 +00:00
{
strBody + = wxT ( " <p>Cartella di origine dei files del programma: " ) ;
strBody + = wxT ( Bold ( _strPrgNetPath ) + " </p> " ) ;
2007-10-03 15:34:32 +00:00
strBody + = wxT ( " <p>Cartella dati da utilizzare: " ) ;
strBody + = wxT ( Bold ( _strDataPath ) + " </p> " ) ;
}
else
{
strBody + = wxT ( " <p>Cartella dati da creare: " ) ;
strBody + = wxT ( Bold ( _strDataPath ) + " </p> " ) ;
2007-09-20 09:53:21 +00:00
}
}
}
//installazione servers...
if ( ! _strSrvAuth . IsEmpty ( ) )
{
strBody + = wxT ( " <p>Computer gestore delle autorizzazioni: " ) ;
strBody + = wxT ( Bold ( _strSrvAuth ) + " </p> " ) ;
}
if ( ! _strSrvDict . IsEmpty ( ) )
{
strBody + = wxT ( " <p>Computer gestore dei dizionari: " ) ;
strBody + = wxT ( Bold ( _strSrvDict ) + " </p> " ) ;
}
//...e loro modalita' di lancio (solo installazione server!)
2007-12-03 14:22:50 +00:00
if ( _uInstallType = = it_server & & ( ! _strSrvAuth . IsEmpty ( ) | | ! _strSrvDict . IsEmpty ( ) ) & & _iSrvAutostartMode > = 0 )
2007-09-20 09:53:21 +00:00
{
strBody + = wxT ( " <p>Modalita' di esecuzione dei programmi di gestione: " ) ;
2007-12-03 14:22:50 +00:00
if ( _iSrvAutostartMode = = lm_service )
2007-09-20 09:53:21 +00:00
strBody + = wxT ( Bold ( " Come servizi " ) + " </p> " ) ;
else
strBody + = wxT ( Bold ( " Nel menu esecuzione automatica " ) + " </p> " ) ;
}
//installazione dati demo (solo in postazione singola)
2007-12-03 14:22:50 +00:00
if ( _uInstallType = = it_standalone & & _bInstDemoData )
2007-09-20 09:53:21 +00:00
strBody + = wxT ( " <p>Installazione area dati dimostrativa</p> " ) ;
if ( _bDesktopShortcut )
strBody + = wxT ( " <p>Creazione dell' icona sul desktop</p> " ) ;
SetHTMLText ( strTitle , strBody ) ;
return true ;
}
CampoWizardPage10 : : CampoWizardPage10 ( wxWizard * parent ) : CampoWizardPage ( parent )
{
}
///////////////////////////////////////////////////////////
// CampoWizard
///////////////////////////////////////////////////////////
//la dichiarazione della classe e' prima in quanto alcuni suoi metodi sono usati da altre classi scritte piu' su
BEGIN_EVENT_TABLE ( CampoWizard , wxWizard )
EVT_BUTTON ( wxID_FORWARD , CampoWizard : : OnNext )
END_EVENT_TABLE ( )
void CampoWizard : : OnNext ( wxCommandEvent & e )
{
CampoWizardPage * p = ( CampoWizardPage * ) GetCurrentPage ( ) ;
if ( p - > ForwardValidate ( ) )
e . Skip ( ) ;
}
bool CampoWizard : : Run ( )
{ return RunWizard ( m_pPage [ 0 ] ) ; }
wxString CampoWizard : : Get ( wxWindowID id ) const
{
wxWindow * pWnd = FindWindowById ( id ) ;
return pWnd ? pWnd - > GetLabel ( ) : wxEmptyString ;
}
int CampoWizard : : GetSelection ( wxWindowID id ) const
{
int n = - 1 ;
wxWindow * pWnd = FindWindowById ( id ) ;
if ( pWnd )
{
wxChoice * pList = ( wxChoice * ) pWnd ;
n = pList - > GetSelection ( ) ;
}
return n ;
}
bool CampoWizard : : GetBool ( wxWindowID id ) const
{
wxCheckBox * pWnd = ( wxCheckBox * ) FindWindowById ( id ) ;
return pWnd ! = NULL & & pWnd - > IsChecked ( ) ;
}
void CampoWizard : : Set ( wxWindowID id , const wxString str )
{
wxWindow * pWnd = FindWindowById ( id ) ;
if ( pWnd ! = NULL )
pWnd - > SetLabel ( str ) ;
}
2007-10-04 13:21:29 +00:00
2007-09-20 09:53:21 +00:00
//lunga litania di metodi per gettare e settare i valori tra le pagine
void CampoWizard : : SetDestinationPath ( const wxString & path )
{
_strDestinationPath = path ;
//Se il path di destinazione e' vuoto -> nuova installazione, senno' e' un aggiornamento della installazione..
//..che sta in _strDestinationPath
if ( _strDestinationPath . IsEmpty ( ) )
{
2008-01-03 11:21:17 +00:00
//installazione
2007-09-20 09:53:21 +00:00
if ( GetInstDemoVersion ( ) )
wxWizardPageSimple : : Chain ( m_pPage [ 2 ] , m_pPage [ 8 ] ) ; //installazione DEMO
else
2008-01-03 11:21:17 +00:00
{
wxWizardPageSimple : : Chain ( m_pPage [ 2 ] , m_pPage [ 3 ] ) ; //installazione nuova normale
wxWizardPageSimple : : Chain ( m_pPage [ 3 ] , m_pPage [ 4 ] ) ;
}
2007-09-20 09:53:21 +00:00
}
else
{
2008-01-03 11:21:17 +00:00
//aggiornamento
CampoWizardPage4 * page4 = ( CampoWizardPage4 * ) m_pPage [ 3 ] ;
if ( page4 - > DongleTest ( ) ! = 0 )
wxWizardPageSimple : : Chain ( m_pPage [ 2 ] , m_pPage [ 8 ] ) ; // chiave trovata
else
{
wxWizardPageSimple : : Chain ( m_pPage [ 2 ] , m_pPage [ 3 ] ) ; // chiave NON trovata
wxWizardPageSimple : : Chain ( m_pPage [ 3 ] , m_pPage [ 8 ] ) ;
}
2007-09-20 09:53:21 +00:00
}
}
const wxString & CampoWizard : : GetDestinationPath ( ) const
{
return _strDestinationPath ;
}
2007-10-18 14:51:26 +00:00
void CampoWizard : : SetInstallationType ( const InstallationType nType )
2007-09-20 09:53:21 +00:00
{
2007-10-18 14:51:26 +00:00
_uInstallationType = nType ;
2007-09-20 09:53:21 +00:00
//in base al tipo di installazione spara l'utente alla pagina corretta
switch ( _uInstallationType )
{
2007-10-18 14:51:26 +00:00
case it_server : //server
2007-09-20 09:53:21 +00:00
wxWizardPageSimple : : Chain ( m_pPage [ 4 ] , m_pPage [ 6 ] ) ; //manda l'utente alla pagina server
wxWizardPageSimple : : Chain ( m_pPage [ 6 ] , m_pPage [ 8 ] ) ; //dal server alla pagina riassuntiva
break ;
2007-10-18 14:51:26 +00:00
case it_client : //client
2007-09-20 09:53:21 +00:00
wxWizardPageSimple : : Chain ( m_pPage [ 4 ] , m_pPage [ 7 ] ) ; //manda l'utente alla pagina client
wxWizardPageSimple : : Chain ( m_pPage [ 7 ] , m_pPage [ 8 ] ) ; //dal client alla pagina riassuntiva
break ;
2007-10-18 14:51:26 +00:00
case it_upgrade : //aggiornamento installazione precedente
2008-01-03 11:21:17 +00:00
//wxWizardPageSimple::Chain(m_pPage[3], m_pPage[8]); //manda l'utente alla pagina riassuntiva
2007-09-20 09:53:21 +00:00
break ;
default : //standard
//if demo
if ( GetInstDemoVersion ( ) )
{
wxWizardPageSimple : : Chain ( m_pPage [ 2 ] , m_pPage [ 8 ] ) ; //manda l'utente alla pagina riassuntiva senza controllo chiave
}
else
{
wxWizardPageSimple : : Chain ( m_pPage [ 4 ] , m_pPage [ 5 ] ) ; //manda l'utente alla pagina standard
wxWizardPageSimple : : Chain ( m_pPage [ 5 ] , m_pPage [ 8 ] ) ; //dalla standard alla pagina riassuntiva
}
break ;
}
}
2007-10-18 14:51:26 +00:00
const InstallationType CampoWizard : : GetInstallationType ( ) const
2007-09-20 09:53:21 +00:00
{
return _uInstallationType ;
}
void CampoWizard : : SetPrgLocPath ( const wxString & strPrgLocPath )
{
_strPrgLocPath = strPrgLocPath ;
}
const unsigned int CampoWizard : : GetDongleType ( ) const
{
return _uDongleType ;
}
void CampoWizard : : SetDongleType ( const unsigned int uType )
{
_uDongleType = uType ;
}
const wxString & CampoWizard : : GetPrgLocPath ( ) const
{
return _strPrgLocPath ;
}
void CampoWizard : : SetPrgNetPath ( const wxString & strPrgNetPath )
{
_strPrgNetPath = strPrgNetPath ;
}
const wxString & CampoWizard : : GetPrgNetPath ( ) const
{
return _strPrgNetPath ;
}
void CampoWizard : : SetDataPath ( const wxString & strDataPath )
{
_strDataPath = strDataPath ;
}
const wxString & CampoWizard : : GetDataPath ( ) const
{
return _strDataPath ;
}
void CampoWizard : : SetInstUseAuth ( const bool bInstUseAuth )
{
_bInstUseAuth = bInstUseAuth ;
}
const bool CampoWizard : : GetInstUseAuth ( ) const
{
return _bInstUseAuth ;
}
void CampoWizard : : SetSrvAuth ( const wxString & strSrvAuth )
{
_strSrvAuth = strSrvAuth ;
}
const wxString & CampoWizard : : GetSrvAuth ( ) const
{
return _strSrvAuth ;
}
void CampoWizard : : SetInstUseDict ( const bool bInstUseDict )
{
_bInstUseDict = bInstUseDict ;
}
const bool CampoWizard : : GetInstUseDict ( ) const
{
return _bInstUseDict ;
}
void CampoWizard : : SetSrvDict ( const wxString & strSrvDict )
{
_strSrvDict = strSrvDict ;
}
const wxString & CampoWizard : : GetSrvDict ( ) const
{
return _strSrvDict ;
}
2007-10-18 14:51:26 +00:00
void CampoWizard : : SetSrvAutostartMode ( const LurchMode iSrvAutostartMode )
2007-09-20 09:53:21 +00:00
{
_iSrvAutostartMode = iSrvAutostartMode ;
}
2007-10-18 14:51:26 +00:00
const LurchMode CampoWizard : : GetSrvAutostartMode ( ) const
2007-09-20 09:53:21 +00:00
{
return _iSrvAutostartMode ;
}
void CampoWizard : : SetInstDemoData ( const bool bInstDemoData )
{
_bInstDemoData = bInstDemoData ;
}
const bool CampoWizard : : GetInstDemoData ( ) const
{
return _bInstDemoData ;
}
void CampoWizard : : SetInstDemoVersion ( const bool bInstDemoVersion )
{
_bInstDemoVersion = bInstDemoVersion ;
}
const bool CampoWizard : : GetInstDemoVersion ( ) const
{
return _bInstDemoVersion ;
}
void CampoWizard : : SetDesktopShortcut ( const bool bDesktopShortcut )
{
_bDesktopShortcut = bDesktopShortcut ;
}
const bool CampoWizard : : GetDesktopShortcut ( ) const
{
return _bDesktopShortcut ;
}
//...fine litania metodi di passaggio valori tra le finestre
CampoWizard : : CampoWizard ( wxWindow * pParent )
{
//resettatore dei booleans (che senno' prendono valore casuale ad ogni esecuzione)
_bInstDemoData = false ; //installa dati dimostrativi
_bInstDemoVersion = false ; //installa versione demo
_bInstUseAuth = false ; //installa/usa server authoriz
_bInstUseDict = false ; //installa/usa server diction
2008-01-03 11:21:17 +00:00
_iSrvAutostartMode = lm_none ; //autostart dei servers
2007-09-20 09:53:21 +00:00
_bDesktopShortcut = false ; //creazione link sul desktop
wxBitmap bitmap ;
wxString strName = wxT ( " logo.gif " ) ;
bitmap . LoadFile ( strName , wxBITMAP_TYPE_GIF ) ;
2008-11-28 10:59:10 +00:00
Create ( pParent , wxID_ANY , APPNAMEFULL , bitmap ) ;
2007-09-20 09:53:21 +00:00
m_pPage [ 0 ] = new CampoWizardPage1 ( this ) ; //benvenuto con logo
m_pPage [ 1 ] = new CampoWizardPage2 ( this ) ; //licenza
m_pPage [ 2 ] = new CampoWizardPage3 ( this ) ; //scelta aggiornamento/tipo installazione
m_pPage [ 3 ] = new CampoWizardPage4 ( this ) ; //test ed installazione chiavi
m_pPage [ 4 ] = new CampoWizardPage5 ( this ) ; //selezione tipo installazione
m_pPage [ 5 ] = new CampoWizardPage6 ( this ) ; //installazione standard
m_pPage [ 6 ] = new CampoWizardPage7 ( this ) ; //installazione server
m_pPage [ 7 ] = new CampoWizardPage8 ( this ) ; //installazione client
m_pPage [ 8 ] = new CampoWizardPage9 ( this ) ; //creazione icona sul desktop e in start/programmi/campo
m_pPage [ 9 ] = new CampoWizardPage10 ( this ) ; //riassuntino installazione
for ( int p = 1 ; p < m_nPages ; p + + )
wxWizardPageSimple : : Chain ( m_pPage [ p - 1 ] , m_pPage [ p ] ) ;
GetPageAreaSizer ( ) - > Add ( m_pPage [ 0 ] ) ;
//bottoni di navigazione
Set ( wxID_FORWARD , " Avanti " ) ;
Set ( wxID_BACKWARD , " Indietro " ) ;
Set ( wxID_CANCEL , " Annulla " ) ;
}