Patch level : 10.0

Files correlati     : authoriz.exe lurch.exe
Ricompilazione Demo : [ ]
Commento            :
Aggiunti bottoni "veri" HTML+JavaScript al posto delle vecchie celle grige, che ne simulavano il comportamento grezzamente.


git-svn-id: svn://10.65.10.50/branches/R_10_00@20850 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-09-13 13:32:26 +00:00
parent cc7e2e812a
commit 91fb140565
3 changed files with 40 additions and 27 deletions

View File

@ -22,10 +22,8 @@ public:
}; };
TUserInfo::TUserInfo(const wxChar* user, const wxChar* host) TUserInfo::TUserInfo(const wxChar* user, const wxChar* host)
: m_strName(user), m_strHost(host), : m_strName(user), m_strHost(host), m_time(wxDateTime::Now()), m_nPrograms(0)
m_time(wxDateTime::Now()), m_nPrograms(0) { }
{
}
WX_DECLARE_HASH_MAP( wxString, TUserInfo*, wxStringHash, wxStringEqual, TUsersHashMap ); WX_DECLARE_HASH_MAP( wxString, TUserInfo*, wxStringHash, wxStringEqual, TUsersHashMap );
@ -239,9 +237,7 @@ wxString TAuthorizationServer::GarbleMD5(unsigned short n, const wxDateTime& dat
// Implementare almeno queste due funzioni pure virtuali // Implementare almeno queste due funzioni pure virtuali
const wxChar* TAuthorizationServer::GetAppName() const const wxChar* TAuthorizationServer::GetAppName() const
{ { return wxT("Authorization"); }
return "Authorization";
}
bool TAuthorizationServer::IsMagicName(wxString& strFilename) const bool TAuthorizationServer::IsMagicName(wxString& strFilename) const
{ {
@ -365,10 +361,10 @@ void TAuthorizationServer::GenerateIndex(wxString& strFilename)
TXmlItem& tr6 = body.AddChild("tr"); TXmlItem& tr6 = body.AddChild("tr");
TXmlItem& al = tr6.AddChild("td").AddChild("a"); TXmlItem& al = tr6.AddChild("td").AddChild("a");
al.SetAttr("href", "Log"); al << "Log File"; al.SetAttr("href", "Log"); al << "Log File";
tr6.AddChild("td") << GetLogFileName();
TXmlItem& tr7 = body.AddChild("tr"); TXmlItem& tr7 = body.AddChild("tr").AddChild("td").SetAttr("align", "center");
TXmlItem& as = tr7.AddChild("td").AddChild("a"); AddLinkButton(tr7, _("Stop the Server"), wxT("stop.cgi"));
as.SetAttr("href", "stop.cgi"); as << "Stop the Server";
strFilename = GetTempFilename(); strFilename = GetTempFilename();
html.Save(strFilename); html.Save(strFilename);
@ -673,7 +669,7 @@ void TAuthorizationServer::ProcessActivation(int nModule, bool act, wxSocketBase
m_Dongle.Burn(); m_Dongle.Burn();
InitModules(); InitModules();
} }
wxString strFileName = "Modules"; wxString strFileName = wxT("Modules");
GenerateFile(strFileName); GenerateFile(strFileName);
SendFile(strFileName, outs); SendFile(strFileName, outs);
} }
@ -981,7 +977,7 @@ bool TAuthorizationServer::Initialization()
bool TAuthorizationServer::Deinitialization() bool TAuthorizationServer::Deinitialization()
{ {
m_Dongle.Logout(); m_Dongle.Logout();
#ifdef WIN32 #ifdef __WXMSW__
// Definitely kill global atom // Definitely kill global atom
for (ATOM a = ::GlobalFindAtom(ATOMIC_SEMAPHORE); for (ATOM a = ::GlobalFindAtom(ATOMIC_SEMAPHORE);
a != NULL; a != NULL;

View File

@ -243,14 +243,25 @@ TXmlItem& TBaseServerApp::CreatePageBody(TXmlItem& html, wxString header) const
TXmlItem& TBaseServerApp::AddLinkButton(TXmlItem& body, const wxChar* strCaption, const wxChar* strHref) const TXmlItem& TBaseServerApp::AddLinkButton(TXmlItem& body, const wxChar* strCaption, const wxChar* strHref) const
{ {
/*
TXmlItem& table = body.AddChild("table"); TXmlItem& table = body.AddChild("table");
table.SetAttr("border", "2"); table.SetAttr("bgcolor", "#C0C0C0"); table.SetAttr("border", "2"); table.SetAttr("bgcolor", "#C0C0C0");
TXmlItem& td = table.AddChild("tr").AddChild("td"); TXmlItem& td = table.AddChild("tr").AddChild("td");
td.SetAttr("align", "center"); td.SetAttr("align", "center");
td.AddChild("a").SetAttr("href", strHref) << strCaption; td.AddChild("a").SetAttr("href", strHref) << strCaption;
return table; return table;
*/
TXmlItem& b = body.AddChild("button");
b.SetAttr("type", "button");
wxString strScript;
strScript += "window.open('";
strScript += strHref;
strScript += "', '_self')";
b.SetAttr("onClick", strScript);
b << strCaption;
return b;
} }
void TBaseServerApp::MessageBox(const wxChar* caption, const wxChar* msg, wxSocketBase& outs) void TBaseServerApp::MessageBox(const wxChar* caption, const wxChar* msg, wxSocketBase& outs)
@ -266,9 +277,12 @@ void TBaseServerApp::MessageBox(const wxChar* caption, const wxChar* msg, wxSock
td0.SetAttr("align", "justify"); td0.SetAttr("align", "justify");
td0.AddChild("h3") << msg; td0.AddChild("h3") << msg;
if (m_bRunning) // Aggiungi il bottone di ritorno solo se il server non si sta spegnendo
{
TXmlItem& td1 = table.AddChild("tr").AddChild("td"); TXmlItem& td1 = table.AddChild("tr").AddChild("td");
td1.SetAttr("align", "center"); td1.SetAttr("align", "center");
AddLinkButton(td1, "Return to main page", "index.htm"); AddLinkButton(td1, _("Return to main page"), "index.htm");
}
const wxString strTmp = GetTempFilename(); const wxString strTmp = GetTempFilename();
html.Save(strTmp); html.Save(strTmp);
@ -567,13 +581,16 @@ void TBaseServerApp::OnIdle(wxIdleEvent& evt)
if (CanProcessCommand(str, sock)) if (CanProcessCommand(str, sock))
{ {
const wxSocketFlags flags = sock.GetFlags();
if (valid_socket) if (valid_socket)
{
const wxSocketFlags flags = sock.GetFlags();
sock.SetFlags(wxSOCKET_WAITALL); sock.SetFlags(wxSOCKET_WAITALL);
ProcessCommand(str, sock); ProcessCommand(str, sock);
if (valid_socket)
sock.SetFlags(flags); sock.SetFlags(flags);
} }
else
ProcessCommand(str, sock); // Comandi come "UserLogout" vanno processati anche per socket non validi
}
// Enable input events again. // Enable input events again.

View File

@ -83,8 +83,8 @@ bool TLurchServer::PingProcess(const wxString& strApp)
if (nTimeOut > 5000) nTimeOut = 5000; if (nTimeOut > 5000) nTimeOut = 5000;
wxIPV4address ipAddress; wxIPV4address ipAddress;
// ipAddress.AnyAddress(); // Vadim Zetim lo consiglia ma non sempre funziona //ipAddress.AnyAddress(); // NON funziona con ESET
ipAddress.LocalHost(); // Vadim Zetim lo sconsiglia ma pare funzionare ipAddress.LocalHost(); // Pare funzionare sempre
ipAddress.Service(nPort); ipAddress.Service(nPort);
wxSocketClient sSock(wxSOCKET_NOWAIT); wxSocketClient sSock(wxSOCKET_NOWAIT);
sSock.Connect(ipAddress, false); sSock.Connect(ipAddress, false);
@ -99,7 +99,7 @@ bool TLurchServer::PingProcess(const wxString& strApp)
char buffer[8]; memset(buffer, 0, sizeof(buffer)); char buffer[8]; memset(buffer, 0, sizeof(buffer));
sSock.Read(buffer, 4); sSock.Read(buffer, 4);
if (sSock.WaitForRead(0, 1)) // ... ma poi non aspetto qua :-) if (sSock.WaitForRead(0, 1)) // ... ma poi non aspetto qua :-)
bPinged = wxStrncmp(buffer, "PONG", 4) == 0; bPinged = wxStrncmp(buffer, wxT("PONG"), 4) == 0;
sSock.Discard(); // Tralascia ulteriori dati in arrivo sSock.Discard(); // Tralascia ulteriori dati in arrivo
} }
else else