sc3100.cpp Aggiunta gestione della mailbox (copiata dalla relapp)
sc3100a.uml Specificati i campi chiave e field in modo da simulare relapp git-svn-id: svn://10.65.10.50/trunk@4371 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
07c3de37c9
commit
7ef9201c1c
103
sc/sc3100.cpp
103
sc/sc3100.cpp
@ -8,6 +8,8 @@
|
|||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <mailbox.h>
|
||||||
|
|
||||||
#include "sc3.h"
|
#include "sc3.h"
|
||||||
#include "sc3100a.h"
|
#include "sc3100a.h"
|
||||||
#include "sc3100b.h"
|
#include "sc3100b.h"
|
||||||
@ -31,6 +33,7 @@ class TForm_EC : public TForm
|
|||||||
protected:
|
protected:
|
||||||
virtual void pre_edit_checks(TMask& m, TPrint_section* sec);
|
virtual void pre_edit_checks(TMask& m, TPrint_section* sec);
|
||||||
virtual bool post_edit_checks(TMask& m, TPrint_section* sec);
|
virtual bool post_edit_checks(TMask& m, TPrint_section* sec);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual const char* section_mask() { return "sc3100s" ;}
|
virtual const char* section_mask() { return "sc3100s" ;}
|
||||||
virtual void change_number_format(int w, int dec, const char* p);
|
virtual void change_number_format(int w, int dec, const char* p);
|
||||||
@ -79,8 +82,8 @@ bool TForm_EC::post_edit_checks(TMask& m, TPrint_section* sec)
|
|||||||
|
|
||||||
void TForm_EC::change_number_format(int w, int dec, const char* p)
|
void TForm_EC::change_number_format(int w, int dec, const char* p)
|
||||||
{
|
{
|
||||||
char secs[] = { "FB" };
|
const char* const secs = "FB";
|
||||||
char ptyp[] = { "LOEF" };
|
const char* const ptyp = "LOEF";
|
||||||
TPrint_section* ps;
|
TPrint_section* ps;
|
||||||
|
|
||||||
for (int sc = 0; sc < 4; sc++)
|
for (int sc = 0; sc < 4; sc++)
|
||||||
@ -93,6 +96,7 @@ class TForm_EC_editor : public TForm_editor
|
|||||||
{
|
{
|
||||||
s_data _prm;
|
s_data _prm;
|
||||||
TMask * _msk; // maschera di selezione sezione
|
TMask * _msk; // maschera di selezione sezione
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool cpy_handler(TMask_field& f, KEY k);
|
static bool cpy_handler(TMask_field& f, KEY k);
|
||||||
static bool font_handler(TMask_field& f, KEY k);
|
static bool font_handler(TMask_field& f, KEY k);
|
||||||
@ -111,11 +115,16 @@ protected:
|
|||||||
void hide_body_items(TPrint_section* b);
|
void hide_body_items(TPrint_section* b);
|
||||||
void show_body_items(TPrint_section* b);
|
void show_body_items(TPrint_section* b);
|
||||||
void remove_form(TLocalisamfile& frm, TLocalisamfile& rfr,const TString& t,const TString& c);
|
void remove_form(TLocalisamfile& frm, TLocalisamfile& rfr,const TString& t,const TString& c);
|
||||||
|
|
||||||
virtual const char* selection_mask() const { return "sc3100a"; }
|
virtual const char* selection_mask() const { return "sc3100a"; }
|
||||||
virtual bool ask_profile();
|
virtual bool ask_profile();
|
||||||
virtual bool edit(char s, pagetype p);
|
virtual bool edit(char s, pagetype p);
|
||||||
virtual void print();
|
virtual void print();
|
||||||
|
|
||||||
|
bool check_mailbox(TMask& m);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TForm_EC_editor() {_msk = NULL;}
|
TForm_EC_editor() {_msk = NULL;}
|
||||||
virtual ~TForm_EC_editor() {}
|
virtual ~TForm_EC_editor() {}
|
||||||
};
|
};
|
||||||
@ -402,7 +411,7 @@ bool TForm_EC_editor::recalculate_positions(const char* name, int size)
|
|||||||
xvt_print_start_thread (wprms, (long)&_prm);
|
xvt_print_start_thread (wprms, (long)&_prm);
|
||||||
xvt_print_close();
|
xvt_print_close();
|
||||||
|
|
||||||
const char sechar[4] = { 'B', 'F', 'G', 'H' };
|
const char* const sechar = "BFGH";
|
||||||
for (int sn = 0; sn < 4 ; sn++)
|
for (int sn = 0; sn < 4 ; sn++)
|
||||||
{
|
{
|
||||||
const char sc = sechar[sn];
|
const char sc = sechar[sn];
|
||||||
@ -415,10 +424,10 @@ bool TForm_EC_editor::recalculate_positions(const char* name, int size)
|
|||||||
void TForm_EC_editor::remove_temp_items(char sec, pagetype p)
|
void TForm_EC_editor::remove_temp_items(char sec, pagetype p)
|
||||||
{
|
{
|
||||||
TPrint_section* s = form().exist(sec,p);
|
TPrint_section* s = form().exist(sec,p);
|
||||||
if (s!=NULL)
|
if (s != NULL)
|
||||||
{
|
{
|
||||||
const word items = s->fields();
|
const word items = s->fields();
|
||||||
for (word j=0;j<items; j++)
|
for (word j=0; j < items; j++)
|
||||||
{
|
{
|
||||||
if (s->field(j).temp())
|
if (s->field(j).temp())
|
||||||
s->destroy_field(j,FALSE);
|
s->destroy_field(j,FALSE);
|
||||||
@ -830,20 +839,24 @@ void TForm_EC_editor::remove_form(TLocalisamfile& frm, TLocalisamfile& rfr,const
|
|||||||
bool TForm_EC_editor::ask_profile()
|
bool TForm_EC_editor::ask_profile()
|
||||||
{
|
{
|
||||||
KEY k;
|
KEY k;
|
||||||
mask().set_handler(DLG_COPY,cpy_handler);
|
|
||||||
mask().set_handler(F_CODE,code_handler);
|
|
||||||
mask().set_handler(F_CODEL,lng_handler);
|
|
||||||
mask().set(F_BASE,BASE_EC_PROFILE);
|
|
||||||
|
|
||||||
|
TMask& m = mask();
|
||||||
|
m.set_handler(DLG_COPY,cpy_handler);
|
||||||
|
m.set_handler(F_CODE,code_handler);
|
||||||
|
m.set_handler(F_CODEL,lng_handler);
|
||||||
|
m.set(F_BASE,BASE_EC_PROFILE);
|
||||||
disable_menu_item(M_FILE_PRINT);
|
disable_menu_item(M_FILE_PRINT);
|
||||||
while ((k = mask().run()) != K_QUIT)
|
|
||||||
|
check_mailbox(m);
|
||||||
|
|
||||||
|
while ((k = m.run()) != K_QUIT)
|
||||||
{
|
{
|
||||||
TLocalisamfile frm(LF_FORM);
|
TLocalisamfile frm(LF_FORM);
|
||||||
TLocalisamfile rfr(LF_RFORM);
|
TLocalisamfile rfr(LF_RFORM);
|
||||||
TString fform = mask().get(F_BASE);
|
TString fform = m.get(F_BASE);
|
||||||
TString fdesc = mask().get(F_DESC);
|
TString fdesc = m.get(F_DESC);
|
||||||
long fcode = mask().get_long(F_CODE);
|
long fcode = m.get_long(F_CODE);
|
||||||
char flng = mask().get(F_CODEL)[0];
|
char flng = m.get(F_CODEL)[0];
|
||||||
TString cod;
|
TString cod;
|
||||||
cod.format("%04ld%c",fcode,flng);
|
cod.format("%04ld%c",fcode,flng);
|
||||||
if (!extra() && fcode == 0 && flng=='\0')
|
if (!extra() && fcode == 0 && flng=='\0')
|
||||||
@ -892,6 +905,68 @@ bool TForm_EC_editor::ask_profile()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TForm_EC_editor::check_mailbox(TMask& m)
|
||||||
|
{
|
||||||
|
TMailbox mail;
|
||||||
|
TMessage* msg = mail.next_s(MSG_ED);
|
||||||
|
if (msg)
|
||||||
|
{
|
||||||
|
TToken_string body(msg->body());
|
||||||
|
const int key = body.get_int();
|
||||||
|
|
||||||
|
TAssoc_array field_values;
|
||||||
|
const char * s;
|
||||||
|
TString80 t;
|
||||||
|
|
||||||
|
while((s = body.get()) != NULL)
|
||||||
|
{
|
||||||
|
t = s;
|
||||||
|
const int u = t.find('=');
|
||||||
|
|
||||||
|
CHECKS(u > 0, "Invalid edit message ", (const char *) body);
|
||||||
|
if (u > 0)
|
||||||
|
{
|
||||||
|
const TString v(t.mid(u + 1));
|
||||||
|
|
||||||
|
t.cut(u);
|
||||||
|
field_values.add(t, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TString val;
|
||||||
|
for (TEditable_field* e = m.get_key_field(key, TRUE); e; e = m.get_key_field(key, FALSE))
|
||||||
|
{
|
||||||
|
const TFieldref* field = e->field();
|
||||||
|
if (field)
|
||||||
|
{
|
||||||
|
TString16 field_name(field->name());
|
||||||
|
const int from = field->from();
|
||||||
|
const int to = field->to();
|
||||||
|
|
||||||
|
if (to >= 0)
|
||||||
|
field_name << "[" << (from + 1);
|
||||||
|
const TString * v = (const TString *) field_values.objptr(field_name);
|
||||||
|
|
||||||
|
if (v == NULL && to >= 0)
|
||||||
|
{
|
||||||
|
v = (const TString *)field_values.objptr(field->name());
|
||||||
|
if (v)
|
||||||
|
val = v->sub(from, to);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (v) val = *v;
|
||||||
|
|
||||||
|
if (v)
|
||||||
|
e->set(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.send_key(K_AUTO_ENTER, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int sc3100(int argc, char** argv)
|
int sc3100(int argc, char** argv)
|
||||||
{
|
{
|
||||||
TForm_EC_editor a;
|
TForm_EC_editor a;
|
||||||
|
111
sc/sc3100a.uml
111
sc/sc3100a.uml
@ -6,81 +6,90 @@ PAGE "Scelta profilo" -1 -1 75 6
|
|||||||
|
|
||||||
STRING F_BASE 8
|
STRING F_BASE 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 1 "Profilo base "
|
PROMPT 2 1 "Profilo base "
|
||||||
FLAGS "DP"
|
FLAGS "DP"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_CODE 4
|
NUMBER F_CODE 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 2 "Codice profilo "
|
PROMPT 2 2 "Codice profilo "
|
||||||
FLAGS "Z"
|
FLAGS "Z"
|
||||||
HELP "Codice del profilo"
|
HELP "Codice del profilo"
|
||||||
USE LF_FORM
|
USE LF_FORM
|
||||||
JOIN %LNG TO LF_FORM ALIAS 200 INTO CODTAB==CODPROF[5,5]
|
JOIN %LNG TO LF_FORM ALIAS 200 INTO CODTAB==CODPROF[5,5]
|
||||||
INPUT TIPOPROF F_BASE SELECT
|
INPUT TIPOPROF F_BASE SELECT
|
||||||
INPUT CODPROF[1,4] F_CODE
|
INPUT CODPROF[1,4] F_CODE
|
||||||
INPUT CODPROF[5,5] F_CODEL
|
INPUT CODPROF[5,5] F_CODEL
|
||||||
DISPLAY "Profilo base" TIPOPROF
|
DISPLAY "Profilo base" TIPOPROF
|
||||||
DISPLAY "Codice" CODPROF[1,4]
|
DISPLAY "Codice" CODPROF[1,4]
|
||||||
DISPLAY "Lingua" CODPROF[5,5]
|
DISPLAY "Lingua" CODPROF[5,5]
|
||||||
DISPLAY "Descrizione@50" DESC
|
DISPLAY "Descrizione@50" DESC
|
||||||
DISPLAY "Desc. Lingua@50" -200->S0
|
DISPLAY "Desc. Lingua@50" -200->S0
|
||||||
OUTPUT F_BASE TIPOPROF
|
OUTPUT F_BASE TIPOPROF
|
||||||
OUTPUT F_CODE CODPROF[1,4]
|
OUTPUT F_CODE CODPROF[1,4]
|
||||||
OUTPUT F_CODEL CODPROF[5,5]
|
OUTPUT F_CODEL CODPROF[5,5]
|
||||||
OUTPUT F_DESC DESC
|
OUTPUT F_DESC DESC
|
||||||
|
// Simula relapp
|
||||||
|
KEY 1
|
||||||
|
FIELD CODPROF[1,4]
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_CODEL 1
|
STRING F_CODEL 1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 2 "Codice lingua "
|
PROMPT 40 2 "Codice lingua "
|
||||||
FLAGS "U"
|
FLAGS "U"
|
||||||
HELP "Codice lingua del profilo"
|
HELP "Codice lingua del profilo"
|
||||||
USE %LNG
|
USE %LNG
|
||||||
INPUT CODTAB F_CODEL
|
INPUT CODTAB F_CODEL
|
||||||
DISPLAY "Codice lingua" CODTAB
|
DISPLAY "Codice lingua" CODTAB
|
||||||
DISPLAY "Decrizione@50" S0
|
DISPLAY "Decrizione@50" S0
|
||||||
OUTPUT F_CODEL CODTAB
|
OUTPUT F_CODEL CODTAB
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
|
// Simula relapp
|
||||||
|
KEY 1
|
||||||
|
FIELD CODPROF[5,5]
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DESC 50
|
STRING F_DESC 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 3 "Descrizione "
|
PROMPT 2 3 "Descrizione "
|
||||||
HELP "Descrizione profilo utente"
|
HELP "Descrizione profilo utente"
|
||||||
USE LF_FORM KEY 2
|
USE LF_FORM KEY 2
|
||||||
JOIN %LNG TO LF_FORM ALIAS 200 INTO CODTAB==CODPROF[5,5]
|
JOIN %LNG TO LF_FORM ALIAS 200 INTO CODTAB==CODPROF[5,5]
|
||||||
INPUT TIPOPROF F_BASE SELECT
|
INPUT TIPOPROF F_BASE SELECT
|
||||||
INPUT DESC F_DESC
|
INPUT DESC F_DESC
|
||||||
DISPLAY "Descrizione@50" DESC
|
DISPLAY "Descrizione@50" DESC
|
||||||
DISPLAY "Profilo base" TIPOPROF
|
DISPLAY "Profilo base" TIPOPROF
|
||||||
DISPLAY "Codice" CODPROF[1,4]
|
DISPLAY "Codice" CODPROF[1,4]
|
||||||
DISPLAY "Lingua" CODPROF[5,5]
|
DISPLAY "Lingua" CODPROF[5,5]
|
||||||
DISPLAY "Desc. Lingua@50" -200->S0
|
DISPLAY "Desc. Lingua@50" -200->S0
|
||||||
COPY OUTPUT F_CODE
|
COPY OUTPUT F_CODE
|
||||||
VALIDATE NOT_EMPTY_FUNC
|
VALIDATE NOT_EMPTY_FUNC
|
||||||
WARNING "La descrizione e' obbligatoria"
|
WARNING "La descrizione e' obbligatoria"
|
||||||
|
// Simula relapp
|
||||||
|
KEY 2
|
||||||
|
FIELD S0
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_OK 9 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -14 -1 ""
|
PROMPT -14 -1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_DELREC 9 2
|
BUTTON DLG_DELREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -24 -1 ""
|
PROMPT -24 -1 ""
|
||||||
MESSAGE EXIT,K_DEL
|
MESSAGE EXIT,K_DEL
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_COPY 9 2
|
BUTTON DLG_COPY 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -34 -1 "C~opia..."
|
PROMPT -34 -1 "C~opia..."
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_QUIT 9 2
|
BUTTON DLG_QUIT 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -44 -1 ""
|
PROMPT -44 -1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user