Patch level :4.0 setup
Files correlati : Ricompilazione Demo : [ ] Commento :pagina riassuntiva funzionante! git-svn-id: svn://10.65.10.50/trunk@15540 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
845da1e0f4
commit
63c8119e14
225
setup/Setup.cpp
225
setup/Setup.cpp
@ -278,9 +278,37 @@ public:
|
||||
CampoWizard(wxWindow* pParent);
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Classe per la gestione dei files di configurazione tipo campo.ini
|
||||
class CampoIniFile : public wxFileConfig
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxString Get(const wxString strVariable) const;
|
||||
bool GetBool(const wxString strVariable) const;
|
||||
CampoIniFile(const wxString strIniPath, const wxString strParagraph);
|
||||
};
|
||||
|
||||
CampoIniFile::CampoIniFile(const wxString strIniPath, const wxString strParagraph)
|
||||
: wxFileConfig ("", "", "", strIniPath, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS)
|
||||
{
|
||||
if (!strParagraph.IsEmpty())
|
||||
SetPath(strParagraph);
|
||||
}
|
||||
|
||||
wxString CampoIniFile::Get(const wxString strVariable) const
|
||||
{
|
||||
return Read(strVariable);
|
||||
}
|
||||
|
||||
bool CampoIniFile::GetBool(const wxString strVariable) const
|
||||
{
|
||||
wxString strBool = Get(strVariable);
|
||||
return strBool == "X" || strBool == "Y";
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Campo wizard page (pagina generica del programma, di cui saranno figlie le singole pagine)
|
||||
class CampoWizardPage : public wxWizardPageSimple
|
||||
{
|
||||
@ -290,8 +318,10 @@ 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);
|
||||
bool CheckDataDir(wxString& strDataPath) const;
|
||||
|
||||
public:
|
||||
virtual bool ForwardValidate() { return true; }
|
||||
@ -343,7 +373,7 @@ void CampoWizardPage::SetHTMLPage(const wxString strFile)
|
||||
//parte html della finestra standard
|
||||
void CampoWizardPage::SetHTMLText(wxString strTitle, wxString strBody)
|
||||
{
|
||||
wxString strAppName = wxT("<i> <b>"); strAppName += APPNAME; strAppName += wxT("</i> </b>");
|
||||
wxString strAppName = wxT("<i>"); strAppName += Bold(APPNAME); strAppName += wxT("</i>");
|
||||
strTitle.Replace(wxT("APPNAME"), strAppName);
|
||||
strBody.Replace(wxT("APPNAME"), strAppName);
|
||||
|
||||
@ -357,6 +387,13 @@ void CampoWizardPage::SetHTMLText(wxString strTitle, wxString strBody)
|
||||
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)
|
||||
{
|
||||
@ -368,6 +405,23 @@ void CampoWizardPage::AddLabel(wxGridBagSizer* pSizer, const wxChar* label, unsi
|
||||
pSizer->Add(new wxStaticText(this, wxID_ANY, label), wxGBPosition(row, column));
|
||||
}
|
||||
|
||||
//metodo per il controllo della validita' di un'area dati
|
||||
bool CampoWizardPage::CheckDataDir(wxString& strDataPath) const
|
||||
{
|
||||
wxDir dirDataPath(strDataPath);
|
||||
bool ok_data = false;
|
||||
//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())
|
||||
ok_data = true;
|
||||
}
|
||||
return ok_data;
|
||||
}
|
||||
|
||||
//costruttore della finestra standard
|
||||
CampoWizardPage::CampoWizardPage(wxWizard* parent)
|
||||
: wxWizardPageSimple(parent)
|
||||
@ -392,7 +446,7 @@ CampoWizardPage1::CampoWizardPage1(wxWizard* parent) : CampoWizardPage(parent)
|
||||
//contenuto della prima schermata (pagina benvenuto)
|
||||
wxString strTitle = wxT("Benvenuti in <b>APPNAME</b>");
|
||||
wxString strBody = wxT("<p>Questo programma vi guiderà passo a passo nell'installazione / aggiornamento del software.</p>");
|
||||
strBody += wxT("<p><u>Leggere attentamente le istruzioni</u> che saranno visualizzate nelle finestre di questo programma di installazione!</p>");
|
||||
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>Prima di proseguire con l'installazione / aggiornamento <u>assicurarsi di avere effettuato il login a Windows con un utente di tipo 'Amministratore' di sistema.</u></p>");
|
||||
SetHTMLText(strTitle, strBody);
|
||||
}
|
||||
@ -414,14 +468,50 @@ public:
|
||||
|
||||
bool CampoWizardPage2::ForwardValidate()
|
||||
{
|
||||
const int last_row = m_pRadioBox->GetRowCount() - 1;
|
||||
const int selected_row = m_pRadioBox->GetSelection();
|
||||
wxString path;
|
||||
const int iLastRow = m_pRadioBox->GetRowCount() - 1;
|
||||
const int iSelectedRow = m_pRadioBox->GetSelection();
|
||||
wxString strPrgPath;
|
||||
wxString strStudy;
|
||||
wxString strSrvAuth;
|
||||
wxString strSrvDict;
|
||||
|
||||
if (selected_row < last_row)
|
||||
path = m_pRadioBox->GetStringSelection();
|
||||
//analizza il campo.ini dell'installazione selezionata
|
||||
if (iSelectedRow < iLastRow)
|
||||
{
|
||||
strPrgPath = m_pRadioBox->GetStringSelection();
|
||||
CampoIniFile CampoIni(strPrgPath + "/campo.ini", "Main");
|
||||
|
||||
const bool bTestDatabase = CampoIni.GetBool("TestDatabase");
|
||||
|
||||
GetWizard().SetDestinationPath(path);
|
||||
//non si puo' aggiornare un client da cd!! va fatto dal programma
|
||||
const bool bTestPrograms = CampoIni.GetBool("TestPrograms");
|
||||
if (bTestPrograms)
|
||||
{
|
||||
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 ";
|
||||
strMsg << APPNAME << " in " << strDiskPath << " !\n";
|
||||
strMsg << "Questa stazione di lavoro si aggiornera' automaticamente alla prima esecuzione del programma " << APPNAME;
|
||||
return ErrorBox(strMsg);
|
||||
}
|
||||
|
||||
strStudy = CampoIni.Get("Study");
|
||||
CampoIniFile CampoServerIni(strPrgPath + "/campo.ini", "Server");
|
||||
strSrvAuth = CampoServerIni.Get("Dongle");
|
||||
strSrvDict = CampoServerIni.Get("Dictionary");
|
||||
|
||||
if (!CheckDataDir(strStudy))
|
||||
return ErrorBox("La cartella indicata come area dati NON e' valida!\nInterrompere l'installazione e selezionare un'area dati valida\ncon il programma Campo");
|
||||
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);
|
||||
GetWizard().SetInstallationType(3); //e' un aggiornamento!!
|
||||
|
||||
return true;
|
||||
@ -430,7 +520,7 @@ bool CampoWizardPage2::ForwardValidate()
|
||||
CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent)
|
||||
{
|
||||
//deve cercare campo.stp
|
||||
wxFileConfig campo_stp("", "", "", "C:\\campo.stp", wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS);
|
||||
CampoIniFile campo_stp("C:\\campo.stp", "");
|
||||
wxString group;
|
||||
long index;
|
||||
const wxString program = "Program";
|
||||
@ -445,9 +535,8 @@ CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent)
|
||||
int prechecked = -1;
|
||||
for (unsigned int i = 0; i < asGroups.GetCount(); i++)
|
||||
{
|
||||
wxFileConfig campo_stp("", "", "", "C:\\campo.stp", wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS);
|
||||
campo_stp.SetPath(asGroups[i]);
|
||||
wxString path = campo_stp.Read(program);
|
||||
CampoIniFile campo_stp("C:\\campo.stp", asGroups[i]);
|
||||
wxString path = campo_stp.Get(program);
|
||||
|
||||
//sono installazioni valide quelle che presentano la coppia di files campo.ini e campo.aut (senza..
|
||||
//..questi 2 soggetti il programma non parte)
|
||||
@ -461,10 +550,8 @@ CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent)
|
||||
//cerca l'eventuale installazione server se ci sono piu' installazioni sulla stessa macchina
|
||||
if (prechecked < 0)
|
||||
{
|
||||
wxFileConfig ini("", "", "", campo_ini, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS);
|
||||
ini.SetPath("Main");
|
||||
wxString test_database = ini.Read("TestDatabase");
|
||||
if (test_database == "X" || test_database == "Y")
|
||||
CampoIniFile ini(campo_ini, "Main");
|
||||
if (ini.GetBool("TestDatabase") && !ini.GetBool("TestPrograms"))
|
||||
prechecked = i;
|
||||
}
|
||||
}
|
||||
@ -488,8 +575,8 @@ CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent)
|
||||
strBody += wxT("<p>E' possibile <b>AGGIORNARE (scelta consigliata)</b> una installazione di <b><i>Campo</i></b> gia' presente oppure <b>INSTALLARE</b> in un nuovo direttorio.</p>");
|
||||
strBody += wxT("<p>Selezionare l'opzione desiderata nel riquadro sottostante. In caso di piu' di una installazione ");
|
||||
strBody += wxT("presente sara' preselezionata la eventuale installazione di tipo <b>Server</b>, in quanto <u>deve essere aggiornata per prima</u>! ");
|
||||
strBody += wxT("<p>In questo caso procedere all'aggiornamento di tale installazione Server e poi ripetere la procedura di aggiornamento ");
|
||||
strBody += wxT("per le installazioni di tipo Client</p>");
|
||||
strBody += wxT("<p>In questo caso procedere all'aggiornamento di tale installazione Server e <u>aggiornare successivamente le postazioni client ");
|
||||
strBody += wxT("lanciando il programma <b><i>Campo</i></b> su di esse</u></p>");
|
||||
|
||||
//radiobutton con le scelte aggiornamento
|
||||
asCampi.Add("Nuova installazione");
|
||||
@ -1230,18 +1317,7 @@ bool CampoWizardPage8::ForwardValidate()
|
||||
|
||||
//controllo esistenza dati sul server
|
||||
wxString strDataPath = Get(805);
|
||||
wxDir dirDataPath(strDataPath);
|
||||
bool ok_data = false;
|
||||
//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())
|
||||
ok_data = true;
|
||||
}
|
||||
if (!ok_data)
|
||||
if (!CheckDataDir(strDataPath))
|
||||
return ErrorBox("La cartella selezionata come area dati NON e' valida!");
|
||||
|
||||
//setta alla pagina riassuntiva i valori della pagina attuale
|
||||
@ -1349,6 +1425,14 @@ CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent)
|
||||
/**********************************************************************************************************/
|
||||
class CampoWizardPage9 : public CampoWizardPage
|
||||
{
|
||||
unsigned int _uInstallType;
|
||||
wxString _strPrgLocPath;
|
||||
wxString _strPrgNetPath;
|
||||
wxString _strDataPath;
|
||||
wxString _strSrvAuth;
|
||||
wxString _strSrvDict;
|
||||
bool _bInstDemoData;
|
||||
|
||||
protected:
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
@ -1359,35 +1443,86 @@ public:
|
||||
bool CampoWizardPage9::TransferDataToWindow()
|
||||
{
|
||||
CampoWizard& cw = GetWizard();
|
||||
const unsigned int uInstallType = cw.GetInstallationType();
|
||||
switch (uInstallType)
|
||||
|
||||
_uInstallType = cw.GetInstallationType();
|
||||
switch (_uInstallType)
|
||||
{
|
||||
case 1: //server
|
||||
cw.GetPrgLocPath();
|
||||
cw.GetDataPath();
|
||||
_strPrgLocPath = cw.GetPrgLocPath();
|
||||
_strDataPath = cw.GetDataPath();
|
||||
_strSrvAuth = cw.GetSrvAuth();
|
||||
_strSrvDict = cw.GetSrvDict();
|
||||
break;
|
||||
case 2: //client
|
||||
cw.GetPrgLocPath();
|
||||
cw.GetPrgNetPath();
|
||||
cw.GetDataPath();
|
||||
_strPrgLocPath = cw.GetPrgLocPath();
|
||||
_strPrgNetPath = cw.GetPrgNetPath();
|
||||
_strDataPath = cw.GetDataPath();
|
||||
_strSrvAuth = cw.GetSrvAuth();
|
||||
_strSrvDict = cw.GetSrvDict();
|
||||
break;
|
||||
case 3: //aggiornamento
|
||||
_strPrgLocPath = cw.GetDestinationPath();
|
||||
_strDataPath = cw.GetDataPath();
|
||||
_strSrvAuth = cw.GetSrvAuth();
|
||||
_strSrvDict = cw.GetSrvDict();
|
||||
break;
|
||||
default: //standard
|
||||
cw.GetPrgLocPath();
|
||||
cw.GetDataPath();
|
||||
cw.GetInstDemoData();
|
||||
_strPrgLocPath = cw.GetPrgLocPath();
|
||||
_strDataPath = cw.GetDataPath();
|
||||
_bInstDemoData = cw.GetInstDemoData();
|
||||
break;
|
||||
}
|
||||
|
||||
//se installazione o aggiornamento cambia sia il titolo che i contenuti
|
||||
wxString strTitle;
|
||||
wxString strBody;
|
||||
|
||||
//Aggiornamento
|
||||
if (_uInstallType == 3)
|
||||
{
|
||||
strTitle += wxT("Riepilogo configurazione aggiornamento");
|
||||
|
||||
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("Riepilogo configurazione installazione");
|
||||
|
||||
strBody = wxT("<p>Cartella programma da installare: ");
|
||||
strBody += wxT(Bold(_strPrgLocPath) + "</p>");
|
||||
if (_uInstallType == 2)
|
||||
{
|
||||
strBody += wxT("<p>Cartella di origine del programma: ");
|
||||
strBody += wxT(Bold(_strPrgNetPath) + "</p>");
|
||||
}
|
||||
strBody += wxT("<p>Cartella dati da creare: ");
|
||||
strBody += wxT(Bold(_strDataPath) + "</p>");
|
||||
}
|
||||
|
||||
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>");
|
||||
}
|
||||
if (_bInstDemoData)
|
||||
strBody += wxT("<p>Installazione area dati dimostrativa</p>");
|
||||
|
||||
SetHTMLText(strTitle, strBody);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CampoWizardPage9::CampoWizardPage9(wxWizard* parent) : CampoWizardPage(parent)
|
||||
{
|
||||
//seconda pagina
|
||||
wxString strTitle = wxT("Configurazione installazione");
|
||||
wxString strBody = wxT("");
|
||||
SetHTMLText(strTitle, strBody);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user