summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPixel <Pixel>2001-09-20 23:27:01 +0000
committerPixel <Pixel>2001-09-20 23:27:01 +0000
commit8346d0774d2d1e076038db27f65f1d082a460f16 (patch)
tree132f84cf1ef45d5006a2b1d52d4d40b1e8e51abc /src
Initial revision
Diffstat (limited to 'src')
-rw-r--r--src/Main.cc80
-rw-r--r--src/Makefile.am14
-rw-r--r--src/datas/grain.pngbin0 -> 9579 bytes
-rw-r--r--src/datas/style.css13
-rw-r--r--src/misc.cc66
5 files changed, 173 insertions, 0 deletions
diff --git a/src/Main.cc b/src/Main.cc
new file mode 100644
index 0000000..f3bf0d7
--- /dev/null
+++ b/src/Main.cc
@@ -0,0 +1,80 @@
+#include <unistd.h>
+#include "Action.h"
+#include "Handle.h"
+#include "HttpServ.h"
+#include "Socket.h"
+#include "config.h"
+#include "Message.h"
+#include "Menu.h"
+#include "Exceptions.h"
+#include "Form.h"
+#include "Confirm.h"
+#include "Table.h"
+#include "admin.h"
+
+class InPipe : public Handle {
+ public:
+ InPipe(int in, int out) : Handle(in), m_out(out) { };
+ virtual ~InPipe() {}
+ int GetOut(void) { return m_out; }
+ virtual bool CanWrite(void) { return false; }
+ virtual bool CanRead(void) { return true; }
+ virtual String GetName(void) { return "Input pipe"; }
+ private:
+ int m_out;
+} * in;
+
+extern Action * MenuAdmin, * MenuGestionMatos, * MenuGestionChantier, * MenuGestionPieces, * MenuGestionFournisseurs, * MenuInterventions, * MenuGestionLocations;
+Action * ListeMenuPrincipal[] = {MenuAdmin, MenuGestionMatos, MenuGestionChantier, MenuGestionPieces, MenuGestionFournisseurs, MenuInterventions, MenuGestionLocations};
+String MenuPrincipalLabels[] = {"Administration", "Gestion du materiel", "Gestion des chantiers", "Gestion du stock de pièces", "Gestion des fournisseurs", "Interventions", "Locations"};
+
+Action * buildmenu(void) {
+ return new Menu("Menu Principal", "start", MenuPrincipalLabels, ListeMenuPrincipal, 7);
+}
+
+int main(int argc, char ** argv) {
+ int p[2], c;
+ String port = "1500";
+
+ if (pipe(p)) {
+ cerr << "Error creating pipe.\n";
+ exit(-1);
+ }
+
+ close(1);
+ dup(p[1]);
+ in = new InPipe(p[0], p[1]);
+
+ String test = "poide\n", r;
+ cout << test;
+ cout.flush();
+ (*in) >> r;
+ if (r != "poide") {
+ cerr << "The stdout redirect has failed.\n";
+ exit(-1);
+ }
+
+ while ((c = getopt(argc, argv, "p:")) != EOF) {
+ switch (c) {
+ case 'p':
+ port = optarg;
+ break;
+ default:
+ cerr << "Usage: " << argv[0] << " [-p port]\n";
+ exit(-1);
+ }
+ }
+
+ try {
+ HttpServ h(port.to_int());
+
+ h.MainLoop(buildmenu());
+ }
+ catch (GeneralException e) {
+ cerr << e.GetMsg() << endl;
+ exit(-1);
+ }
+
+ delete in;
+ exit(0);
+}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..b5ed47a
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,14 @@
+localedir = $(datadir)/locale
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+AM_CFLAGS = -O3 -Wall -Wstrict-prototypes $(CFLAGS)
+AM_CXXFLAGS = -O3 -Wall -Wstrict-prototypes $(CXXFLAGS)
+INCLUDES = -I. -I.. -I$(includedir) -I../include
+
+bin_PROGRAMS = Main
+
+Main_SOURCES = Main.cc
+
+clean:
+ rm -f admin?.o admin?.pc
+
+Main_LDADD = $(LDADD)
diff --git a/src/datas/grain.png b/src/datas/grain.png
new file mode 100644
index 0000000..632ff82
--- /dev/null
+++ b/src/datas/grain.png
Binary files differ
diff --git a/src/datas/style.css b/src/datas/style.css
new file mode 100644
index 0000000..d05d90a
--- /dev/null
+++ b/src/datas/style.css
@@ -0,0 +1,13 @@
+body { font-family: Arial, Helvetica, sans-serif; font-size: 15pt; }
+th { font-family: Arial, Helvetica, sans-serif; font-size: 17pt; font-weight: bold; background-color: #D3DCE3;}
+td { font-family: Arial, Helvetica, sans-serif; font-size: 15pt;}
+form { font-family: Arial, Helvetica, sans-serif; font-size: 15pt}
+h1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 30pt; font-weight: bold}
+A:link { font-family: Arial, Helvetica, sans-serif; font-size: 15pt; text-decoration: none; color: blue}
+A:visited { font-family: Arial, Helvetica, sans-serif; font-size: 15pt; text-decoration: none; color: #7F007F}
+A:hover { font-family: Arial, Helvetica, sans-serif; font-size: 15pt; text-decoration: underline; color: red}
+A:link.nav { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15pt; color: #000000}
+A:visited.nav { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15pt; color: #000000}
+A:hover.nav { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15pt; color: red;}
+.nav { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15pt; color: #000000}
+
diff --git a/src/misc.cc b/src/misc.cc
new file mode 100644
index 0000000..ea72572
--- /dev/null
+++ b/src/misc.cc
@@ -0,0 +1,66 @@
+#include <list>
+#include "Handle.h"
+#include "String.h"
+
+void GeneDeroul(Handle * h, String * & l1, String * & l2) {
+ int count;
+ list<String> result;
+ String r1, r2;
+
+ count = 0;
+
+ while (1) {
+ (*h) >> r1;
+ (*h) >> r2;
+ if ((r1 == "") && (r2 == "")) break;
+ result.push_back(r1);
+ result.push_back(r2);
+ count++;
+ }
+
+ l1 = new String[count + 1];
+ l2 = new String[count + 1];
+
+ for (int i = 0; i < count; i++) {
+ r1 = result.front();
+ result.pop_front();
+ r2 = result.front();
+ result.pop_front();
+ l1[i] = r1;
+ l2[i] = r2;
+ }
+
+ l1[count] = "";
+ l2[count] = "";
+}
+
+int GeneList(Handle * h, int nbcol, String * & l) {
+ int nblig;
+ list<String> result;
+ String r;
+ bool is_null;
+
+ nblig = 0;
+ while (1) {
+ is_null = true;
+ for (int i = 0; i < nbcol; i++) {
+ (*h) >> r;
+ result.push_back(r);
+ if (r != "") is_null = false;
+ }
+ if (is_null) break;
+ nblig++;
+ }
+
+ l = new String[nbcol * nblig + 1];
+
+ for (int i = 0; i < (nbcol * nblig); i++) {
+ r = result.front();
+ result.pop_front();
+ l[i] = r;
+ }
+
+ l[nbcol * nblig] = "";
+
+ return nblig;
+}