Example #1
0
        public static void ShowList(FWConnection conn, FWFindTasksCache tasksCache)
        {
            FormTaskList frm = new FormTaskList();

            frm.taskListView1.Conn       = conn;
            frm.taskListView1.TasksCache = tasksCache;
            frm.ShowDialog();
        }
Example #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection to IndexServer</param>
 /// <param name="connProps">Connection properties</param>
 public FWSessionInterface(FWConnection conn, IXProperties connProps)
 {
     this.classFactoryVal  = new FWSessionClassFactory(this);
     this.connVal          = conn;
     this.sessOptsVal      = ClassFactory.NewSessionOptions();
     this.encrPasswordsVal = ClassFactory.NewEncrPasswords();
     this.userProfileVal   = ClassFactory.NewUserProfile(null);
 }
Example #3
0
        public static void DoDialog(FWConnection conn, String keywordListId)
        {
            FormTextBoxKeyword dlg = new FormTextBoxKeyword();

            dlg.keywordTextBox1.KeywordList = conn.MasterData.Keywords[keywordListId];
            dlg.keywordTextBox2.KeywordList = conn.MasterData.Keywords[keywordListId];
            dlg.keywordTextBox3.KeywordList = conn.MasterData.Keywords[KeywordC.KWID_USER_LIST];
            dlg.ShowDialog();
        }
Example #4
0
        /// <summary>
        /// Initializes this object
        /// </summary>
        /// <param name="conn">Connection object</param>
        /// <param name="arcName">Archive name</param>
        /// <param name="connProps">Connection properties</param>
        public override void Init(FWConnection conn, string arcName, IXProperties connProps)
        {
            base.Init(conn, arcName, connProps);

            // read more members than the base class:
            // e.g. the archive path is required to build ELOFS paths
            base.sordZVal = new SordZ(SordC.mbLeanMembers | SordC.mbDocVersionMembers | SordC.mbRefPaths);
            base.editZVal = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers, sordZVal);
        }
Example #5
0
        public static void ShowTree(FWConnection conn, FWFolder parentFolder)
        {
            FormTree frm = new FormTree();

            frm.arcTreeView1.ParentFolder   = parentFolder;
            frm.ckShowDocuments.Checked     = frm.arcTreeView1.ShowDocuments;
            frm.ckShowReferences.Checked    = frm.arcTreeView1.ShowReferences;
            frm.ckAllowDrag.Checked         = frm.arcTreeView1.AllowDrag;
            frm.ckAllowDrop.Checked         = frm.arcTreeView1.AllowDrop;
            frm.ckAllowOpenDocument.Checked = frm.arcTreeView1.AllowOpenDocument;
            frm.ShowDialog();
        }
Example #6
0
        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="conn">Connection object</param>
        /// <param name="arcName">Archive name</param>
        /// <param name="connProps">Connection properties</param>
        /// <returns></returns>
        public virtual void Init(FWConnection conn, string arcName, IXProperties connProps)
        {
            this.connVal         = conn;
            this.classFactoryVal = new FWContentClassFactory(this);
            this.sordZVal        = new SordZ(SordC.mbLeanMembers | SordC.mbDocVersionMembers);
            this.editZVal        = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers, sordZVal);

            // try to get the temporary directory from the connection properties
            String tmpDir = (connProps != null) ? connProps[FWConnFactory.PROP_TEMP_DIR] : null;

            if (tmpDir != null && tmpDir.Length != 0)
            {
                tempDirVal     = makeTempDir(tmpDir, Path.Combine(arcName, "Temp"));
                checkoutDirVal = makeTempDir(tmpDir, Path.Combine(arcName, "Checkout"));
            }
            else
            {
                try
                {
                    // not found: use the users APPDATA directory
                    tempDirVal     = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Temp"));
                    checkoutDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Checkout"));
                }
                catch (Exception)
                {
                    try
                    {
                        tempDirVal     = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Temp"));
                        checkoutDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Checkout"));
                    }
                    catch (Exception)
                    {
                        // Konto "Local System" unter Windows 2003 kann nicht auf APPDATA zugreifen.

                        tempDirVal     = makeTempDir(Path.Combine(Path.GetTempPath(), "ELO Digital Office"), Path.Combine(arcName, "Temp"));
                        checkoutDirVal = makeTempDir(Path.Combine(Path.GetTempPath(), "ELO Digital Office"), Path.Combine(arcName, "Checkout"));
                    }
                }
            }


            // Initialize the FWDownloadManager object
            downloadManagerVal = ClassFactory.NewDownloadManager(
                tempDirVal,
                connProps.Get(FWConnFactory.PROP_CACHE_DOCUMENT_LIFETIME_SECONDS,
                              FWConnFactory.PROP_CACHE_DOCUMENT_LIFETIME_DEFAULT));

            checkedOutDocumentsManagerVal = ClassFactory.NewCheckedOutDocumentsManager(checkoutDirVal);
        }
Example #7
0
        /// <summary>
        /// Opens a dialog for selecting users and returns the selection.
        /// </summary>
        /// <param name="conn">IndexServer connection</param>
        /// <param name="flags">Options</param>
        /// <param name="selectUserIds">List of user IDs to be selected</param>
        /// <param name="hideUserIds">reserved</param>
        /// <returns>Selected users</returns>
        public static IEnumerable <UserName> DoSelectUser(FWConnection conn,
                                                          FormSelectUserFlags flags,
                                                          IEnumerable <int> selectUserIds,
                                                          IEnumerable <int> hideUserIds)
        {
            FormSelectUser frm = Create(conn, flags, selectUserIds, hideUserIds);

            IEnumerable <UserName> ret = null;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                ret = frm.SelectUserControl.SelectedUsers;
            }
            return(ret);
        }
Example #8
0
        public static void DoDialog(FWConnection conn, String parentId)
        {
            FormExplorer dialog = new FormExplorer();

            dialog.arcTreeView1.Conn = conn; dialog.arcTreeView1.ShowDocuments = true;
            dialog.sordListView1.ColumnHeaderArcPath.Width     = 0;
            dialog.sordListView1.ColumnHeaderMaskName.Width    = 0;
            dialog.sordListView1.ColumnHeaderIDate.Width       = 0;
            dialog.sordListView1.ColumnHeaderOwner.Width       = 0;
            dialog.sordListView1.ColumnHeaderVersion.Width     = 0;
            dialog.sordListView1.ColumnHeaderVersionDate.Width = 0;
            dialog.sordListView1.ColumnHeaderVersionUser.Width = 0;
            dialog.sordListView1.ColumnHeaderLockName.Width    = 100;

            //dialog.sordListView1.ColumnHeaderVersion.DisplayIndex = 1;
            dialog.ShowDialog();
        }
Example #9
0
        /// <summary>
        /// Create and initialize a dialog object.
        /// </summary>
        /// <param name="conn">IndexServer connection</param>
        /// <param name="flags">Options</param>
        /// <param name="selectUserIds">List of user IDs to be selected</param>
        /// <param name="hideUserIds">List of user IDs to be hidden</param>
        /// <returns>Dialog object</returns>
        public static FormSelectUser Create(FWConnection conn,
                                            FormSelectUserFlags flags,
                                            IEnumerable <int> selectUserIds,
                                            IEnumerable <int> hideUserIds)
        {
            FormSelectUser frm = new FormSelectUser();

            frm.SelectUserControl.ShowUsers     = (flags & FormSelectUserFlags.ShowUsers) != 0;
            frm.SelectUserControl.ShowGroups    = (flags & FormSelectUserFlags.ShowGroups) != 0;
            frm.SelectUserControl.MultiSelect   = (flags & FormSelectUserFlags.MultiSelect) != 0;
            frm.SelectUserControl.HiddenUserIds = hideUserIds;
            frm.SelectUserControl.Conn          = conn;

            frm.SelectUserControl.SelectedUserIds = selectUserIds;

            return(frm);
        }
Example #10
0
        public static void ShowList(FWConnection conn, FWFindSordsCache <FWSord> sordsCache)
        {
            FormSordList frm = new FormSordList();

            frm.sordListView1.Conn       = conn;
            frm.sordListView1.SordsCache = sordsCache;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                IEnumerable <FWSord> sords  = frm.sordListView1.SelectedSords;
                StringBuilder        sbuild = new StringBuilder();
                sbuild.Append("Selected Sords: ");
                foreach (FWSord sord in sords)
                {
                    sbuild.Append(sord.Name).Append(",");
                }
                System.Windows.Forms.MessageBox.Show(sbuild.ToString());
            }
        }
Example #11
0
        /// <summary>
        /// Constructor, creates the connection to IndexServer
        /// </summary>
        public Form1()
        {
            try
            {
                // Connection to IndexServer
                FWConnFactory connFact = new FWConnFactory(url, "ExampleFW", "1.0");
                try
                {
                    conn = connFact.CreateSso(System.Environment.MachineName);
                    MessageBox.Show("SSO successful");
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    conn = connFact.Create(null, userName, userPwd, System.Environment.MachineName, null);
                }

                if (conn != null)
                {
                    ///////////////////////
                    // encrypt and decrypt documents
                    conn.Session.Options[SessionOptionsC.ENCRYPT_DOCUMENTS] = "true";
                    conn.Session.Options[SessionOptionsC.DECRYPT_DOCUMENTS] = "true";
                    conn.Session.Options.Checkin();
                    // supply encryption password
                    //conn.Session.EncrPasswords["1"] = "elo";
                    //conn.Session.EncrPasswords.Checkin();
                }

                InitializeComponent();
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }

            this.Icon = EloixClientUI.Properties.Resources.MainIcon;
        }
Example #12
0
        /// <summary>
        /// Gets or creates an IndexServer connection.
        /// </summary>
        /// <param name="ec">Execution context object passed to an event handler.</param>
        /// <returns></returns>
        public FWConnection getConn(IXServerEventsContext ec)
        {
            if (ec.url == null || ec.url.Length == 0)
            {
                throw new ArgumentException("Missing IndexServer URL");
            }

            FWConnection conn = null;

            lock (this)
            {
                FWConnFactoryEventHandler fact = null;
                if (!mapFacts.TryGetValue(ec.url, out fact))
                {
                    fact             = new FWConnFactoryEventHandler(ec.url, appName, appVersion);
                    mapFacts[ec.url] = fact;
                }

                conn = fact.CreateConnForEventHandler(ec.ci);
            }

            return(conn);
        }
Example #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn"></param>
 public FWAclItemsImpl(FWConnection conn)
     : base(conn)
 {
 }
Example #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection object</param>
 public FWAclItems(FWConnection conn)
 {
     _conn = conn;
 }
        /// <summary>
        /// Creates a checked out and state file in a checkout directory for a specific document. For creation of checked out
        /// and state file document must be locked by actually user. If files already exists no one will be created.
        /// </summary>
        /// <param name="document">
        /// Document locked by actually user, for that checkedout and state file have to be created.
        /// </param>
        /// <exception cref="Exception">
        /// Exception will be issued, if checked out or state file was not created successfully or some error occures, while creating it.
        /// </exception>
        protected virtual void CreateCheckedOutDocumentFiles(FWDocument document)
        {
            bool existsDocument                  = (document != null);
            bool existsIxConn                    = (document.Conn != null);
            bool existsDocUrl                    = (document != null && document.Version != null && !string.IsNullOrEmpty(document.Version.Url));
            bool isDocLockedByActuallyUser       = (document != null && document.LockId == document.Conn.Session.User.id);
            bool existsCheckedOutDocumentAlready = (document != null && !string.IsNullOrEmpty(document.CheckedoutFile) && File.Exists(document.CheckedoutFile));

            if (!existsDocument || !existsIxConn || !existsDocUrl || !isDocLockedByActuallyUser)
            {
                throw new Exception("Für die Bearbeitung des Dokuments konnten im Checkout Verzeichniss nicht die erforderlichen Dateien erstellt werden. Mögliche Ursachen: Dokument oder Verbindung zum Indexserver nicht vorhanden, Url für den Download des Dokuments nicht vorhanden oder das Dokument ist nicht durch den momentanen Benutzer für die Bearbeitung gesperrt.");
            }
            else
            {
                if (!existsCheckedOutDocumentAlready)
                {
                    FWConnection ixConn = document.Conn;
                    string       docUrl = document.Version.Url;

                    // download the file, if it's a read-URL
                    // (DocVersion contains a write-URL after checkinDocBegin)
                    if (docUrl.IndexOf("readdoc") >= 0)
                    {
                        // Create file path to new checked out document
                        string checkedOutFilePath = MakeCheckOutFilePath(document);

                        // If new created checkout file path exists. This can be if old file was not deleted yet or could not be deleted because
                        // it is locked by another process.
                        bool existsCheckedOutFilePath = (!string.IsNullOrEmpty(checkedOutFilePath) && File.Exists(checkedOutFilePath));

                        // If checkout file path created above already exists than create one with guid. This is an unique file path, becuase file path
                        // contains a guid that only appears one time.
                        if (existsCheckedOutFilePath)
                        {
                            checkedOutFilePath = MakeCheckOutFilePathWithGuid(document);
                        }

                        // Download file into
                        ixConn.Content.Download(docUrl, checkedOutFilePath);

                        if (string.IsNullOrEmpty(checkedOutFilePath) || !File.Exists(checkedOutFilePath))
                        {
                            string errorMsg = string.Format("Für die Bearbeitung des Dokuments {0} konnten in CheckOut Verzeichniss nicht die notwendigen Dateien erstellt werden.", document.Name);
                            throw new Exception(errorMsg);
                        }

                        // Create state file for checked out document
                        string stateFilePath = ixConn.Content.DownloadManager.CreateStateFile(checkedOutFilePath, document.Id.ToString(), document.Version.Id.ToString(), document.LockId.ToString());

                        if (string.IsNullOrEmpty(stateFilePath) || !File.Exists(stateFilePath))
                        {
                            string errorMsg = string.Format("Für die Bearbeitung des Dokuments {0} konnten in CheckOut Verzeichniss nicht die notwendigen Dateien erstellt werden.", document.Name);
                            throw new Exception(errorMsg);
                        }

                        // If checkout file and state file was created successfully set file attribute to normal, to ensure,
                        // that file can be modified
                        FileInfo checkedOutFileInfo = new FileInfo(checkedOutFilePath);
                        checkedOutFileInfo.Attributes = FileAttributes.Normal;

                        // Issue a event
                        OnNewCheckedOutDocument(new EventArgs());
                    }
                }
            }
        }
        /// <summary>
        /// Checks out a selected document and returns back result of checkout. While checkout of selected document checked out and state file will be created in
        /// checkout directory.
        /// </summary>
        /// <param name="document">Document, that have to be checked out.</param>
        /// <returns>
        /// Result of checkout operation.
        /// </returns>
        public CheckoutResult Checkout(FWDocument document)
        {
            CheckoutResult checkOutResult = new CheckoutResult()
            {
                FWDocument = document, Success = false
            };

            try
            {
                bool existsDocForCheckOut = (document != null);
                bool existsDocUrl         = (document != null && document.Version != null && !string.IsNullOrEmpty(document.Version.Url));
                bool existsIxConn         = (document.Conn != null);

                if (existsDocForCheckOut && existsDocUrl && existsIxConn)
                {
                    // Delete not more checked out documents in checkout directory
                    ForceCleanup();

                    // Actualize data of document
                    document.Refresh();
                    FWConnection ixConn = document.Conn;

                    // Exists checkout file already
                    bool existsCheckedOutFile = (!string.IsNullOrEmpty(document.CheckedoutFile) && File.Exists(document.CheckedoutFile));

                    // If checkout file already exists
                    if (existsCheckedOutFile)
                    {
                        // If document lock, not exists for currently user set one
                        if (document.LockId == -1)
                        {
                            FWDocument lockedDocument = ixConn.Content.LockDocument(document.Id);
                            if (lockedDocument.LockId == ixConn.Session.User.id)
                            {
                                checkOutResult.FWDocument = lockedDocument;
                                checkOutResult.Success    = true;
                            }
                            else
                            {
                                checkOutResult.Message = string.Format("Das Dokument {0} kann nicht zur Bearbeitung ausgecheckt werden, da das Sperren des Dokuments für die Bearbeitung nicht erfolgreich durchgeführt werden konnte.", document.Name);
                            }
                        }
                        else
                        {
                            if (document.LockId == ixConn.Session.User.id)
                            {
                                checkOutResult.FWDocument = document;
                                checkOutResult.Success    = true;
                            }
                            else
                            {
                                checkOutResult.Message = string.Format("Das Dokument {0} kann nicht zur Bearbeitung ausgecheckt werden, da dieses bereits durch einen anderen Benutzer für die Bearbeitung gesperrt worden ist.", document.Name);
                            }
                        }
                    }
                    else
                    {
                        if (document.LockId == -1)
                        {
                            FWDocument lockedDocument = ixConn.Content.LockDocument(document.Id);
                            if (lockedDocument.LockId == ixConn.Session.User.id)
                            {
                                // Create checkout file and state file for checked out document
                                CreateCheckedOutDocumentFiles(lockedDocument);

                                lockedDocument.Refresh();

                                checkOutResult.FWDocument = lockedDocument;
                                checkOutResult.Success    = true;
                            }
                            else
                            {
                                checkOutResult.Message = string.Format("Das Dokument {0} kann nicht zur Bearbeitung ausgecheckt werden, da das Sperren des Dokuments für die Bearbeitung nicht erfolgreich durchgeführt werden konnte.", document.Name);
                            }
                        }
                        else if (document.LockId == ixConn.Session.User.id)
                        {
                            // Create checkout file and state file for checked out document
                            CreateCheckedOutDocumentFiles(document);

                            document.Refresh();

                            checkOutResult.FWDocument = document;
                            checkOutResult.Success    = true;
                        }
                        else
                        {
                            checkOutResult.Message = string.Format("Das Dokument {0} kann nicht zur Bearbeitung ausgecheckt werden, da es durch einen anderen Benutzer bereits für die Bearbeitung gesperrt worden ist.", document.Name);
                        }
                    }
                }
                else
                {
                    checkOutResult.Message = "Das Dokument kann nicht zur Bearbeitung ausgecheckt werden. Mögliche Ursachen: Dokument existiert nicht, keine Verbindung zum Indexserver oder die Url des Dokuments ist nicht vorhanden.";
                }
            }
            catch (Exception ex)
            {
                checkOutResult.Success = false;
                checkOutResult.Message = "Das Auschecken des Dokuments zur Bearbeitung ist aufgrund des folgenden Fehlers fehlgeschlagen. Fehler: " + ex.Message;
            }

            return(checkOutResult);
        }
Example #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">IndexServer connection</param>
 /// <param name="maskId">Storage mask ID, GUID, name</param>
 public FWObjKeys(FWConnection conn, string maskId)
 {
     _conn   = conn;
     _maskId = maskId;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection to IndexServer</param>
 /// <param name="connProps">Connection properties</param>
 public FWMasterDataInterface(FWConnection conn, IXProperties connProps)
 {
     this.classFactoryVal = new FWMasterDataClassFactory(this);
     this.connVal         = conn;
 }
Example #19
0
 /// <summary>
 /// Is called in set method of Conn property.
 /// </summary>
 /// <param name="oldConn">Old connection object</param>
 /// <param name="newConn">New connection object</param>
 protected virtual void OnConnChanged(FWConnection oldConn, FWConnection newConn)
 {
 }
Example #20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection to IndexServer</param>
 /// <remarks>
 /// The default document mask defined by the Windows Client is used by default.
 /// </remarks>
 public CheckinDocumentHandler(FWConnection conn)
 {
     Conn = conn;
 }
Example #21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection to IndexServer</param>
 /// <param name="connProps">Connection properties</param>
 public FWWorkflowInterface(FWConnection conn, IXProperties connProps)
 {
     this.classFactoryVal = new FWWorkflowClassFactory(this);
     this.connVal         = conn;
 }
Example #22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">IndexServer connection</param>
 /// <param name="maskId">Storage mask ID, GUID or name</param>
 public FWObjKeysImpl(FWConnection conn, string maskId) : base(conn, maskId)
 {
 }
Example #23
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection to IndexServer</param>
 /// <remarks>
 /// The default document mask defined by the Windows Client is used by default.
 /// </remarks>
 public DocumentDataObject(FWConnection conn)
 {
     Conn = conn;
 }
Example #24
0
 public FWDocMask(FWConnection conn, DocMask docMask)
 {
     connVal    = conn;
     docMaskVal = docMask;
 }
Example #25
0
 /// <summary>
 /// Creates a new DocumentDataObject.
 /// </summary>
 /// <param name="oldConn">Old connection</param>
 /// <param name="newConn">New connection</param>
 protected override void OnConnChanged(FWConnection oldConn, FWConnection newConn)
 {
     checkinDocumentHandler = new DocumentDataObject(newConn);
 }
Example #26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="conn">Connection object</param>
 public FWCompareSordByMaskName(FWConnection conn)
 {
     this.conn = conn;
 }