예제 #1
0
        /// <summary>
        /// Bind the Data to the Page.
        /// </summary>
        private void BindPropertyData()
        {
            // table
            DataTable propertyTable = new DataTable();

            propertyTable.Columns.Add("Label");
            propertyTable.Columns.Add("Value");

            try
            {
                // ifolder
                iFolderDetails ifolder = web.GetiFolderDetails(ifolderID);

                // rights
                PropertyActions.Visible = (ifolder.MemberRights == Rights.Admin);

                propertyTable.Rows.Add(new object[] { GetString("NAME"), ifolder.Name });
                propertyTable.Rows.Add(new object[] { GetString("DESCRIPTION"), ifolder.Description });
                propertyTable.Rows.Add(new object[] { GetString("LASTMODIFIED"), WebUtility.FormatDate(ifolder.LastModified, rm) });
                propertyTable.Rows.Add(new object[] { GetString("CREATED"), WebUtility.FormatDate(ifolder.Created, rm) });
                propertyTable.Rows.Add(new object[] { GetString("RIGHTS"), WebUtility.FormatRights(ifolder.MemberRights, rm) });
                propertyTable.Rows.Add(new object[] { GetString("OWNER"), ifolder.OwnerFullName });
                propertyTable.Rows.Add(new object[] { GetString("SIZE"), WebUtility.FormatSize(ifolder.Size, rm) });
                propertyTable.Rows.Add(new object[] { GetString("MEMBERS"), ifolder.MemberCount.ToString() });
                propertyTable.Rows.Add(new object[] { GetString("FILES"), ifolder.FileCount.ToString() });
                propertyTable.Rows.Add(new object[] { GetString("FOLDERS"), ifolder.DirectoryCount.ToString() });
                propertyTable.Rows.Add(new object[] { GetString("LOCKED"), WebUtility.FormatYesNo(!ifolder.Enabled, rm) });
            }
            catch (SoapException ex)
            {
                if (!HandleException(ex))
                {
                    throw;
                }
            }

            // data grid
            PropertyData.DataSource = propertyTable;
            PropertyData.DataBind();
        }
예제 #2
0
        /// <summary>
        /// Initializes the iFolder detail web controls.
        /// </summary>
        ///	<returns>The name of the ifolder.</returns>
        private string GetiFolderDetails()
        {
            int exp = 0;

            while (exp < 10)
            {
                try
                {
                    //Resolve the location of iFolder.
                    iFolderLocation = web.GetiFolderLocation(iFolderID);
                    if (iFolderLocation == null || iFolderLocation == String.Empty || iFolderLocation == "")
                    {
                        Thread.Sleep(1000);
                        exp = exp + 1;
                    }
                    else
                    {
                        UriBuilder remoteurl = new UriBuilder(iFolderLocation);
                        remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                        web.Url        = remoteurl.Uri.ToString();
                        break;
                    }
                }
                catch
                {
                    Thread.Sleep(1000);
                    if (exp == 10)
                    {
                        Page.Response.Redirect(String.Format("iFolders.aspx"));
                        return(null);
                    }
                    exp = exp + 1;
                }
            }

            iFolderDetails ifolder = null;

            try
            {
                ifolder = web.GetiFolderDetails(iFolderID);
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("iFolderDoesNotExistException") != -1)
                {
                    Page.Response.Redirect(String.Format("UserDetails.aspx?id={0}&errormsg={1}", UserID, GetString("ERRORIFOLDERDOESNOTEXIST")));
                }
                else
                {
                    web.Url = currentServerURL;
                    TopNav.ShowError(GetString("LOGINCONNECTFAILED"));
                }
                return(null);
            }

            string loggedinuserid = Session["UserID"] as String;

            preference = web.GetUserGroupRights(loggedinuserid, ifolder.OwnerID);
            if (preference == -1)
            {
                preference = 0xffff;
            }


            string ShortenedName   = null;
            int    ShortenedLength = 50;

            if (ifolder.Name.Length > ShortenedLength)
            {
                // make it of desired length
                ShortenedName = web.GetShortenedName(ifolder.Name, ShortenedLength);
            }
            Name.Text = (ifolder.Name.Length > ShortenedLength) ? ShortenedName : ifolder.Name;

            Description.Text  = ifolder.Description;
            Owner.Text        = ifolder.OwnerFullName;
            Owner.NavigateUrl = String.Format("UserDetails.aspx?id={0}", ifolder.OwnerID);
            //Size.Text = Utils.ConvertToUnitString( ifolder.Size, true, rm );
            Directories.Text = ifolder.DirectoryCount.ToString();
            Files.Text       = ifolder.FileCount.ToString();

            string IsOrphaned = web.IsOrphanediFolder(iFolderID);

            if (IsOrphaned.Equals(""))
            {
                Orphan.Text         = GetString("NO");
                AdoptButton.Text    = GetString("ADOPT");
                AdoptButton.Visible = false;
            }
            else
            {
                //it has returned the previous owner id of this orphaned ifolder
                Orphan.Visible      = true;
                Orphan.Text         = GetString("YES");
                AdoptButton.Visible = true;

                string EncryptAlgorithm = ifolder.EncryptionAlgorithm;
                if (!(EncryptAlgorithm == null || (EncryptAlgorithm == String.Empty)))
                {
                    // It is an encrypted ifolder
                    AdoptButton.Enabled = false;
                }
                else
                {
                    AdoptButton.Enabled = true;
                }
            }

            LastModified.Text = (ifolder.LastModified == DateTime.MinValue) ?
                                Utils.ToDateTimeString(DateTime.Now) :
                                Utils.ToDateTimeString(ifolder.LastModified);

            // Allow the browser to break up the path on separator boundries.
            string FullUnManagedPath = ifolder.UnManagedPath.Replace(
                Path.DirectorySeparatorChar.ToString(),
                Path.DirectorySeparatorChar.ToString() + "<WBR>");
            string tmp = FullUnManagedPath;

            if (FullUnManagedPath.Length > 170)
            {
                tmp = web.GetShortenedName(FullUnManagedPath, 170);
            }

            //Adding Server Name
            iFolderServer[] list = web.GetServers();
            string          name = null;

            ServerName.Text = null;
            foreach (iFolderServer server in list)
            {
                if (server.PublicUrl == iFolderLocation)
                {
                    name = server.Name;
                    break;
                }
            }
            if (name != null)
            {
                ServerName.Text = name;
            }

            UnManagedPath.Text = tmp;


//			web.Url = currentServerURL;

            string EncryptionAlgorithm = ifolder.EncryptionAlgorithm;

            if (!(EncryptionAlgorithm == null || (EncryptionAlgorithm == String.Empty)) || !MemberRightsChangeAllowed)
            {
                // It is an encrypted ifolder
                MemberAddButton.Enabled = false;
            }

            return(ifolder.Name);
        }