示例#1
0
        private void tabGestioneDoc_PreRender(object sender, System.EventArgs e)
        {
            btn_allegati.Attributes.Add("onclick", "DocsPa_FuncJS_WaitWindows()");
//			btn_classifica.Attributes.Add("onclick","DocsPa_FuncJS_WaitWindows()");
//			//btn_profilo.Attributes.Add("onclick","DocsPa_FuncJS_WaitWindows()");
//			btn_protocollo.Attributes.Add("onclick","DocsPa_FuncJS_WaitWindows()");
//			btn_trasmissioni.Attributes.Add("onclick","DocsPa_FuncJS_WaitWindows()");
//			btn_versioni.Attributes.Add("onclick","DocsPa_FuncJS_WaitWindows()");


            if (schedaDocumento.registro != null && schedaDocumento.registro.systemId != null && schedaDocumento.tipoProto != null && !schedaDocumento.tipoProto.Equals("G"))
            {
                setStatoReg(schedaDocumento.registro);
                //lbl_registri.Text = schedaDocumento.registro.descrizione;
                lbl_registri.Text = schedaDocumento.registro.codRegistro;
                //setto anche il valore della combobox nel caso di documenti provenienti da "Riproponi dati"
                bool trovato = false;
                for (int i = 0; i < this.ddl_registri.Items.Count && !trovato; i++)
                {
                    if (this.ddl_registri.Items[i].Value == schedaDocumento.registro.systemId)
                    {
                        this.ddl_registri.SelectedIndex = i;
                        trovato = true;
                    }
                }

                if (Session["docRiproposto"] != null && (bool)Session["docRiproposto"])
                {
                    if (userRegistri == null)
                    {
                        userRegistri = UserManager.getListaRegistri(this);
                    }
                    setStatoReg(UserManager.getRegistroBySistemId(this, ddl_registri.SelectedValue));
                    setRegistroNoControlloCorrInReg(UserManager.getRegistroBySistemId(this, ddl_registri.SelectedValue));

                    this.Session["RegistroSelezionato"] = ddl_registri.SelectedValue.Trim();
                }
            }

            if (schedaDocumento.protocollo == null || schedaDocumento.protocollo.segnatura == null || schedaDocumento.protocollo.segnatura.Equals(""))
            {
                if (nomeTab.Equals("protocollo"))
                {
                    //this.ddl_registri.Visible = true;
                    //this.img_statoReg.Visible = true;
                    this.lbl_registri.Visible = false;
                    //this.icoReg.Visible = true;
                }
                else
                {
                    /*this.ddl_registri.Visible = false;
                     * this.lbl_registri.Visible = false;
                     * this.img_statoReg.Visible = false;
                     * this.icoReg.Visible = false;*/
                }
            }
            else
            {
                this.ddl_registri.Visible = false;
                this.lbl_registri.Visible = true;
                this.img_statoReg.Visible = true;
                this.icoReg.Visible       = true;
            }

            if (string.IsNullOrEmpty(schedaDocumento.systemId))
            {
                if (schedaDocumento.repositoryContext == null)
                {
                    // Gestione repository context disabilitata

                    if (nomeTab != "allegati")
                    {
                        if (!nomeTab.Equals("profilo"))
                        {
                            // evita il problema del cambio tab ptofilo -proto perdo i dati.
                            this.btn_profilo.Enabled = false;
                        }

                        else if (!nomeTab.Equals("protocollo"))
                        {
                            // evita il problema del cambio tab ptofilo -proto perdo i dati.
                            this.btn_protocollo.Enabled = false;
                        }
                    }
                }
                else
                {
                    this.btn_profilo.Enabled    = schedaDocumento.repositoryContext.IsDocumentoGrigio;
                    this.btn_protocollo.Enabled = !this.btn_profilo.Enabled;
                }

                // Gestione allegati prima di salvare il documento:
                // Il tab "Allegati" è abilitato solo se:
                // - è abilitata la gestione dei repository context
                //  oppure
                // - la scheda documento corrente è gestita nell'ambito dei repository context
                DocsPaWR.InfoUtente infoUtente = UserManager.getInfoUtente();
                if (!this.IsDisabledSessionRepositoryContext(infoUtente))
                {
                    this.btn_allegati.Enabled = true;
                }
                else
                {
                    // NB: Nonostante non sia abilitata la gestione dei repository context,
                    // in alcuni contesti il tab allegati può essere abiltato prima ancora di salvare
                    // es. inoltra con allegati, riproponi con copia
                    this.btn_allegati.Enabled = (schedaDocumento.repositoryContext != null);
                }

                this.btn_classifica.Enabled   = false;
                this.btn_trasmissioni.Enabled = false;
                this.btn_versioni.Enabled     = false;
            }
            else
            {
                bool isAllegato = this.IsDocumentoAllegato();

                this.btn_protocollo.Enabled   = (schedaDocumento.protocollo != null && !isAllegato);
                this.btn_classifica.Enabled   = !isAllegato;
                this.btn_allegati.Enabled     = !isAllegato;
                this.btn_trasmissioni.Enabled = !isAllegato;
            }
            // modifica del 15/05/2009
            if (schedaDocumento.tipoProto != null)
            {
                if (schedaDocumento.tipoProto.Equals("R") || schedaDocumento.tipoProto.Equals("C"))
                {
                    this.btn_allegati.Enabled     = false;
                    this.btn_classifica.Enabled   = false;
                    this.btn_trasmissioni.Enabled = false;
                    this.btn_versioni.Enabled     = true;
                }
            }
            //fine modifica del 15/05/2009

            #region     Gestione tasto back
            string mytab = "";

            if (DocumentManager.getMemoriaVisualizzaBack(this) == null)
            {
                this.pnl_cont.Visible   = false;
                this.pnl_random.Visible = false;
                if (nomeTab.Equals("protocollo"))
                {
                    this.pnl_cont.Visible   = true;
                    this.pnl_random.Visible = true;
                }
//				this.btn_BackToQuery.Visible = false;
//				this.pnl_riga.Visible=false;

                if (TrasmManager.getMemoriaVisualizzaBack(this) != null)
                {
                    this.pnl_cont.Visible = true;
//					this.pnl_riga.Visible=true;
//					this.btn_BackToQuery.Visible = true;
                    this.pnl_random.Visible = true;
                    mytab = TrasmManager.getMemoriaTab(this);
//					this.btn_BackToQuery.Attributes.Add("onclick","javascript:top.principale.document.location='../RicercaTrasm/gestioneRicTrasm.aspx?verso=" + mytab + "&back=true'");
                }
            }
            else
            {
                this.pnl_cont.Visible = true;
//				this.pnl_riga.Visible=true;
//				this.btn_BackToQuery.Visible = true;
                this.pnl_random.Visible = true;
                mytab = DocumentManager.getMemoriaTab(this);
//				this.btn_BackToQuery.Attributes.Add("onclick","javascript:top.principale.document.location='../RicercaDoc/gestioneRicDoc.aspx?tab="+mytab+"&back=SI'");
            }

            if (FascicoliManager.GetFolderViewTracing(this))
            {
                this.pnl_cont.Visible = true;
//				this.btn_BackToFolder.Visible=true;
//				this.pnl_riga.Visible=true;
                this.pnl_random.Visible = true;
                //this.pnl_random.Visible=true;
//				this.btn_BackToFolder.Attributes.Add("onclick","javascript:top.principale.document.location='../fascicolo/gestioneFasc.aspx?tab=documenti&back=Y'");
            }

            #endregion


            DocumentManager.setDocumentoInLavorazione(this, schedaDocumento);
            IframeTabs.NavigateTo = "doc" + nomeTab + ".aspx?isNew=" + isNew;

            // Impostazione nome del tab correntemente visualizzato
            this.SetCurrentTabName();

            // Aggiornamento url dell'immagine dei pulsanti del tab
            this.RefreshTabButtonsImages();

            // Aggiornamento numero allegati e versioni nel tooltip dei
            // relativi pulsanti del tab
            this.RefreshTabTooltipObjectCount();

            //abilitazione delle funzioni in base al ruolo
            //qui c'è un problema se l'utente non può fare new protocollo
            //ma fa una ricerca vedendo il dettaglio di un protocollo, su ha un tab protocollo non
            //attivo, ma il dati sono visibili.
            //UserManager.disabilitaFunzNonAutorizzate(this);

            this.RefreshContext();
        }