Patch level :10.0 186

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :controllo preventivo delle custom sotto lo studio; manca ancora quello delle custom sotto le ditte


git-svn-id: svn://10.65.10.50/trunk@17818 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2008-12-05 12:11:20 +00:00
parent 219b8a72c6
commit 417f60a85d
2 changed files with 102 additions and 11 deletions

View File

@ -1249,6 +1249,10 @@ void CampoSetup::NormalSetup()
m_pWizard->Destroy();
}
//------------------------------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////////
// Metodi per il controllo preventivo di eventuali cazzate in procinto di accadere
////////////////////////////////////////////////////////////////////////////////////
bool CampoSetup::SystemRunning(const wxString& strAppName, const wxString& strMsg) const
{
wxSingleInstanceChecker sicProgram(strAppName);
@ -1367,7 +1371,6 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
return;
}
wxFileName strPath(argv[0]);
strPath.MakeAbsolute();
strPath.SetCwd();

View File

@ -21,6 +21,7 @@ protected:
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;
bool CheckCustomDir(const wxString strCustomPath, const wxString& strPrgPath) const;
bool CheckPrgDir(const wxString& strPrgPath) const;
public:
@ -120,7 +121,7 @@ void CampoWizardPage::AddLabel(wxGridBagSizer* pSizer, const wxChar* label, unsi
//metodo per il controllo della validita' di un'area dati
bool CampoWizardPage::CheckDataDir(wxString strDataPath) const
{
bool ok_data = false;
bool bOkData = false;
wxDir dirDataPath(strDataPath);
//deve esistere non vuota, e contenere la sottodirectory "com" con i dati comuni
@ -131,16 +132,71 @@ bool CampoWizardPage::CheckDataDir(wxString strDataPath) const
fnFileToCheck.SetExt("dbf");
if (fnFileToCheck.FileExists())
{
ok_data = fnFileToCheck.IsFileWritable();
bOkData = fnFileToCheck.IsFileWritable();
}
}
return ok_data;
return bOkData;
}
//metodo per il controllo di eventuali personalizzazioni presenti nelle custom e relative ad una versione..
//..antecedente la 209110 (prima versione 10.0)
bool CampoWizardPage::CheckCustomDir(const wxString strCustomPath, const wxString& strPrgPath) const
{
//parametro di controllo generale sulla bontà della custom
bool bOkCustom = true;
//controlla la directory custom che gli viene passata alla ricerca del file custver.ini che contiene le info..
//..necessarie per sapere se le personalizzazioni sono a posto o meno
if (::wxDirExists(strCustomPath))
{
//solo i file di tipo .msk possono creare casini
wxArrayString asMaskList;
//parametro di controllo sulla bontà della personalizzazione;se trova almeno 1 file personalizzato che crea..
//..la necessità di controllare la versione della custom
bool bPersonalized = false;
const size_t uMaskFiles = wxDir::GetAllFiles(strCustomPath, &asMaskList, "*.msk");
for (size_t i = 0; i < uMaskFiles; i++)
{
const wxString strMask = asMaskList[i].Lower();
//se c'è un verig.msk è sicuramente una personalizzazione e quindi esce per bloccare l'installazione
if (strMask.StartsWith("verig"))
{
bPersonalized = true;
break;
}
//solo le maschere che hanno un omonimo .ini possono dare errore
wxFileName fnIni(strMask);
fnIni.SetExt("ini");
//per prima cosa cerca l'ini nella custom corrente
if (fnIni.FileExists())
{
bPersonalized = true;
break;
}
//poi lo prova a cercare sotto i programmi (ci vuole un matto a fare una cosa simile)
fnIni.SetPath(strPrgPath);
if (fnIni.FileExists())
{
bPersonalized = true;
break;
}
}
if (bPersonalized)
{
CampoIniFile ciCustomVer(strCustomPath + "/custver.ini", "Main");
const long lCustomVer = ciCustomVer.GetInt("Versione"); //il dio dei programmatori perdoni il type mismatch!
if (lCustomVer < 209110)
bOkCustom = false;
}
}
return bOkCustom;
}
//metodo per il controllo della validita' di un'area programmi
bool CampoWizardPage::CheckPrgDir(const wxString& strPrgPath) const
{
bool ok_prg = false;
bool bOkPrg = false;
wxDir dirPrgPath(strPrgPath);
//deve esistere non vuota e con sottodirecrory (almeno res e recdesc ci vogliono)
@ -162,13 +218,13 @@ bool CampoWizardPage::CheckPrgDir(const wxString& strPrgPath) const
fnFileToCheck.SetExt("exe");
if (fnFileToCheck.FileExists())
{
ok_prg = true;
bOkPrg = true;
} //if(ba0..
} //if(campo..
} //if(install..
} //if(ini...
} //if(dirPrgPath..
return ok_prg;
return bOkPrg;
}
//costruttore della finestra standard
@ -176,7 +232,7 @@ CampoWizardPage::CampoWizardPage(wxWizard* parent)
: wxWizardPageSimple(parent)
{
wxBoxSizer* pSizer = new wxBoxSizer(wxVERTICAL);
m_pText = new wxHtmlWindow(this, 100, wxDefaultPosition, wxSize(512, 312));
m_pText = new wxHtmlWindow(this, 100, wxDefaultPosition, wxSize(640, 480));
pSizer->Add(m_pText, 0, wxALL, 0);
pSizer->AddSpacer(5);
SetSizer(pSizer);
@ -306,8 +362,32 @@ bool CampoWizardPage3::ForwardValidate()
strSrvAuth = CampoServerIni.Get("Dongle");
strSrvDict = CampoServerIni.Get("Dictionary");
//controlla l'area dati e le eventuali custom directory
//area dati
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");
//custom directories
//a) custom di studio
if (!CheckCustomDir(strStudy + "custom", strPrgPath))
return ErrorBox("Sono presenti personalizzazioni relative ai documenti di vendita.\n"
"Richiedere l'intervento dell'assistenza tecnica.\nL'aggiornamento verrà terminato.");
//b) custom di ditta
wxArrayString asDirsList;
const size_t uFirmDirs = wxDir::GetAllFiles(strStudy, &asDirsList, "", wxDIR_DIRS);
for (size_t i = 0; i < uFirmDirs; i++)
{
const wxString strDir = asDirsList[i].Lower();
if (strDir.Len() == 6 && strDir.EndsWith("a") && atol(strDir) > 0)
{
if (!CheckCustomDir(strDir + "custom", strPrgPath))
{
wxString strMsg = "Sono presenti personalizzazioni relative ai documenti di vendita nella ditta ";
strMsg << strDir << ".\nRichiedere l'intervento dell'assistenza tecnica.";
return ErrorBox(strMsg);
}
}
}
//se ha superato i severi controlli prosegue
GetWizard().SetDataPath(strStudy);
if (!strSrvAuth.IsEmpty())
@ -1783,10 +1863,18 @@ CampoWizard::CampoWizard(wxWindow* pParent)
_iSrvAutostartMode = lm_none;//autostart dei servers
_bDesktopShortcut = false; //creazione link sul desktop
wxBitmap bitmap;
wxImage iLogo;
wxString strName = wxT("logo.gif");
bitmap.LoadFile(strName, wxBITMAP_TYPE_GIF);
iLogo.LoadFile(strName, wxBITMAP_TYPE_GIF);
int nWidth = iLogo.GetWidth();
int nHeight = iLogo.GetHeight();
if (nWidth > 320)
{
nHeight = nHeight * 320 / nWidth;
nWidth = 320;
iLogo.Rescale(nWidth, nHeight, wxIMAGE_QUALITY_HIGH);
}
const wxBitmap bitmap(iLogo);
Create(pParent, wxID_ANY, APPNAMEFULL, bitmap);
m_pPage[0] = new CampoWizardPage1(this); //benvenuto con logo