Patch level : 10.0
Files correlati : agalib, mg3 Ricompilazione Demo : [ ] Commento : 0001561: 002177 Pharmatex - excel da mastrini Con la patch 634 l'esportazione mastrini in excell non ha più l'intestazione colonne git-svn-id: svn://10.65.10.50/trunk@20177 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
bf26a8de33
commit
e580a22a67
@ -382,18 +382,20 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
add_prop(TR("Valuta"), f.codice_valuta());
|
||||
}
|
||||
else
|
||||
{
|
||||
add_prop(TR("Ragione Sociale"), campoini.get("Company"));
|
||||
}
|
||||
|
||||
add_cat(TR("Dati Stazione"));
|
||||
add_prop(TR("Sistema Operativo"), stros);
|
||||
add_prop(TR("Utente"), user());
|
||||
add_prop(TR("Computer"), strcpu);
|
||||
|
||||
TString16 strfree;
|
||||
const long mbfree = xvt_fsys_get_disk_free_space(study, 'M');
|
||||
TString16 strmb; strmb.format("%ld Mb", mbfree);
|
||||
add_prop(TR("Spazio su disco"), strmb);
|
||||
if (mbfree > 8192)
|
||||
strfree.format("%ld Gb", mbfree/1024);
|
||||
else
|
||||
strfree.format("%ld Mb", mbfree);
|
||||
add_prop(TR("Spazio su disco"), strfree);
|
||||
add_prop(TR("File temporanei"), temp);
|
||||
|
||||
TString printer;
|
||||
@ -420,7 +422,7 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
add_prop(TR("Libreria GUI"), strwx);
|
||||
add_prop(TR("Libreria PDF"), printer);
|
||||
add_prop(TR("Libreria SQL"), strsql);
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
add_prop(TR("Libreria C++"), format("%d %d.%d", _MSC_VER/100, _MSC_VER%100/10, _MSC_VER%10));
|
||||
#endif
|
||||
|
||||
|
@ -895,9 +895,9 @@ bool ini_set_bool(int cfg, const char* paragraph, const char* name, bool val, in
|
||||
return ini_set_string(filename, paragraph, name, val ? "1" : "0", idx);
|
||||
}
|
||||
|
||||
const TString& get_oem_info(const char* varname)
|
||||
const TString& get_oem_info(const char* varname, const char* def)
|
||||
{
|
||||
TString& tmp = get_tmp_string(50);
|
||||
xvt_sys_get_oem_string(varname, tmp, tmp.get_buffer(), tmp.size());
|
||||
xvt_sys_get_oem_string(varname, def, tmp.get_buffer(), tmp.size());
|
||||
return tmp;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ bool ini_set_bool (int cfg, const char* para, const char* name, bool
|
||||
bool ini_set_int (int cfg, const char* para, const char* name, int val, int idx = -1);
|
||||
bool ini_set_string(int cfg, const char* para, const char* name, const char* val, int idx = -1);
|
||||
|
||||
const TString& get_oem_info(const char* varname); // ini_get_string(CONFIG_OEM, "OEM_?", varname);
|
||||
const TString& get_oem_info(const char* varname, const char* defval = ""); // ini_get_string(CONFIG_OEM, "OEM_?", varname, defval);
|
||||
bool is_aga_version(bool power_user_only = false);
|
||||
|
||||
#endif
|
||||
|
@ -469,10 +469,10 @@ int TDongle::can_try_server() const
|
||||
|
||||
// Se sono un client ed ho l'indirizzo di authoriz sono obbligato ad usarlo
|
||||
const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
|
||||
if (dongle.full() && ini_get_int(CONFIG_INSTALL, "Main", "Type") == 3)
|
||||
return 3;
|
||||
if (dongle.full())
|
||||
return ini_get_int(CONFIG_INSTALL, "Main", "Type") == 3 ? 3 : 1;
|
||||
|
||||
return dongle.full();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TDongle::login(bool test_all_keys)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
#include <diction.h>
|
||||
#include <isamrpc.h>
|
||||
#include <netsock.h>
|
||||
|
||||
@ -18,7 +18,7 @@ bool rpc_Start()
|
||||
{
|
||||
delete _client;
|
||||
_client = NULL;
|
||||
ok = error_box("Errore di inizializzazione del socket client.");
|
||||
ok = error_box(TR("Errore di inizializzazione del socket client."));
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -64,7 +64,7 @@ char* rpc_Request(const char* cmd, size_t& size, real& total)
|
||||
static TString _rpc_call(256);
|
||||
static TString _rpc_string;
|
||||
|
||||
inline bool BoolCall()
|
||||
static bool BoolCall()
|
||||
{
|
||||
CHECK(_connection, "Server not connected");
|
||||
bool yes = false;
|
||||
@ -79,11 +79,19 @@ inline bool BoolCall()
|
||||
return yes;
|
||||
}
|
||||
|
||||
inline long IntCall()
|
||||
static long IntCall(int timeout = 0)
|
||||
{
|
||||
CHECK(_connection, "Server not connected");
|
||||
long n;
|
||||
bool ok = _client->RequestInteger(_connection, _rpc_call, n) != 0;
|
||||
long n = 0;
|
||||
bool ok = false;
|
||||
if (timeout > 0)
|
||||
{
|
||||
const int to = rpc_Timeout(timeout);
|
||||
ok = _client->RequestInteger(_connection, _rpc_call, n) != 0;
|
||||
rpc_Timeout(to);
|
||||
}
|
||||
else
|
||||
ok = _client->RequestInteger(_connection, _rpc_call, n) != 0;
|
||||
if (!ok)
|
||||
{
|
||||
#ifndef DBG
|
||||
@ -94,7 +102,7 @@ inline long IntCall()
|
||||
return n;
|
||||
}
|
||||
|
||||
inline TString& StrCall()
|
||||
static TString& StrCall()
|
||||
{
|
||||
CHECK(_connection, "Server not connected");
|
||||
bool ok = _client->RequestString(_connection, _rpc_call, _rpc_string) != 0;
|
||||
@ -108,67 +116,67 @@ inline TString& StrCall()
|
||||
return _rpc_string;
|
||||
}
|
||||
|
||||
inline bool BoolCallInt(const char* fn, long n)
|
||||
static bool BoolCallInt(const char* fn, long n)
|
||||
{
|
||||
_rpc_call.format("%s(%ld)", fn, n);
|
||||
return BoolCall();
|
||||
}
|
||||
|
||||
inline long IntCallInt(const char* fn, long n)
|
||||
static long IntCallInt(const char* fn, long n)
|
||||
{
|
||||
_rpc_call.format("%s(%ld)", fn, n);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline long IntCallIntInt(const char* fn, long n, long k)
|
||||
static long IntCallIntInt(const char* fn, long n, long k)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,%ld)", fn, n, k);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline long IntCallIntIntInt(const char* fn, long n, long k, long f)
|
||||
static long IntCallIntIntInt(const char* fn, long n, long k, long f)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,%ld,%ld)", fn, n, k, f);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline long IntCallIntIntStr(const char* fn, long n, long k, const char* str)
|
||||
static long IntCallIntIntStr(const char* fn, long n, long k, const char* str)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,%ld,|%s|)", fn, n, k, str);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline long IntCallIntStr(const char* fn, long n, const char* str)
|
||||
static long IntCallIntStr(const char* fn, long n, const char* str)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,|%s|)", fn, n, str);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline int IntCallIntStrInt(const char* fn, long n, const char* s, long f)
|
||||
static int IntCallIntStrInt(const char* fn, long n, const char* s, long f)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,|%s|,%ld)", fn, n, s, f);
|
||||
return (int)IntCall();
|
||||
}
|
||||
|
||||
inline long IntCallIntStrStr(const char* fn, long n, const char* str, const char* val)
|
||||
static long IntCallIntStrStr(const char* fn, long n, const char* str, const char* val)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,|%s|,|%s|)", fn, n, str, val);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline long IntCallStr(const char* fn, const char* str)
|
||||
static long IntCallStr(const char* fn, const char* str)
|
||||
{
|
||||
_rpc_call.format("%s(%s)", fn, str);
|
||||
return IntCall();
|
||||
}
|
||||
|
||||
inline TString& StrCallIntInt(const char* fn, long n, long k)
|
||||
static TString& StrCallIntInt(const char* fn, long n, long k)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,%ld)", fn, n, k);
|
||||
return StrCall();
|
||||
}
|
||||
|
||||
inline TString& StrCallIntStr(const char* fn, long n, const char* str)
|
||||
static TString& StrCallIntStr(const char* fn, long n, const char* str)
|
||||
{
|
||||
_rpc_call.format("%s(%ld,|%s|)", fn, n, str);
|
||||
return StrCall();
|
||||
@ -206,13 +214,13 @@ bool rpc_DongleModules(TBit_array& ba)
|
||||
unsigned rpc_DongleNumber()
|
||||
{
|
||||
_rpc_call = "DongleNumber()";
|
||||
return (unsigned)IntCall();
|
||||
return (unsigned)IntCall(5);
|
||||
}
|
||||
|
||||
unsigned rpc_DongleYear()
|
||||
{
|
||||
_rpc_call = "DongleYear()";
|
||||
return (unsigned)IntCall();
|
||||
return (unsigned)IntCall(5);
|
||||
}
|
||||
|
||||
bool rpc_DongleInfo(word& number, word& year, TBit_array& ba)
|
||||
@ -247,7 +255,7 @@ bool rpc_DongleInfo(word& number, word& year, TBit_array& ba)
|
||||
}
|
||||
|
||||
|
||||
static unsigned int CreatePassword(TString& pass)
|
||||
static unsigned int create_password(TString& pass)
|
||||
{
|
||||
const int BASE = 19;
|
||||
unsigned int num = 0;
|
||||
@ -286,7 +294,11 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
const bool local = server == NULL || *server == '\0' ||
|
||||
xvt_str_compare_ignoring_case(server, "127.0.0.1") == 0 ||
|
||||
xvt_str_compare_ignoring_case(server, "localhost") == 0;
|
||||
const TString name = local ? "locale" : server;
|
||||
TString80 name;
|
||||
if (local)
|
||||
xvt_sys_get_host_name(name.get_buffer(), name.size());
|
||||
else
|
||||
name = server;
|
||||
|
||||
if (_connection != 0)
|
||||
_client->RemoveConnection(_connection);
|
||||
@ -297,8 +309,7 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
if (_connection)
|
||||
{
|
||||
TString16 password;
|
||||
|
||||
CreatePassword(password);
|
||||
create_password(password);
|
||||
|
||||
const int session = xvt_sys_get_session_id();
|
||||
_rpc_call.format("UserLogin(%s,%s,%s,%d)", user, (const char*)password, application, session);
|
||||
@ -310,14 +321,14 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
const bool logged = (answer == 1) || ((answer % 883 == 0) && (answer != 0));
|
||||
if (!logged)
|
||||
{
|
||||
connected = FALSE;
|
||||
error.format("La connessione di %s e' stata rifiutata dal Server %s",
|
||||
connected = false;
|
||||
error.format(FR("La connessione di %s e' stata rifiutata dal Server %s"),
|
||||
(const char*)user, (const char*)name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.format("Impossibile connettersi al Server %s", (const char*)name);
|
||||
error.format(FR("Impossibile connettersi al Server %s"), (const char*)name);
|
||||
}
|
||||
|
||||
if (!connected)
|
||||
@ -329,7 +340,7 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
else
|
||||
{
|
||||
if (!local)
|
||||
error.format("Impossibile connettersi al Server %s", (const char*)name);
|
||||
error.format(FR("Impossibile connettersi al Server %s"), (const char*)name);
|
||||
}
|
||||
|
||||
if (error.not_empty())
|
||||
@ -358,7 +369,7 @@ bool http_isredirected_server(TString& server,
|
||||
{
|
||||
TSocketClient client;
|
||||
if (!client.IsOk())
|
||||
return error_box("Impossibile inizializzare il client HTTP");
|
||||
return error_box(TR("Impossibile inizializzare il client HTTP"));
|
||||
|
||||
CONNID connection = client.QueryConnection("80", server);
|
||||
bool ok = connection != 0;
|
||||
@ -375,7 +386,7 @@ bool http_get(const char* server, const char* remote_file, const char* local_fil
|
||||
{
|
||||
TSocketClient client;
|
||||
if (!client.IsOk())
|
||||
return error_box("Impossibile inizializzare il client HTTP");
|
||||
return error_box(TR("Impossibile inizializzare il client HTTP"));
|
||||
|
||||
CONNID connection = client.QueryConnection("80", server);
|
||||
bool ok = connection != 0;
|
||||
@ -392,7 +403,7 @@ bool http_dir(const char* server, const char* remote_dir, TString_array& list)
|
||||
{
|
||||
TSocketClient client;
|
||||
if (!client.IsOk())
|
||||
return error_box("Impossibile inizializzare il client HTTP");
|
||||
return error_box(TR("Impossibile inizializzare il client HTTP"));
|
||||
|
||||
unsigned long connection = client.QueryConnection("80", server);
|
||||
bool ok = connection != 0;
|
||||
@ -412,7 +423,7 @@ bool http_post(const char* server, const char* remote_file,
|
||||
{
|
||||
TSocketClient client;
|
||||
if (!client.IsOk())
|
||||
return error_box("Impossibile inizializzare il client HTTP");
|
||||
return error_box(TR("Impossibile inizializzare il client HTTP"));
|
||||
|
||||
unsigned long connection = client.QueryConnection("80", server);
|
||||
bool ok = connection != 0;
|
||||
@ -424,12 +435,12 @@ bool http_post(const char* server, const char* remote_file,
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
error_box("Impossibile spedire il file %s al server %s:\n%s",
|
||||
error_box(FR("Impossibile spedire il file %s al server %s:\n%s"),
|
||||
local_file, server, answer);
|
||||
}
|
||||
}
|
||||
else
|
||||
return error_box("Impossibile connettersi al server %s", server);
|
||||
return error_box(FR("Impossibile connettersi al server %s"), server);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -177,25 +177,6 @@ void TMailbox::send(TMessage& m)
|
||||
fto.close();
|
||||
}
|
||||
|
||||
void TMailbox::sendcmd(int argc, char* argv[], char* to)
|
||||
{
|
||||
NFCHECK("MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
// parse argv[i]
|
||||
// create new message
|
||||
// send it out
|
||||
}
|
||||
}
|
||||
|
||||
char* TMailbox::readcmd(char*)
|
||||
{
|
||||
// filters all messages to recipient and adds to to_path
|
||||
NFCHECK("MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
|
||||
// TMessage* m;
|
||||
return "NOT YET IMPLEMENTED";
|
||||
}
|
||||
|
||||
TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY)
|
||||
{
|
||||
if (appname == NULL)
|
||||
@ -206,7 +187,7 @@ TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY)
|
||||
|
||||
_lastread =0; _lastpos = 0l;
|
||||
n_new = 0;
|
||||
this->reread();
|
||||
reread();
|
||||
restart();
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class TMailbox : public TObject
|
||||
// @cmember:(INTERNAL) Numero di messaggi in attesa di lettura
|
||||
int n_new;
|
||||
// @cmember:(INTERNAL) Posizione nel file dell'ultimo messaggio letto
|
||||
long _lastpos;
|
||||
streamoff _lastpos;
|
||||
// @cmember:(INTERNAL) Indice dei messaggi letti e non letti
|
||||
int _cnt;
|
||||
|
||||
@ -140,11 +140,6 @@ public:
|
||||
TMessage* next_f(char* f, bool read = FALSE);
|
||||
// @cmember Manda un messaggio
|
||||
void send(TMessage& m);
|
||||
// @cmember Trasforma gli argomenti della command line in messaggi mail (NON IMPLEMENTATA)
|
||||
void sendcmd(int argc, char* argv[],char* to);
|
||||
// @cmember Trasforma una mailbox in parametri per la command line per la
|
||||
// chaimata di applicazioni non compilanti (NON IMPLEMENTATA)
|
||||
char* readcmd(char* to = NULL);
|
||||
// @cmember Ritorna l'<p n>-esimo messaggio
|
||||
TMessage* get(int n)
|
||||
{ return (TMessage*)_msgs.objptr(n); }
|
||||
|
@ -594,30 +594,29 @@ bool TSocket_connection::Read(byte* buf, size_t size)
|
||||
|
||||
bool TSocket_connection::ReadTimeout(byte* buf, size_t size, int timeout)
|
||||
{
|
||||
return Read(buf, size);
|
||||
|
||||
/* Non va micca
|
||||
if (timeout <= 0)
|
||||
return Read(buf, size);
|
||||
skstream* calza = GetSocket();
|
||||
bool ok = calza != NULL && calza->good();
|
||||
if (ok)
|
||||
{
|
||||
SOCKET s = calza->getsocket();
|
||||
|
||||
// Set new timeout
|
||||
struct timeval tv; memset(&tv, 0, sizeof(tv)); tv.tv_sec = timeout;
|
||||
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv));
|
||||
|
||||
calza->read((char*)buf, size);
|
||||
ok = calza->gcount() == size;
|
||||
|
||||
// Reset old timeout
|
||||
memset(&tv, 0, sizeof(tv));
|
||||
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv));
|
||||
clock_t cWaited = 0; // msec waited so far
|
||||
clock_t cToWait = 67; // next time slice to wait 67+134+268+536=1005
|
||||
ok = false;
|
||||
while (!ok && cWaited < timeout*1000)
|
||||
{
|
||||
xvt_sys_sleep(cToWait); // wait a bit
|
||||
cWaited += cToWait; // increment waited time
|
||||
cToWait = min(cToWait*2, 1000); // compute next waiting slice
|
||||
ok = ::recv(calza->getsocket(), (char*)buf, 1, MSG_PEEK)>0; // Peek for incoming data
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
calza->read((char*)buf, size);
|
||||
ok = calza->gcount() == size;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
*/
|
||||
}
|
||||
|
||||
bool TSocket_connection::connect()
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <applicat.h>
|
||||
#include <codeb.h>
|
||||
#include <colors.h>
|
||||
#include <dongle.h>
|
||||
#include <modaut.h>
|
||||
#include <progind.h>
|
||||
#include <recset.h>
|
||||
@ -93,29 +95,42 @@ const TToken_string& TRecordset::sheet_head() const
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
bool TRecordset::save_as_html(const char* path)
|
||||
{
|
||||
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
|
||||
ofstream out(path);
|
||||
out << "<html>" << endl;
|
||||
save_html_head(out, main_app().title());
|
||||
out << "<body>" << endl;
|
||||
|
||||
TString qry; parsed_text(qry);
|
||||
for (int i = qry.find('\n'); i > 0; i = qry.find('\n', i+1))
|
||||
qry.insert("<br/>", i+1);
|
||||
if (qry.full())
|
||||
{
|
||||
for (int i = qry.find('\n'); i > 0; i = qry.find('\n', i+1))
|
||||
qry.insert("<br/>", i+1);
|
||||
out << "<p><b>" << qry << "</b></p>" << endl;
|
||||
}
|
||||
|
||||
out << "<p><b>" << qry << "</b></p>" << endl;
|
||||
|
||||
out << "<table border=\"1\">" << endl;
|
||||
out << "<table border=\"1\">";
|
||||
out << " <caption>" << main_app().title() << "</caption>" << endl;
|
||||
|
||||
const unsigned int cols = columns();
|
||||
if (cols > 0)
|
||||
{
|
||||
out << " <thead>";
|
||||
out << " <thead>" << endl;
|
||||
for (unsigned int c = 0; c < cols; c++)
|
||||
{
|
||||
const TRecordset_column_info& ci = column_info(c);
|
||||
TToken_string header(ci._name, '.');
|
||||
out << " <col align=\""
|
||||
<< (ci._type == _longfld || ci._type == _realfld ? "right" : "left")
|
||||
<< "\">" << endl;
|
||||
}
|
||||
out << " <tr>" << endl;
|
||||
for (unsigned int c = 0; c < cols; c++)
|
||||
{
|
||||
const TRecordset_column_info& ci = column_info(c);
|
||||
TToken_string header(ci._name, '\n');
|
||||
TString str;
|
||||
FOR_EACH_TOKEN(header, tok)
|
||||
{
|
||||
@ -123,35 +138,43 @@ bool TRecordset::save_as_html(const char* path)
|
||||
str << "<br/>";
|
||||
str << tok;
|
||||
}
|
||||
out << " <th>" << str << "</th>" << endl;
|
||||
out << " <th>" << str << "</th>" << endl;
|
||||
}
|
||||
out << " </tr>" << endl;
|
||||
out << " </thead>" << endl;
|
||||
}
|
||||
|
||||
out << " <tbody>" << endl;
|
||||
TString val;
|
||||
for (bool ok = move_first(); ok; ok = move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
out << " <tr>" << endl;
|
||||
out << " <tr>" << endl;
|
||||
for (unsigned int c = 0; c < cols; c++)
|
||||
{
|
||||
const TRecordset_column_info& ci = column_info(c);
|
||||
out << " <td";
|
||||
out << " <td>";
|
||||
if (ci._type == _longfld || ci._type == _realfld)
|
||||
out << " align=\"right\"";
|
||||
out << ">";
|
||||
get(c).as_string(val);
|
||||
if (!val.blank())
|
||||
{
|
||||
const real r = get(c).as_real();
|
||||
if (r.is_zero())
|
||||
val.cut(0);
|
||||
else
|
||||
val = r.stringe();
|
||||
}
|
||||
else
|
||||
get(c).as_string(val);
|
||||
if (val.full())
|
||||
{
|
||||
val.rtrim();
|
||||
out << val;
|
||||
}
|
||||
out << " </td>" << endl;
|
||||
out << "</td>" << endl;
|
||||
}
|
||||
out << " </tr>" << endl;
|
||||
out << " </tr>" << endl;
|
||||
}
|
||||
|
||||
out << " </tbody>" << endl;
|
||||
out << "</table>" << endl;
|
||||
out << "</body>" << endl;
|
||||
out << "</html>" << endl;
|
||||
|
@ -6,11 +6,13 @@
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
#include <controls.h>
|
||||
#include <dongle.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
#include <toolfld.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <xml.h>
|
||||
#include <xvtility.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -208,7 +210,7 @@ TSheet_control::TSheet_control(
|
||||
rct.top, rct.left, rct.bottom-rct.top,
|
||||
XI_ATR_ENABLED | XI_ATR_VISIBLE | XI_ATR_NAVIGATE,
|
||||
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
|
||||
NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled
|
||||
DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled
|
||||
FOCUS_COLOR, // active
|
||||
0);
|
||||
|
||||
@ -1346,8 +1348,8 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TSheet& s = (TSheet&)f.mask();
|
||||
TString cap; s.get_caption(cap);
|
||||
for (char* buf = cap.get_buffer(); *buf; buf++)
|
||||
TString caption; s.get_caption(caption);
|
||||
for (char* buf = caption.get_buffer(); *buf; buf++)
|
||||
{
|
||||
switch (*buf)
|
||||
{
|
||||
@ -1360,47 +1362,69 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
cap.strip_spaces();
|
||||
if (cap.blank())
|
||||
cap = "export";
|
||||
if (caption.blank())
|
||||
caption = main_app().title();
|
||||
|
||||
TString cap = caption; cap.strip_spaces();
|
||||
TFilename name;
|
||||
name.tempdir(); name.add(cap); name.ext("xls");
|
||||
if (name.full()) // Dummy test
|
||||
{
|
||||
ofstream xls(name);
|
||||
const char sep = '\t';
|
||||
TToken_string tab(128, sep);
|
||||
|
||||
TString str;
|
||||
xls << "<html>" << endl;
|
||||
save_html_head(xls, caption);
|
||||
xls << "<body>" << endl;
|
||||
xls << " <table border=\"1\">" << endl;
|
||||
xls << " <caption>" << caption << "</caption>" << endl;
|
||||
xls << " <thead>" << endl;
|
||||
|
||||
int columns = 0;
|
||||
XI_OBJ** pcols = xi_get_member_list(s._sheet->xi_object(), &columns);
|
||||
|
||||
for (int c = 1; c < columns; c++)
|
||||
{
|
||||
const int idx = pcols[c]->cid - 1101;
|
||||
const char ct = s._sheet->column_type(idx);
|
||||
xls << " <col align=\"" << (strchr("PRV", ct) ? "right" : "left") << "\">" << endl;
|
||||
}
|
||||
|
||||
xls << " <tr>" << endl;
|
||||
|
||||
TString str;
|
||||
for (int c = 1; c < columns; c++)
|
||||
{
|
||||
xi_get_text(pcols[c], str.get_buffer(), str.size());
|
||||
tab.add(clean_white_space(str));
|
||||
xls << " <th>" << clean_white_space(str) << "</th>" << endl;
|
||||
}
|
||||
xls << tab << endl;
|
||||
|
||||
xls << " </tr>" << endl;
|
||||
xls << " </thead>" << endl;
|
||||
xls << " <tbody>" << endl;
|
||||
for (long i = 0; i < s.items(); i++)
|
||||
{
|
||||
const TToken_string& r = s.row(i);
|
||||
tab.cut(0);
|
||||
xls << " <tr>" << endl;
|
||||
for (int c = 1; c < columns; c++)
|
||||
{
|
||||
xls << " <td>";
|
||||
const int idx = pcols[c]->cid - 1101;
|
||||
r.get(idx, str);
|
||||
clean_white_space(str);
|
||||
if (str.not_empty())
|
||||
if (str.full())
|
||||
{
|
||||
const char ct = s._sheet->column_type(idx);
|
||||
if (ct == 'P' || ct == 'V')
|
||||
xvt_str_number_format(str.get_buffer(), str.size());
|
||||
tab.add(str, c-1);
|
||||
xls << str;
|
||||
}
|
||||
xls << "</td>" << endl;
|
||||
}
|
||||
xls << tab << endl;
|
||||
xls << " </tr>" << endl;
|
||||
}
|
||||
xls << " </tbody>" << endl;
|
||||
xls << " </table>" << endl;
|
||||
xls << "</body>" << endl;
|
||||
xls << "</html>" << endl;
|
||||
}
|
||||
if (name.exist())
|
||||
xvt_sys_goto_url(name, "open");
|
||||
|
@ -603,10 +603,12 @@ bool is_power_reseller(bool power_user_only)
|
||||
bool expand_sys_vars(TString& str)
|
||||
{
|
||||
bool found = false;
|
||||
for (int i = str.find("$("); i >= 0; i = str.find("$("))
|
||||
{
|
||||
TString value;
|
||||
TString value(_MAX_PATH);
|
||||
|
||||
int i = 0;
|
||||
while ((i = str.find("$(")) >= 0)
|
||||
{
|
||||
value.cut(0);
|
||||
int j = str.find(')', i);
|
||||
if (j < 0) j = i+2;
|
||||
const TString& name = str.sub(i+2, j);
|
||||
@ -618,6 +620,10 @@ bool expand_sys_vars(TString& str)
|
||||
{
|
||||
value = user();
|
||||
} else
|
||||
if (name.compare("LoginName", -1, true) == 0)
|
||||
{
|
||||
xvt_sys_get_user_name(value.get_buffer(), value.len());
|
||||
} else
|
||||
if (name.compare("Session", -1, true) == 0)
|
||||
{
|
||||
value << xvt_sys_get_session_id();
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "real.h"
|
||||
#include "xml.h"
|
||||
#include <colors.h>
|
||||
#include <dongle.h>
|
||||
#include <real.h>
|
||||
#include <xml.h>
|
||||
|
||||
#include <incstr.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Utilities
|
||||
@ -107,6 +108,13 @@ void WriteXmlString(ostream& outf, const char* str)
|
||||
}
|
||||
}
|
||||
|
||||
void WriteXmlColor(ostream& out, COLOR rgb)
|
||||
{
|
||||
TString8 str;
|
||||
str.format("#%02X%02X%02X", XVT_COLOR_GET_RED(rgb), XVT_COLOR_GET_GREEN(rgb), XVT_COLOR_GET_BLUE(rgb));
|
||||
out << str;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TXmlAttr
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -575,3 +583,15 @@ TXmlItem::~TXmlItem()
|
||||
delete m_Children;
|
||||
}
|
||||
|
||||
void save_html_head(ostream& out, const char* title)
|
||||
{
|
||||
out << "<head>" << endl;
|
||||
out << " <title>" << title << "</title>" << endl;
|
||||
out << " <meta name=\"author\" content=\"" << user() << "\" />" << endl;
|
||||
out << " <meta name=\"application\" content=\"" << dongle().product() << "\"/>" << endl;
|
||||
out << " <meta name=\"vendor\" content=\"" << dongle().reseller() << "\"/>" << endl;
|
||||
out << " <style type=\"text/css\">" << endl;
|
||||
out << " th = { background-color:"; WriteXmlColor(out, BTN_BACK_COLOR); out << " }" << endl;
|
||||
out << " </style>" << endl;
|
||||
out << "</head>" << endl;
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ TXmlItem& operator<<(TXmlItem& item, const char* str);
|
||||
void Spaces(ostream& outf, int nSpaces);
|
||||
void WriteXmlString(ostream& outf, const char* str);
|
||||
int hex2int(const char* str);
|
||||
void save_html_head(ostream& out, const char* title);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user