Exemple #1
0
        public virtual iFolderSet GetiFoldersByName(SearchOperation operation, string pattern, int index, int max)
        {
            iFolderSet result = null;

            try
            {
                Authorize();

                result = iFolder.GetiFoldersByMember(GetUserID(), MemberRole.Any, operation, pattern, index, max, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemple #2
0
        public virtual iFolderSet GetiFolders(int index, int max)
        {
            iFolderSet result = null;

            try
            {
                string accessID = GetAccessID();

                result = iFolder.GetiFoldersByMember(accessID, MemberRole.Any, index, max, accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemple #3
0
        public virtual iFolderSet GetiFoldersBySearch(MemberRole role, DateTime after, SearchOperation operation, string pattern, int index, int max)
        {
            iFolderSet result = null;

            try
            {
                Authorize();

                string accessID = GetAccessID();

                result = iFolder.GetiFoldersByMember(accessID, role, after, operation, pattern, index, max, accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemple #4
0
        /// <summary>
        /// Bind the Data to the Page.
        /// </summary>
        private void BindData()
        {
            // table
            DataTable ifolderTable = new DataTable();

            ifolderTable.Columns.Add("ID");
            ifolderTable.Columns.Add("Image");
            ifolderTable.Columns.Add("Name");
            ifolderTable.Columns.Add("iFolderFullName");
            ifolderTable.Columns.Add("LastModified");
            ifolderTable.Columns.Add("Description");
            ifolderTable.Columns.Add("Rights");
            ifolderTable.Columns.Add("Size");
            ifolderTable.Columns.Add("OwnerFullName");
            ifolderTable.Columns.Add(new DataColumn("EnabledField", typeof(bool)));

            // category
            iFolderCategory category = HomeContext.Category;
            MemberRole      role     = MemberRole.Any;
            DateTime        after    = DateTime.MinValue;

            switch (category)
            {
            case iFolderCategory.Recent:
                after = DateTime.Now.AddDays(-30);
                break;

            case iFolderCategory.Owned:
                role = MemberRole.Owner;
                break;

            case iFolderCategory.Shared:
                role = MemberRole.Shared;
                break;

            case iFolderCategory.All:
            default:
                break;
            }

            try
            {
                // data
                string     escPattern = Regex.Escape(HomeContext.Pattern).Replace("\\*", ".*").Replace("\\?", ".");
                iFolderSet ifolders   = web.GetiFoldersBySearch(role, after, SearchOperation.Contains,
                                                                escPattern, iFolderPagging.Index, iFolderPagging.PageSize);
                iFolderPagging.Count = ifolders.Items.Length;
                iFolderPagging.Total = ifolders.Total;

                string name, ImageUrl;
                bool   pattern = (HomeContext.Pattern != null) && (HomeContext.Pattern.Length > 0);

                foreach (iFolder ifolder in ifolders.Items)
                {
                    bool encrypted = false;
                    try{
                        string     ifolderLocation = web.GetiFolderLocation(ifolder.ID);
                        UriBuilder remoteurl       = new UriBuilder(ifolderLocation);
                        remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                        web.Url        = remoteurl.Uri.ToString();
                    }catch
                    {
                        continue;
                    }
                    iFolder folder = null;
                    try{
                        folder = web.GetiFolder(ifolder.ID);
                    }
                    catch (Exception e)
                    {
                        string type = e.GetType().Name;
                        if (type != null && type == "MemberDoesNotExistException")
                        {
                            /// If we get member does not exist exception in the first call itself, no need to make a GetiFolder call to current server.
                            continue;
                        }
                        web.Url = currentServerURL;
                        try
                        {
                            folder = web.GetiFolder(ifolder.ID);
                        }
                        catch
                        {
                            /// If we are unable to get the iFolder information for the current entry, skip this and go to next entry...
                            folder = null;
                        }
                    }
                    /// By any chance if we are not able to get the iFolder information, proceed fetch the details of next entry.
                    if (folder == null)
                    {
                        continue;
                    }
                    string EncryptionAlgorithm = folder.EncryptionAlgorithm;
                    if (!(EncryptionAlgorithm == null || (EncryptionAlgorithm == String.Empty)))
                    {
                        // It is an encrypted ifolder
                        encrypted = true;
                    }

                    bool shared = (ifolder.MemberCount > 1) ? true : false;

                    bool enabled = (folder.Enabled) ? true : false;

                    ImageUrl = (!enabled)? "ifolder_16-gray.gif" : ((encrypted) ? "encrypt_ilock2_16.gif" : (shared ? "ifolder_user_16.gif" : "ifolder.png"));

                    DataRow row = ifolderTable.NewRow();

                    // selected name
                    if (pattern)
                    {
                        name = Regex.Replace(ifolder.Name, String.Format("({0})", escPattern),
                                             "<span class='highlight'>${1}</span>", RegexOptions.IgnoreCase);
                    }
                    else
                    {
                        name = ifolder.Name;
                    }

                    string ShortenedName   = null;
                    int    ShortenedLength = 70;
                    if (!pattern && name.Length > ShortenedLength)
                    {
                        // make it of desired length
                        ShortenedName = web.GetShortenedName(name, ShortenedLength);
                    }
                    row["ID"]              = ifolder.ID;
                    row["Image"]           = ImageUrl;
                    row["Name"]            = (!pattern && (name.Length > ShortenedLength)) ? ShortenedName : name;
                    row["iFolderFullName"] = name;
                    row["LastModified"]    = WebUtility.FormatDate(ifolder.LastModified, rm);
                    row["Description"]     = ifolder.Description;
                    row["Rights"]          = WebUtility.FormatRights(ifolder.MemberRights, rm);
                    row["Size"]            = WebUtility.FormatSize(ifolder.Size, rm);
                    row["OwnerFullName"]   = (ifolder.OwnerFullName == "")? ifolder.OwnerUserName : ifolder.OwnerFullName;
                    row["EnabledField"]    = enabled;

                    ifolderTable.Rows.Add(row);
                }
            }
            catch (SoapException ex)
            {
                if (!HandleException(ex))
                {
                    throw;
                }
            }

            // view
            DataView ifolderView = new DataView(ifolderTable);

            ifolderView.Sort = "Name";

            // data grid
            iFolderData.DataKeyField = "ID";
            iFolderData.DataSource   = ifolderView;
            iFolderData.DataBind();

            // Pass this page information to create the help link
            Head.AddHelpLink(GetString("IFOLDERS"));

            string PasswordChanged = Request.QueryString.Get("PasswordChanged");

            if (PasswordChanged != null && PasswordChanged == "true")
            {
                Message.Info = GetString("PASSWORDCHANGESUCCESS");
                return;
            }
        }
Exemple #5
0
        /// <summary>
        /// Gets the displayable ifolder system information.
        /// </summary>
        private void GetSystemInformation()
        {
            iFolderSystem system = web.GetSystem();

            Name.Text         = system.Name;
            Description.Value = system.Description;
            if (system.UsersFullNameDisplay == "FirstNameLastName")
            {
                FullNameSetting.SelectedIndex = 0;
            }
            else
            {
                FullNameSetting.SelectedIndex = 1;
            }
            if (system.GroupSegregated == "yes")
            {
                GroupSegregated.Checked = true;
            }

            if (system.GroupQuotaRestrictionMethod == (int)QuotaRestriction.UI_Based)
            {
                GroupQuotaRestriction.SelectedIndex = 0;
            }
            else if (system.GroupQuotaRestrictionMethod == (int)QuotaRestriction.Sync_Based)
            {
                GroupQuotaRestriction.SelectedIndex = 1;
            }

            iFolderUserSet users = web.GetUsers(0, 1);

            NumberOfUsers.Text = users.Total.ToString();

            iFolderSet ifolders = web.GetiFolders(iFolderType.All, 0, 1);

            NumberOfiFolders.Text = ifolders.Total.ToString();

            web.Url = currentServerURL;
            iFolderServer[] list = web.GetServers();
            foreach (iFolderServer server in list)
            {
                if (server.IsLocal)
                {
                    UriBuilder remoteurl = new UriBuilder(server.PublicUrl);
                    remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                    web.Url        = remoteurl.Uri.ToString();

                    string [] SSlOptionsStr = new string [3];
                    SSlOptionsStr[0] = GetString("SSLSTRING");
                    SSlOptionsStr[1] = GetString("NONSSLSTRING");
                    SSlOptionsStr[2] = GetString("BOTHSTRING");
                    string     SelectedString  = "";
                    string     simiassslstatus = web.GetSimiasRequiresSSLStatus();
                    UriBuilder urlforssl       = new UriBuilder(web.Url);
                    if (urlforssl.Scheme == Uri.UriSchemeHttps)
                    {
                        if (simiassslstatus == "no")
                        {
                            SelectedString = GetString("BOTHSTRING");
                        }
                        else
                        {
                            SelectedString = GetString("SSLSTRING");
                        }
                    }
                    else
                    {
                        SelectedString = GetString("NONSSLSTRING");
                    }
                    SSLValue.DataSource = SSlOptionsStr;
                    SSLValue.DataBind();
                    SSLValue.SelectedValue = SelectedString;
                    break;
                }
            }
            SSLValue.Enabled = false;
            // SSLOption was server specific, now connect back to master
            ConnectToMaster();
        }