profilo_professionale.form \
ruolo.form \
struttura.form \
+ struttura_allegato.form \
struttura_collegamento.form \
struttura_indirizzo.form \
tipo_nodo.form \
--- /dev/null
+<?xml version="1.0"?>
+<gtkform>
+
+ <table>struttura_allegati</table>
+
+ <widget type="label" name="label324" label="label323">
+ <field type="integer" name="id">
+ <is-key>t</is-key>
+ <auto-increment>t</auto-increment>
+ </field>
+ </widget>
+
+ <widget type="label" name="label330">
+ <field type="integer" name="id_strutture" />
+ </widget>
+
+ <widget type="entry" name="entry111" label="label328">
+ <field type="text" name="titolo">
+ <obligatory>t</obligatory>
+ </field>
+ </widget>
+
+ <widget type="entry" name="entry109" label="label325">
+ <field type="text" name="descrizione" />
+ </widget>
+
+ <widget type="entry" name="entry110" label="label327">
+ <field type="datetime" name="data_documento">
+ <datetime-type>date</datetime-type>
+ <display-format>%d/%m/%Y</display-format>
+ </field>
+ </widget>
+
+ <widget type="textview" name="textview22" label="label326">
+ <field type="text" name="note" />
+ </widget>
+
+</gtkform>
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="lstore_struttura_allegati">
+ <columns>
+ <!-- column-name id -->
+ <column type="guint"/>
+ <!-- column-name titolo -->
+ <column type="gchararray"/>
+ <!-- column-name descrizione -->
+ <column type="gchararray"/>
+ <!-- column-name percorso -->
+ <column type="gchararray"/>
+ <!-- column-name contenuto -->
+ <column type="guint"/>
+ </columns>
+ </object>
<object class="GtkListStore" id="lstore_struttura_collegamenti">
<columns>
<!-- column-name id -->
<property name="tab_fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="hbox31">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow47">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview27">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">lstore_struttura_allegati</property>
+ <property name="headers_clickable">False</property>
+ <property name="rules_hint">True</property>
+ <property name="search_column">0</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn46">
+ <property name="title">Titolo</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext57"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn47">
+ <property name="title">Descrizione</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext58"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVButtonBox" id="vbuttonbox15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="button191">
+ <property name="label">gtk-new</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button192">
+ <property name="label">gtk-edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button193">
+ <property name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button194">
+ <property name="label">gtk-open</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label191">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Allegati</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="right_attach">2</property>
</object>
</child>
</object>
+ <object class="GtkWindow" id="w_struttura_allegato">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Allegato - Organigramma</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="default_width">480</property>
+ <property name="destroy_with_parent">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox51">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkTable" id="table56">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">7</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label323">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">ID</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label324">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">lbl_id</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label325">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Descrizione</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry109">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">255</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label326">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Note</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow58">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTextView" id="textview22">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label327">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Data documento</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry110">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">10</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label328">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Titolo</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry111">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">255</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame36">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <object class="GtkAlignment" id="alignment32">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label329">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>File</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label330">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">lbl_id_strutture</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox55">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button188">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button189">
+ <property name="label">gtk-save</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button190">
+ <property name="label" translatable="yes">Salva e _chiudi</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
<object class="GtkWindow" id="w_struttura_collegamento">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Collegamento - Organigramma</property>
ALTER TABLE tipi_recapito ADD COLUMN immagine_contenuto integer DEFAULT 0;
ALTER TABLE tipi_recapito ADD COLUMN immagine_file_data timestamp without time zone;
ALTER TABLE tipi_recapito ADD COLUMN immagine_file_dimensione bigint DEFAULT 0;
+
+CREATE TABLE struttura_allegati
+(
+ id integer NOT NULL,
+ id_strutture integer,
+ titolo character varying(255) DEFAULT ''::character varying,
+ descrizione character varying DEFAULT ''::bpchar,
+ data_documento date,
+ note text DEFAULT ''::text,
+ percorso character varying(255) DEFAULT ''::character varying,
+ contenuto integer,
+ data_file timestamp without time zone,
+ dimensione_file bigint,
+ status character varying(1) DEFAULT ''::character varying,
+ CONSTRAINT struttura_allegati_pkey PRIMARY KEY (id)
+);
-- Dumped from database version 8.4.17
-- Dumped by pg_dump version 9.2.2
--- Started on 2013-06-03 13:27:01
+-- Started on 2013-06-04 10:50:35
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET escape_string_warning = off;
--
--- TOC entry 553 (class 2612 OID 16386)
+-- TOC entry 558 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
--
);
+--
+-- TOC entry 165 (class 1259 OID 626425)
+-- Name: struttura_allegati; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE struttura_allegati (
+ id integer NOT NULL,
+ id_strutture integer,
+ titolo character varying(255) DEFAULT ''::character varying,
+ descrizione character varying DEFAULT ''::bpchar,
+ data_documento date,
+ note text DEFAULT ''::text,
+ percorso character varying(255) DEFAULT ''::character varying,
+ contenuto integer,
+ data_file timestamp without time zone,
+ dimensione_file bigint,
+ status character varying(1) DEFAULT ''::character varying
+);
+
+
--
-- TOC entry 164 (class 1259 OID 626367)
-- Name: struttura_collegamenti; Type: TABLE; Schema: public; Owner: -
--
--- TOC entry 1991 (class 2606 OID 59289)
+-- TOC entry 2001 (class 2606 OID 59289)
-- Name: nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2031 (class 2606 OID 61360)
+-- TOC entry 2041 (class 2606 OID 61360)
-- Name: persona_incarichi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2021 (class 2606 OID 61305)
+-- TOC entry 2031 (class 2606 OID 61305)
-- Name: persona_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2023 (class 2606 OID 61321)
+-- TOC entry 2033 (class 2606 OID 61321)
-- Name: persona_nodo_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2017 (class 2606 OID 61279)
+-- TOC entry 2027 (class 2606 OID 61279)
-- Name: persona_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2015 (class 2606 OID 61252)
+-- TOC entry 2025 (class 2606 OID 61252)
-- Name: persona_uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2019 (class 2606 OID 61294)
+-- TOC entry 2029 (class 2606 OID 61294)
-- Name: persona_ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2011 (class 2606 OID 61235)
+-- TOC entry 2021 (class 2606 OID 61235)
-- Name: persone_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2025 (class 2606 OID 61328)
+-- TOC entry 2035 (class 2606 OID 61328)
-- Name: posizioni_economiche_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2029 (class 2606 OID 61342)
+-- TOC entry 2039 (class 2606 OID 61342)
-- Name: profili_professionali_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2035 (class 2606 OID 618188)
+-- TOC entry 2045 (class 2606 OID 618188)
-- Name: ruoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2039 (class 2606 OID 626378)
+-- TOC entry 2051 (class 2606 OID 626437)
+-- Name: struttura_allegati_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY struttura_allegati
+ ADD CONSTRAINT struttura_allegati_pkey PRIMARY KEY (id);
+
+
+--
+-- TOC entry 2049 (class 2606 OID 626378)
-- Name: struttura_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2001 (class 2606 OID 59356)
+-- TOC entry 2011 (class 2606 OID 59356)
-- Name: struttura_indirizzi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1999 (class 2606 OID 59339)
+-- TOC entry 2009 (class 2606 OID 59339)
-- Name: strutture_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1993 (class 2606 OID 59296)
+-- TOC entry 2003 (class 2606 OID 59296)
-- Name: tipi_nodo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2027 (class 2606 OID 61335)
+-- TOC entry 2037 (class 2606 OID 61335)
-- Name: tipi_prestazione_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2013 (class 2606 OID 61242)
+-- TOC entry 2023 (class 2606 OID 61242)
-- Name: tipi_rapporto_lavoro_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1995 (class 2606 OID 59303)
+-- TOC entry 2005 (class 2606 OID 59303)
-- Name: tipi_recapito_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2009 (class 2606 OID 61226)
+-- TOC entry 2019 (class 2606 OID 61226)
-- Name: titoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1997 (class 2606 OID 59321)
+-- TOC entry 2007 (class 2606 OID 59321)
-- Name: uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2037 (class 2606 OID 626366)
+-- TOC entry 2047 (class 2606 OID 626366)
-- Name: ufficio_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2003 (class 2606 OID 59366)
+-- TOC entry 2013 (class 2606 OID 59366)
-- Name: ufficio_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2005 (class 2606 OID 59408)
+-- TOC entry 2015 (class 2606 OID 59408)
-- Name: ufficio_orari_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2007 (class 2606 OID 59419)
+-- TOC entry 2017 (class 2606 OID 59419)
-- Name: ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2033 (class 2606 OID 61430)
+-- TOC entry 2043 (class 2606 OID 61430)
-- Name: ufficio_stanze_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT ufficio_stanze_pkey PRIMARY KEY (id);
--- Completed on 2013-06-03 13:27:02
+-- Completed on 2013-06-04 10:50:35
--
-- PostgreSQL database dump complete
../src/ruolo.c \
../src/ruolo.h \
../src/struttura.c \
+ ../src/strutturaallegato.c \
../src/strutturacollegamento.c \
../src/strutturaindirizzo.c \
../src/strutture.c \
../src/profiliprofessionali.h \
../src/profiloprofessionale.h \
../src/struttura.h \
+ ../src/strutturaallegato.h \
../src/strutturacollegamento.h \
../src/strutturaindirizzo.h \
../src/strutture.h \
ruolo.h \
struttura.c \
struttura.h \
+ strutturaallegato.c \
+ strutturaallegato.h \
strutturacollegamento.c \
strutturacollegamento.h \
strutturaindirizzo.c \
#include "struttura.h"
#include "strutturaindirizzo.h"
#include "strutturacollegamento.h"
+#include "strutturaallegato.h"
static void organigramma_struttura_class_init (OrganigrammaStrutturaClass *klass);
static void organigramma_struttura_init (OrganigrammaStruttura *struttura);
static void organigramma_struttura_carica_indirizzi (OrganigrammaStruttura *struttura);
static void organigramma_struttura_carica_collegamenti (OrganigrammaStruttura *struttura);
+static void organigramma_struttura_carica_allegati (OrganigrammaStruttura *struttura);
static void organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura);
static void organigramma_struttura_collegamento_modifica (OrganigrammaStruttura *struttura);
+static void organigramma_struttura_allegato_modifica (OrganigrammaStruttura *struttura);
static gboolean organigramma_struttura_conferma_chiusura (OrganigrammaStruttura *struttura);
static void organigramma_struttura_on_indirizzo_aggiornato (gpointer instance, gpointer user_data);
static void organigramma_struttura_on_collegamento_aggiornato (gpointer instance, gpointer user_data);
+static void organigramma_struttura_on_allegato_aggiornato (gpointer instance, gpointer user_data);
static gboolean organigramma_struttura_on_w_organigramma_struttura_delete_event (GtkWidget *widget,
GdkEvent *event,
GtkTreeViewColumn *column,
gpointer user_data);
+static void organigramma_struttura_on_btn_allegato_nuovo_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_struttura_on_btn_allegato_modifica_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_struttura_on_btn_allegato_elimina_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_struttura_on_btn_allegato_apri_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_struttura_on_trv_allegati_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data);
+
static void organigramma_struttura_on_btn_annulla_clicked (GtkButton *button,
gpointer user_data);
static void organigramma_struttura_on_btn_salva_clicked (GtkButton *button,
{
LBL_ID,
LSTORE_INDIRIZZI,
- LSTORE_COLLEGAMENTI
+ LSTORE_COLLEGAMENTI,
+ LSTORE_ALLEGATI
};
enum
COLLEGAMENTI_COL_INDIRIZZO
};
+enum
+{
+ ALLEGATI_COL_ID,
+ ALLEGATI_COL_TITOLO,
+ ALLEGATI_COL_DESCRIZIONE,
+ ALLEGATI_COL_PERCORSO,
+ ALLEGATI_COL_CONTENUTO
+};
+
typedef struct _OrganigrammaStrutturaPrivate OrganigrammaStrutturaPrivate;
struct _OrganigrammaStrutturaPrivate
{
GtkTreeSelection *sel_indirizzi;
GtkTreeSelection *sel_collegamenti;
+ GtkTreeSelection *sel_allegati;
gint id;
};
gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
g_strsplit ("lstore_struttura_indirizzi"
"|lstore_struttura_collegamenti"
+ "|lstore_struttura_allegati"
"|w_struttura",
"|", -1),
&error);
"label31",
"lstore_struttura_indirizzi",
"lstore_struttura_collegamenti",
+ "lstore_struttura_allegati",
NULL);
g_signal_connect (priv->w,
priv->sel_indirizzi = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview9")));
priv->sel_collegamenti = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview26")));
+ priv->sel_allegati = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview27")));
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button47")),
"clicked", G_CALLBACK (organigramma_struttura_on_btn_indirizzo_nuovo_clicked), (gpointer)a);
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview26")),
"row-activated", G_CALLBACK (organigramma_struttura_on_trv_collegamenti_row_activated), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button191")),
+ "clicked", G_CALLBACK (organigramma_struttura_on_btn_allegato_nuovo_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button192")),
+ "clicked", G_CALLBACK (organigramma_struttura_on_btn_allegato_modifica_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button193")),
+ "clicked", G_CALLBACK (organigramma_struttura_on_btn_allegato_elimina_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button194")),
+ "clicked", G_CALLBACK (organigramma_struttura_on_btn_allegato_apri_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview27")),
+ "row-activated", G_CALLBACK (organigramma_struttura_on_trv_allegati_row_activated), (gpointer)a);
+
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button39"),
"clicked", G_CALLBACK (organigramma_struttura_on_btn_annulla_clicked), (gpointer)a);
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button40"),
gtk_form_set_as_origin (priv->form);
- gtk_form_set_sensitive_by_name (priv->form, FALSE, "hbox6", "hbox23", NULL);
+ gtk_form_set_sensitive_by_name (priv->form, FALSE, "hbox6", "hbox23", "hbox31", NULL);
}
else
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button149")), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button181")), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button183")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button191")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button193")), FALSE);
}
return a;
{
organigramma_struttura_carica_indirizzi (struttura);
organigramma_struttura_carica_collegamenti (struttura);
+ organigramma_struttura_carica_allegati (struttura);
}
}
if (priv->id == 0)
{
priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
- gtk_form_set_sensitive_by_name (priv->form, TRUE, "frame3", NULL);
+ gtk_form_set_sensitive_by_name (priv->form, TRUE, "hbox6", "hbox23", "hbox31", NULL);
}
solipa_message_dialog (priv->w,
}
}
+static void
+organigramma_struttura_carica_allegati (OrganigrammaStruttura *organigramma_struttura)
+{
+ GtkListStore *lstore;
+ GtkTreeIter iter;
+ GdaDataModel *dm;
+
+ gchar *sql;
+
+ gint rows;
+ gint row;
+
+ OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+ lstore = GTK_LIST_STORE (priv->objects[LSTORE_ALLEGATI]);
+ gtk_list_store_clear (lstore);
+
+ sql = g_strdup_printf ("SELECT aa.id, aa.titolo, aa.descrizione,"
+ " aa.percorso, aa.contenuto"
+ " FROM struttura_allegati AS aa"
+ " WHERE aa.status <> 'E' AND aa.id_strutture = %d"
+ " ORDER BY aa.titolo, aa.descrizione",
+ priv->id);
+ dm = gdaex_query (priv->commons->gdaex, sql);
+ g_free (sql);
+ if (dm != NULL)
+ {
+ rows = gda_data_model_get_n_rows (dm);
+ for (row = 0; row < rows; row++)
+ {
+ gtk_list_store_append (lstore, &iter);
+ gtk_list_store_set (lstore, &iter,
+ ALLEGATI_COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
+ ALLEGATI_COL_TITOLO, gdaex_data_model_get_field_value_stringify_at (dm, row, "titolo"),
+ ALLEGATI_COL_DESCRIZIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "descrizione"),
+ ALLEGATI_COL_PERCORSO, gdaex_data_model_get_field_value_stringify_at (dm, row, "percorso"),
+ ALLEGATI_COL_CONTENUTO, gdaex_data_model_get_field_value_integer_at (dm, row, "contenuto"),
+ -1);
+ }
+
+ g_object_unref (dm);
+ }
+}
+
static void
organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura)
{
}
}
+static void
+organigramma_struttura_allegato_modifica (OrganigrammaStruttura *organigramma_struttura)
+{
+ GtkTreeIter iter;
+ guint id;
+
+ OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+ if (gtk_tree_selection_get_selected (priv->sel_allegati, NULL, &iter))
+ {
+ GtkWidget *w;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_ALLEGATI]), &iter,
+ ALLEGATI_COL_ID, &id,
+ -1);
+
+ OrganigrammaStrutturaAllegato *c = organigramma_struttura_allegato_new (priv->commons, id, 0);
+
+ g_signal_connect (G_OBJECT (c), "aggiornato",
+ G_CALLBACK (organigramma_struttura_on_allegato_aggiornato), (gpointer)organigramma_struttura);
+
+ w = organigramma_struttura_allegato_get_widget (c);
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+ gtk_widget_show (w);
+ }
+ else
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un allegato.");
+ }
+}
+
static void
organigramma_struttura_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
organigramma_struttura_carica_collegamenti ((OrganigrammaStruttura *)user_data);
}
+static void
+organigramma_struttura_on_allegato_aggiornato (gpointer instance, gpointer user_data)
+{
+ organigramma_struttura_carica_allegati ((OrganigrammaStruttura *)user_data);
+}
+
static gboolean
organigramma_struttura_on_w_organigramma_struttura_delete_event (GtkWidget *widget,
GdkEvent *event,
organigramma_struttura_collegamento_modifica ((OrganigrammaStruttura *)user_data);
}
+static void
+organigramma_struttura_on_btn_allegato_nuovo_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkWidget *w;
+
+ OrganigrammaStruttura *organigramma_struttura = (OrganigrammaStruttura *)user_data;
+ OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+ OrganigrammaStrutturaAllegato *c = organigramma_struttura_allegato_new (priv->commons, 0, priv->id);
+
+ g_signal_connect (G_OBJECT (c), "aggiornato",
+ G_CALLBACK (organigramma_struttura_on_allegato_aggiornato), user_data);
+
+ w = organigramma_struttura_allegato_get_widget (c);
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+ gtk_widget_show (w);
+
+}
+
+static void
+organigramma_struttura_on_btn_allegato_modifica_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ organigramma_struttura_allegato_modifica ((OrganigrammaStruttura *)user_data);
+}
+
+static void
+organigramma_struttura_on_btn_allegato_elimina_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+ guint id;
+
+ OrganigrammaStruttura *organigramma_struttura = (OrganigrammaStruttura *)user_data;
+ OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+ if (gtk_tree_selection_get_selected (priv->sel_allegati, NULL, &iter))
+ {
+ if (solipa_message_dialog (priv->w,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "Sicuro di voler eliminare l'allegato selezionato?") == GTK_RESPONSE_YES)
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_ALLEGATI]), &iter,
+ ALLEGATI_COL_ID, &id,
+ -1);
+
+ gdaex_execute (priv->commons->gdaex,
+ g_strdup_printf ("UPDATE struttura_allegati SET status = 'E' WHERE id = %d", id));
+
+ organigramma_struttura_carica_allegati (organigramma_struttura);
+ }
+ }
+ else
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un allegato.");
+ }
+}
+
+static void
+organigramma_struttura_on_btn_allegato_apri_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+ const gchar *percorso;
+ guint id;
+
+ gchar *sql;
+
+ OrganigrammaStruttura *organigramma_struttura = (OrganigrammaStruttura *)user_data;
+ OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+ if (gtk_tree_selection_get_selected (priv->sel_allegati, NULL, &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_ALLEGATI]), &iter,
+ ALLEGATI_COL_ID, &id,
+ -1);
+
+ /* devo utilizzare le funzioni native di postgres
+ * perché quelle di libgda non sembrano funzionare sotto windows */
+ GError *error;
+ GdaDataModel *dm;
+ gchar *filename_orig;
+ gchar *filename_tmp;
+ gint fin;
+
+ sql = g_strdup_printf ("SELECT percorso, contenuto FROM struttura_allegati WHERE id = %d", id);
+ dm = gdaex_query (priv->commons->gdaex, sql);
+ g_free (sql);
+ if (dm != NULL && gda_data_model_get_n_rows (dm) > 0)
+ {
+ filename_orig = g_path_get_basename (gdaex_data_model_get_field_value_stringify_at (dm, 0, "percorso"));
+
+ error = NULL;
+ fin = g_file_open_tmp (g_strdup_printf ("organigramma-XXXXXX-%s",
+ filename_orig),
+ &filename_tmp, &error);
+ if (fin < 1 || error != NULL)
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ g_strdup_printf ("Errore nell'apertura dell'allegato: %s",
+ error != NULL && error->message != NULL ? error->message : "nessun dettaglio"));
+ close (fin);
+ return;
+ }
+ close (fin);
+
+#ifdef G_OS_WIN32
+ filename_tmp = g_strjoinv ("\\", g_strsplit (filename_tmp, "/", -1));
+#endif
+
+ PQexec (priv->commons->pgcon, "BEGIN");
+
+ lo_export (priv->commons->pgcon,
+ gdaex_data_model_get_field_value_integer_at (dm, 0, "contenuto"),
+ filename_tmp);
+
+ PQexec (priv->commons->pgcon, "COMMIT");
+
+ solipa_allegato_apri_allegato (GTK_WINDOW (priv->w), filename_tmp);
+ }
+ else
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un allegato.");
+ }
+ }
+ else
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un allegato.");
+ }
+}
+
+static void
+organigramma_struttura_on_trv_allegati_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ organigramma_struttura_allegato_modifica ((OrganigrammaStruttura *)user_data);
+}
+
static void
organigramma_struttura_on_btn_annulla_clicked (GtkButton *button,
gpointer user_data)
--- /dev/null
+/*
+ * Copyright (C) 2013 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <libpq-fe.h>
+
+#include <libsolipa/libsolipa.h>
+#include <libautoz/autoz.h>
+#include <libgtkform/form.h>
+
+#include "strutturaallegato.h"
+
+static void organigramma_struttura_allegato_class_init (OrganigrammaStrutturaAllegatoClass *klass);
+static void organigramma_struttura_allegato_init (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato);
+
+static void organigramma_struttura_allegato_carica (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato);
+static void organigramma_struttura_allegato_salva (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato, gboolean chiudi);
+
+static gboolean organigramma_struttura_allegato_conferma_chiusura (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato);
+
+static void organigramma_struttura_allegato_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void organigramma_struttura_allegato_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static gboolean organigramma_struttura_allegato_on_w_organigramma_struttura_allegato_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data);
+
+static void organigramma_struttura_allegato_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_struttura_allegato_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_struttura_allegato_on_btn_salvachiudi_clicked (GtkButton *button,
+ gpointer user_data);
+
+#define ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO, OrganigrammaStrutturaAllegatoPrivate))
+
+enum
+{
+ LBL_ID,
+ LBL_ID_STRUTTURE
+};
+
+typedef struct _OrganigrammaStrutturaAllegatoPrivate OrganigrammaStrutturaAllegatoPrivate;
+struct _OrganigrammaStrutturaAllegatoPrivate
+ {
+ OrganigrammaCommons *commons;
+
+ GtkForm *form;
+
+ GtkWidget *w;
+ SolipaAllegato *sallegato;
+
+ GObject **objects;
+
+ gint id;
+ };
+
+G_DEFINE_TYPE (OrganigrammaStrutturaAllegato, organigramma_struttura_allegato, G_TYPE_OBJECT)
+
+static void
+organigramma_struttura_allegato_class_init (OrganigrammaStrutturaAllegatoClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (OrganigrammaStrutturaAllegatoPrivate));
+
+ object_class->set_property = organigramma_struttura_allegato_set_property;
+ object_class->get_property = organigramma_struttura_allegato_get_property;
+
+ /**
+ * OrganigrammaStrutturaAllegato::aggiornato:
+ * @organigramma_struttura_allegato:
+ *
+ */
+ klass->aggiornato_signal_id = g_signal_new ("aggiornato",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+organigramma_struttura_allegato_init (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato)
+{
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+}
+
+/**
+ * organigramma_struttura_allegato_new:
+ * @commons:
+ * @id:
+ * @id_strutture:
+ *
+ * Returns: the newly created #OrganigrammaStrutturaAllegato object.
+ */
+OrganigrammaStrutturaAllegato
+*organigramma_struttura_allegato_new (OrganigrammaCommons *commons, guint id, guint id_strutture)
+{
+ GError *error;
+ AutozIResource *ires1;
+
+ OrganigrammaStrutturaAllegato *a = ORGANIGRAMMA_STRUTTURA_ALLEGATO (g_object_new (organigramma_struttura_allegato_get_type (), NULL));
+
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (a);
+
+ priv->commons = commons;
+
+ error = NULL;
+ gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
+ g_strsplit ("w_struttura_allegato", "|", -1),
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Errore: %s.", error->message);
+ return NULL;
+ }
+
+ priv->form = gtk_form_new ();
+ g_object_set (priv->form, "gdaex", priv->commons->gdaex, NULL);
+ gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "struttura_allegato.form", NULL), priv->commons->gtkbuilder);
+
+ g_object_set (priv->form, "gdaex", priv->commons->gdaex, NULL);
+
+ priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_struttura_allegato"));
+
+ priv->objects = gtk_form_get_objects_by_name (priv->form,
+ "label324",
+ "label330",
+ NULL);
+
+ priv->sallegato = solipa_allegato_new (commons->solipa);
+ if (priv->sallegato != NULL)
+ {
+ solipa_allegato_add_to_gtkform (priv->sallegato, priv->form,
+ "percorso", "data_file", "dimensione_file");
+ solipa_allegato_con_salva_in_db (priv->sallegato, FALSE);
+ gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->commons->gtkbuilder, "alignment32")),
+ solipa_allegato_get_widget (priv->sallegato));
+ }
+
+ g_signal_connect (priv->w,
+ "delete-event", G_CALLBACK (organigramma_struttura_allegato_on_w_organigramma_struttura_allegato_delete_event), (gpointer)a);
+
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button188"),
+ "clicked", G_CALLBACK (organigramma_struttura_allegato_on_btn_annulla_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button189"),
+ "clicked", G_CALLBACK (organigramma_struttura_allegato_on_btn_salva_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button190"),
+ "clicked", G_CALLBACK (organigramma_struttura_allegato_on_btn_salvachiudi_clicked), (gpointer)a);
+
+ gtk_form_clear (priv->form);
+
+ priv->id = id;
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID_STRUTTURE]), g_strdup_printf ("%d", id_strutture));
+
+ if (priv->sallegato != NULL)
+ {
+ solipa_allegato_set_salva_in_db (priv->sallegato, TRUE);
+ }
+
+ gtk_form_set_as_origin (priv->form);
+ }
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), g_strdup_printf ("%d", priv->id));
+ organigramma_struttura_allegato_carica (a);
+ }
+
+ ires1 = autoz_get_resource_from_id (priv->commons->autoz, "organigramma_rw");
+ if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button189")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button190")), FALSE);
+ }
+
+ return a;
+}
+
+/**
+ * organigramma_struttura_allegato_get_widget:
+ * @organigramma_struttura_allegato:
+ *
+ */
+GtkWidget
+*organigramma_struttura_allegato_get_widget (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato)
+{
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+
+ return priv->w;
+}
+
+/* PRIVATE */
+static void
+organigramma_struttura_allegato_carica (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato)
+{
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+
+ if (gtk_form_fill_from_table (priv->form))
+ {
+ solipa_allegato_set_salva_in_db (priv->sallegato, TRUE);
+ }
+}
+
+static void
+organigramma_struttura_allegato_salva (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato, gboolean chiudi)
+{
+ gchar *sql;
+ GtkWidget *dialog;
+
+ OrganigrammaStrutturaAllegatoClass *klass = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_CLASS (organigramma_struttura_allegato);
+
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+
+ if (!gtk_form_check (priv->form, (priv->id != 0), NULL, TRUE, priv->w, TRUE))
+ {
+ return;
+ }
+
+ if (priv->id == 0)
+ {
+ sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT);
+ }
+ else
+ {
+ sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_UPDATE);
+ }
+
+ if (gdaex_execute (priv->commons->gdaex, sql) == 1)
+ {
+ g_free (sql);
+
+ g_signal_emit (organigramma_struttura_allegato, klass->aggiornato_signal_id, 0);
+
+ gtk_form_set_as_origin (priv->form);
+
+ if (priv->id == 0)
+ {
+ priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
+ }
+
+ /* salvo l'organigramma_struttura_allegato nel db */
+ /* devo utilizzare le funzioni native di postgres
+ * perché quelle di libgda non sembrano funzionare sotto windows */
+ Oid oid;
+ const gchar *percorso;
+
+ percorso = solipa_allegato_get_percorso (priv->sallegato);
+
+ if (PQexec (priv->commons->pgcon, "BEGIN") == NULL)
+ {
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio: allegato non importato nel database (impossibile aprire la transazione).");
+ return;
+ }
+
+ oid = lo_import (priv->commons->pgcon, percorso);
+
+ if (oid > 0)
+ {
+ sql = g_strdup_printf ("UPDATE struttura_allegati "
+ " SET contenuto = %d,"
+ " percorso = '%s'"
+ " WHERE id = %d",
+ oid,
+ gdaex_strescape (g_path_get_basename (percorso), NULL),
+ priv->id);
+ if (gdaex_execute (priv->commons->gdaex, sql) < 1)
+ {
+ g_free (sql);
+
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio.");
+ return;
+ }
+ g_free (sql);
+
+ organigramma_struttura_allegato_carica (organigramma_struttura_allegato);
+ }
+ else
+ {
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio: allegato non importato nel database.");
+ return;
+ }
+
+ PQexec (priv->commons->pgcon, "COMMIT");
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "Salvataggio eseguito con successo.");
+
+ if (chiudi)
+ {
+ gtk_widget_destroy (priv->w);
+ g_object_unref (organigramma_struttura_allegato);
+ }
+ }
+ else
+ {
+ g_free (sql);
+
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio.");
+ }
+}
+
+static void
+organigramma_struttura_allegato_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ OrganigrammaStrutturaAllegato *organigramma_struttura_allegato = ORGANIGRAMMA_STRUTTURA_ALLEGATO (object);
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+organigramma_struttura_allegato_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ OrganigrammaStrutturaAllegato *organigramma_struttura_allegato = ORGANIGRAMMA_STRUTTURA_ALLEGATO (object);
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+organigramma_struttura_allegato_conferma_chiusura (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato)
+{
+ gboolean ret;
+
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (organigramma_struttura_allegato);
+
+ ret = TRUE;
+ if (gtk_form_is_changed (priv->form))
+ {
+ if (solipa_message_dialog (priv->w,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
+ {
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+
+/* CALLBACK */
+static gboolean
+organigramma_struttura_allegato_on_w_organigramma_struttura_allegato_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ return !organigramma_struttura_allegato_conferma_chiusura ((OrganigrammaStrutturaAllegato *)user_data);
+}
+
+static void
+organigramma_struttura_allegato_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ OrganigrammaStrutturaAllegato *allegato = (OrganigrammaStrutturaAllegato *)user_data;
+
+ OrganigrammaStrutturaAllegatoPrivate *priv = ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_PRIVATE (allegato);
+
+ if (organigramma_struttura_allegato_conferma_chiusura (allegato)) gtk_widget_destroy (priv->w);
+}
+
+static void
+organigramma_struttura_allegato_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ organigramma_struttura_allegato_salva ((OrganigrammaStrutturaAllegato *)user_data, FALSE);
+}
+
+static void
+organigramma_struttura_allegato_on_btn_salvachiudi_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ organigramma_struttura_allegato_salva ((OrganigrammaStrutturaAllegato *)user_data, TRUE);
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __ORGANIGRAMMA_STRUTTURA_ALLEGATO_H__
+#define __ORGANIGRAMMA_STRUTTURA_ALLEGATO_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+#include "commons.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO (organigramma_struttura_allegato_get_type ())
+#define ORGANIGRAMMA_STRUTTURA_ALLEGATO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO, OrganigrammaStrutturaAllegato))
+#define ORGANIGRAMMA_STRUTTURA_ALLEGATO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO, OrganigrammaStrutturaAllegatoClass))
+#define IS_ORGANIGRAMMA_STRUTTURA_ALLEGATO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO))
+#define IS_ORGANIGRAMMA_STRUTTURA_ALLEGATO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO))
+#define ORGANIGRAMMA_STRUTTURA_ALLEGATO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_ALLEGATO, OrganigrammaStrutturaAllegatoClass))
+
+
+typedef struct _OrganigrammaStrutturaAllegato OrganigrammaStrutturaAllegato;
+typedef struct _OrganigrammaStrutturaAllegatoClass OrganigrammaStrutturaAllegatoClass;
+
+struct _OrganigrammaStrutturaAllegato
+ {
+ GObject parent;
+ };
+
+struct _OrganigrammaStrutturaAllegatoClass
+ {
+ GObjectClass parent_class;
+
+ guint aggiornato_signal_id;
+ };
+
+GType organigramma_struttura_allegato_get_type (void) G_GNUC_CONST;
+
+OrganigrammaStrutturaAllegato *organigramma_struttura_allegato_new (OrganigrammaCommons *commons, guint id, guint id_strutture);
+
+GtkWidget *organigramma_struttura_allegato_get_widget (OrganigrammaStrutturaAllegato *organigramma_struttura_allegato);
+
+
+G_END_DECLS
+
+#endif /* __ORGANIGRAMMA_STRUTTURA_ALLEGATO_H__ */