Пример #1
0
        /// <summary>
        /// Start a drag&amp;drop event for the given sord.
        /// </summary>
        /// <param name="ctrl">Control object</param>
        /// <param name="sord">Sord object</param>
        /// <param name="item">Draged control item</param>
        /// <param name="e">Effect</param>
        /// <returns>True, if a drag&amp;drop is started.</returns>
        public virtual bool DoDragDrop(Control ctrl, FWSord sord, object item, DragDropEffects e)
        {
            List <FWSord> sords = new List <FWSord>();

            sords.Add(sord);
            return(DoDragDrop(ctrl, sords, item, e));
        }
Пример #2
0
        private void arcTreeView1_BeforeCheckin(EloixClientUI.Common.CheckinEventArgs e)
        {
            FWSord parentSord = arcTreeView1.Conn.Content.GetFolder(e.ParentId);

            if (MessageBox.Show("Do you want to checkin " + e.Sord.Name + " into " + parentSord + "?",
                                "Confirm", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                e.Cancel = true;
            }
        }
Пример #3
0
        public static string GetDocumentFile(FWSord sord)
        {
            string documentFile = null;

            if (sord is FWDocument)
            {
                FWDocument doc           = sord as FWDocument;
                int        encryptionSet = doc.Core.details.encryptionSet;
                if (encryptionSet > 0)
                {
                    if (doc.Conn.Session.EncrPasswords[encryptionSet.ToString()] != null)
                    {
                        return(doc.File);
                    }

                    // Anzeige eines Dialogs zur Eingabe des Verschlüsselungspassworts
                    if (doc.Conn != null && doc.Conn.Ix != null)
                    {
                        EncryptionPasswordDialog dlg = new EncryptionPasswordDialog(encryptionSet);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            try
                            {
                                string key = Convert.ToString(encryptionSet);
                                doc.Conn.Session.EncrPasswords[key] = dlg.Password;
                                doc.Conn.Session.EncrPasswords.Checkin();
                                doc          = doc.Conn.Content.GetDocument(doc.Id);
                                documentFile = doc.File;
                            }
                            catch (Exception exc)
                            {
                                if (sord.Conn.IsException(exc, IXExceptionC.INVALID_CRYPT_KEY))
                                {
                                    string key = Convert.ToString(encryptionSet);
                                    doc.Conn.Session.EncrPasswords[key] = null;
                                    IXExceptionData exceptionData = sord.Conn.Ix.parseException(exc.ToString());
                                    MessageBox.Show(exceptionData.message, "ELO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                    }
                }
                else
                {
                    documentFile = doc.File;
                }
            }

            return(documentFile);
        }
Пример #4
0
        /// <summary>
        /// Checkout/checkin document.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void checkoutDocument_Click(object sender, EventArgs e)
        {
            try {
                FWSord    sord    = conn.Content.GetSord(edObjId.Text);
                ArcPath[] arcPath = sord.RefPaths;

                Sord      sord2    = conn.Ix.checkoutSord(edObjId.Text, EditInfoC.mbAll, LockC.NO).sord;
                ArcPath[] arcPath2 = sord2.refPaths;


                // Get document locked
                FWDocument doc = conn.Content.LockDocument(edObjId.Text);
                if (doc == null)
                {
                    return;
                }

                // Download the documents file
                String file = doc.File; // same as doc.Version.File

                // Start application to edit the file
                System.Diagnostics.Process.Start(file);

                if (MessageBox.Show("Checkin?", "Checkin or unlock", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    MD5 md5 = new MD5(doc.File);
                    if (!md5.ToString().Equals(doc.Version.Core.md5))
                    {
                        doc.Version.Version = conn.DateToIso(DateTime.Now);
                        doc.Version.Comment = "New version " + doc.Version.Version;
                        doc.Checkin();
                    }
                    else
                    {
                        doc.Unlock();
                    }
                }
                else
                {
                    doc.Unlock();
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
        }
Пример #5
0
        void _arcTreeContextMenu_Opening(object sender, CancelEventArgs e)
        {
            Point    p = arcTreeView1.PointToClient(MousePosition);
            TreeNode activeTreeNode = arcTreeView1.GetNodeAt(p);

            if (activeTreeNode == null)
            {
                e.Cancel = true;
                return;
            }

            FWSord sord = arcTreeView1.GetSordFromNode(activeTreeNode);

            sord = sord.Conn.Content.GetSord(sord.Id);

            if (sord is FWDocument)
            {
                ToolStripMenuItem tsmiReferences = (ToolStripMenuItem)_arcTreeContextMenu.Items[0];
                if (tsmiReferences == null)
                {
                    return;
                }

                tsmiReferences.DropDownItems.Clear();

                FWDocument document = sord as FWDocument;
                EloixClient.IndexServer.ArcPath[] refPaths = sord.RefPaths;
                foreach (EloixClient.IndexServer.ArcPath refPath in refPaths)
                {
                    ToolStripMenuItem tsmi = new ToolStripMenuItem();
                    //tsmi.Text = arcTreeView1.GetAbsoluteArcPathString(refPath, document.Id, document.Name, nodePath[0], "//"); //BuildRefPathString(nodePath[0], refPath.path, _activeTreeNode.Text);
                    //tsmi.Tag = _arcTreeViewEx.GetAbsoluteArcPathString(refPath, document.Id, document.Name, nodePath[0]);
                    tsmi.Text = sord.ArcPathString;

                    //tsmi.Click += new EventHandler(tsmiRefPath_Click);
                    //IdName[] idNames = refPath.path;

                    //if ((idNames.Length == 0 && nodePath.Count == 2) || (idNames.Length > 0 && nodePath.Count > 2 && idNames[idNames.Length - 1].name.Equals(nodePath[nodePath.Count - 2])))
                    //{
                    //    tsmi.Checked = true;
                    //}

                    tsmiReferences.DropDownItems.Add(tsmi);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Opens the FocusedSord, if it is a document.
        /// </summary>
        /// <param name="e">EventArgs object</param>
        protected override void OnDoubleClick(EventArgs e)
        {
            base.OnDoubleClick(e);

            MouseEventArgs mouseArgs = (MouseEventArgs)e;

            if (mouseArgs.Button == MouseButtons.Left)
            {
                if (AllowOpenDocument && FocusedObject != null)
                {
                    FWSord sord = FocusedTask.Sord;
                    if (sord.IsDocument())
                    {
                        openDocumentHandler.Open((FWDocument)sord);
                    }
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Speichert die Änderungen die in der Verschlagwortungsmaske vorgenommen wurden.
        /// </summary>
        /// <param name="sender">Quelle, die das Erreigniss ausgelöst hat</param>
        /// <param name="e">Zusätzliche Informationen zu dem Erreigniss</param>
        private void cmbOk_Click(object sender, EventArgs e)
        {
            // prüfen ob alle Felder in Ordnung sind
            bool isValid = this.outlookIndexingUControl1.ProoveIndexFieldsContent();

            if (isValid)
            {
                if (mode == IndexingDialogMode.IndexingMode)
                {
                    actSelectedSord = this.outlookIndexingUControl1.GetSord();
                }
                if (mode == IndexingDialogMode.SearchMode)
                {
                    searchFindInfo = outlookIndexingUControl1.SearchFindInfo;
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                if (mode == IndexingDialogMode.IndexingMode)
                {
                    MessageBox.Show(this, Properties.Resources.Message_InvalidIndexingFields_Text,
                                    Properties.Resources.InfoMessage_Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                if (mode == IndexingDialogMode.SearchMode)
                {
                    MessageBox.Show(this, Properties.Resources.Message_Search_InputInvalid,
                                    Properties.Resources.InfoMessage_Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Checkin the modified file and Sord data into the archive.
        /// </summary>
        public override void Checkin()
        {
            if (sordVal.deleted)
            {
                String winPath = File;
                if (winPath != null)
                {
                    if (sordVal.lockId != Conn.Session.User.id)
                    {
                        // if not locked by me, checkout first
                        Version.FileModified = true;
                    }

                    // delete file via ELOFS
                    System.IO.File.Delete(File);
                    FSFileHelper.CheckinFile(winPath, "", "", 0, 0, 0);
                }
                else
                {
                    base.Checkin();
                }
            }
            else
            {
                if (Version.FileModified)
                {
                    if (!isFileInArchiveFolder(File))
                    {
                        // Die zuzuweisende Datei darf nicht schreibgeschützt sein, sonst
                        // wird das ELOFS sie mglw. gleich einchecken, wenn sie unten kopiert wird.
                        {
                            FileAttributes attrs = System.IO.File.GetAttributes(File);
                            if ((attrs & FileAttributes.ReadOnly) != 0)
                            {
                                System.IO.File.SetAttributes(File, attrs & ~FileAttributes.ReadOnly);
                            }
                        }

                        // Wenn neues Dokument, oder noch keine Version zugewiesen...
                        if (Version.Id == 0)
                        {
                            // Dateiendung in DocVersion setzen, damit unten GetFileSystemPath
                            // eine Endung zuweisen kann.
                            string ext = Path.GetExtension(File);
                            Version.Core.ext = ext;

                            // Sicherstellen, dass DocVersion objekt auch im Sord eingetragen ist.
                            sordVal.docVersion = Version.Core;
                        }

                        // Ensure RefPaths are read
                        string s           = ArcPathString;
                        string orgFilePath = ((FSContentInterface)ifc).GetFileSystemPath(Core, Version.Core);

                        if (System.IO.File.Exists(orgFilePath))
                        {
                            // sollte bereits ausgecheckt sein. wenn nicht, dann jetzt auschecken
                            FileAttributes attrs = System.IO.File.GetAttributes(orgFilePath);
                            if ((attrs & FileAttributes.ReadOnly) != 0)
                            {
                                FSFileHelper.CheckoutFile(orgFilePath);
                            }

                            // nochmal zur Sicherheit prüfen, dass die Datei ausgecheckt ist
                            attrs = System.IO.File.GetAttributes(orgFilePath);
                            if ((attrs & FileAttributes.ReadOnly) != 0)
                            {
                                throw new System.InvalidOperationException("File " + orgFilePath + " expected to be writable.");
                            }

                            // Originaldatei löschen (wird nicht im Archiv gelöscht)
                            System.IO.File.Delete(orgFilePath);
                        }

                        // Arbeitsdatei drüberkopieren
                        System.IO.File.Copy(File, orgFilePath);

                        File = orgFilePath;
                    }

                    Version.prepareCheckinDocBegin(Core);

                    String verNo   = mysubstring(Version.Version, Conn.CONST.DOC_VERSION.lnVersion);
                    String verDesc = mysubstring(Version.Comment, Conn.CONST.DOC_VERSION.lnComment);

                    FSFileHelper.CheckinFile(File, verNo, verDesc, Core.mask,
                                             Version.Core.pathId, Version.Core.encryptionSet);

                    if (sordVal.id == -1)
                    {
                        string arcPath = FSFileHelper.MakeArcPathFromFileName(File);
                        Sord   sordDB  = ifc.Conn.Ix.checkoutSord("FSPATH:" + arcPath, EditInfoC.mbOnlyId, LockC.NO).sord;
                        sordVal.id   = sordDB.id;
                        sordVal.guid = sordDB.guid;
                        sordVal.doc  = sordDB.doc;

                        FWSord fwsordDB = new FWSord(ifc, sordDB);
                        OriginalFileName = fwsordDB.OriginalFileName;
                    }

                    Version.Modified = false;
                }

                Document doc = uploadAllModifiedVersions();

                SordZ sordZ = new SordZ(sordVal.changedMembers);
                doc = Conn.Ix.checkinDocEnd(sordVal, sordZ, doc, LockC.YES);

                sordVal.id = Convert.ToInt32(doc.objId);
            }
        }
Пример #9
0
 /// <summary>
 /// Create new FWDocVersion object.
 /// </summary>
 /// <param name="dv">DocVersion object</param>
 /// <param name="sord">Sord object.</param>
 /// <param name="type">Type of version object: version, attachment, etc.</param>
 /// <returns>FWDocVersion object</returns>
 public override FWDocVersion NewDocVersion(DocVersion dv, FWSord sord, FWDocVersionType type)
 {
     return(new FSDocVersion((FSContentInterface)ifc, dv, sord, type));
 }
Пример #10
0
        /// <summary>
        /// Creates a ListViewItem for the given Sord object.
        /// </summary>
        /// <param name="objT">Sord object</param>
        /// <returns>ListViewItem object</returns>
        protected override ListViewItem makeItem(Object objT)
        {
            FWSord       sord = (FWSord)objT;
            ListViewItem li   = new ListViewItem();

            if (Conn != null && objT != null)
            {
                String fname = sord.Name;
                if (sord is FWDocument)
                {
                    String ext = ((FWDocument)sord).Version.Core.ext;
                    if (ext != null && ext.Length != 0)
                    {
                        fname += "." + ext;
                    }
                }

                li.ForeColor = sord.RGBColor;
                //li.Text = fname;
                li.Text       = sord.Name;
                li.ImageIndex = sord.ImageIndex;
                if (sord.XDate.Ticks == 0)
                {
                    li.SubItems.Add("");
                }
                else if (sord.XDate.Hour == 0 && sord.XDate.Minute == 0)
                {
                    li.SubItems.Add(sord.XDate.ToString("d"));
                }
                else
                {
                    li.SubItems.Add(sord.XDate.ToString("g"));
                }
                //li.SubItems.Add(sord.XDate.Ticks != 0 ? sord.XDate.ToString("g") : "");
                li.SubItems.Add(sord.IDate.ToString());

                //EloixClient.IndexServerFW.MasterData.FWDocMask docMask = Conn.MasterData.DocMasks.GetValueOrDefault(sord.MaskId, Conn.MasterData.DocMasks[0]);
                EloixClient.IndexServerFW.MasterData.FWDocMask docMask = Conn.MasterData.DocMasks[sord.MaskId];

                //li.SubItems.Add(Conn.MasterData.DocMasks[sord.MaskId].Name);
                li.SubItems.Add(docMask.Name);
                li.SubItems.Add(sord.OwnerName);

                FWDocument doc = (sord is FWDocument) ? (FWDocument)sord : null;
                if (doc != null)
                {
                    li.SubItems.Add(doc.Version.Version);
                    if (doc.Version.CreateDate.Ticks == 0)
                    {
                        li.SubItems.Add("");
                    }
                    else if (doc.Version.CreateDate.Hour == 0 && doc.Version.CreateDate.Minute == 0)
                    {
                        li.SubItems.Add(doc.Version.CreateDate.ToString("d"));
                    }
                    else
                    {
                        li.SubItems.Add(doc.Version.CreateDate.ToString("g"));
                    }
                    //li.SubItems.Add(doc.Version.CreateDate.Ticks != 0 ? doc.Version.CreateDate.ToString("g") : "");
                    li.SubItems.Add(doc.Version.OwnerName);
                    li.SubItems.Add(doc.Version.SizeKB);
                }
                else
                {
                    li.SubItems.Add("");
                    li.SubItems.Add("");
                    li.SubItems.Add("");
                    li.SubItems.Add("");
                }

                li.SubItems.Add(sord.ArcPathString);
                li.SubItems.Add(sord.LockName);

                if (this.ShowObjKeyColumns)
                {
                    for (int colIdx = 11; colIdx < this.Columns.Count; colIdx++)
                    {
                        ColumnHeaderTag htag = (ColumnHeaderTag)this.Columns[colIdx].Tag;
                        FWCompareSordByObjKey <FWSord> compByObjKey = (FWCompareSordByObjKey <FWSord>)htag.compareObject;
                        FWObjKey okey = sord.ObjKeys[compByObjKey.groupName];
                        li.SubItems.Add(okey != null ? (String)okey.Value : "");
                    }
                }
                li.Tag = sord;
            }
            return(li);
        }
Пример #11
0
        /// <summary>
        ///     <see cref="VirtualListView.makeColumns()"/>
        /// </summary>
        /// <remarks>
        /// Create an additional column for each of the index groups used by the cached Sord objects.
        /// It merly looks on the currently available Sords in the cache and does not
        /// read all Sords from the IndexServer.
        /// </remarks>
        protected override void makeColumns()
        {
            if (objectsCacheValue == null)
            {
                return;
            }

            Dictionary <String, DocMaskLineUsage> mapDmlUsage = new Dictionary <String, DocMaskLineUsage>();

            if (this.ShowObjKeyColumns)
            {
                for (int i = 0; i < objectsCacheValue.CountEstimated; i++)
                {
                    FWSord sord = SordsCache[i];

                    if (!ShowDocuments && (sord is FWDocument))
                    {
                        continue;
                    }
                    if (!ShowFolders && (sord is FWFolder))
                    {
                        continue;
                    }

                    DocMask dm = Conn.MasterData.DocMasks[sord.MaskId].Core;
                    for (int dmlIdx = 0; dmlIdx < dm.lines.Length; dmlIdx++)
                    {
                        DocMaskLine      dml       = dm.lines[dmlIdx];
                        String           groupName = dml.key.ToLower();
                        DocMaskLineUsage u         = null;
                        if (!mapDmlUsage.TryGetValue(groupName, out u))
                        {
                            u            = new DocMaskLineUsage();
                            u.GroupName  = groupName;
                            u.lableNames = new List <String>();
                            u.lableNames.Add(dml.name);
                            mapDmlUsage[groupName] = u;
                        }
                        u.usageCount++;
                        u.minDmlId = Math.Min(u.minDmlId, dmlIdx);
                        FWObjKeyValue okeyValue = sord.ObjKeys[dmlIdx].Value;
                        if (okeyValue != null && !okeyValue.IsEmpty())
                        {
                            u.valueCount++;
                        }
                    }
                }
            }

            List <DocMaskLineUsage> lstDmlUsages = new List <DocMaskLineUsage>(mapDmlUsage.Values);

            lstDmlUsages.Sort(new DocMaskLineUsageComparer());

            List <ColumnHeaderEx> lstHeaders = new List <ColumnHeaderEx>(lstDmlUsages.Count + 11);

            ColumnHeaderName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByName <FWSord>()));
            lstHeaders.Add(ColumnHeaderName);

            ColumnHeaderXDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByXDate <FWSord>()));
            lstHeaders.Add(ColumnHeaderXDate);

            ColumnHeaderIDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByIDate <FWSord>()));
            lstHeaders.Add(ColumnHeaderIDate);

            ColumnHeaderMaskName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByMaskName <FWSord>(this.connVal)));
            lstHeaders.Add(ColumnHeaderMaskName);

            ColumnHeaderOwner.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByOwnerName <FWSord>()));
            lstHeaders.Add(ColumnHeaderOwner);

            ColumnHeaderVersion.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersion <FWSord>()));
            lstHeaders.Add(ColumnHeaderVersion);

            ColumnHeaderVersionDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionDate <FWSord>()));
            lstHeaders.Add(ColumnHeaderVersionDate);

            ColumnHeaderVersionUser.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionOwner <FWSord>()));
            lstHeaders.Add(ColumnHeaderVersionUser);

            ColumnHeaderFileSize.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionFileSize <FWSord>()));
            lstHeaders.Add(ColumnHeaderFileSize);

            ColumnHeaderArcPath.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByArcPath <FWSord>()));
            lstHeaders.Add(ColumnHeaderArcPath);

            ColumnHeaderLockName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByLockName <FWSord>()));
            lstHeaders.Add(ColumnHeaderLockName);

            if (this.ShowObjKeyColumns)
            {
                foreach (DocMaskLineUsage u in lstDmlUsages)
                {
                    if (u.valueCount > 0)
                    {
                        ColumnHeaderEx h     = new ColumnHeaderEx();
                        String         hname = "";
                        for (int i = 0; i < u.lableNames.Count; i++)
                        {
                            if (i > 0)
                            {
                                hname += "/";
                            }
                            hname += u.lableNames[i];
                        }
                        h.Text = hname;
                        h.Tag  = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByObjKey <FWSord>(u.GroupName)));
                        h.Name = hname;
                        lstHeaders.Add(h);
                    }
                }
            }

            this.Columns.Clear();
            this.Columns.AddRange(lstHeaders.ToArray());
        }
Пример #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ifc">Content interface object</param>
 /// <param name="dv">DocVersion object</param>
 /// <param name="sord">Sord object</param>
 /// <param name="type">Type of DocVersion object (version, attachment, signature, preview). </param>
 public FSDocVersion(FSContentInterface ifc, DocVersion dv, FWSord sord, FWDocVersionType type)
     : base(ifc, dv, sord, type)
 {
 }
Пример #13
0
 /// <summary>
 /// Beendet die Verschlagwortung ohne die Änderungen zu speichern
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbCancel_Click(object sender, EventArgs e)
 {
     actSelectedSord   = outlookIndexingUControl1.Sord;
     this.DialogResult = DialogResult.Cancel;
     this.Close();
 }
Пример #14
0
 private void arcTreeView1_TreeDoubleClick(TreeNode tn, FWSord sord)
 {
 }