Exemplo n.º 1
0
        protected void OnFileBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                WikiFile wf = (WikiFile)e.Item.DataItem;

                Literal _name    = (Literal)e.Item.FindControl("lt_name");
                Literal _date    = (Literal)e.Item.FindControl("lt_date");
                Button  _delete  = (Button)e.Item.FindControl("bt_delete");
                Literal _version = (Literal)e.Item.FindControl("lt_version");

                _name.Text = "<a href='" + wf.Path + "'>" + wf.Name + "</a>";
                _date.Text = wf.CreateDate.ToShortDateString() + " - " + wf.CreateDate.ToShortTimeString();
                _delete.CommandArgument = wf.Id.ToString();

                if (wf.Versions != null)
                {
                    _version.Text = WikiFile.ToVersionString(wf.Versions);
                }

                if (Member.GetCurrentMember().Id == wf.CreatedBy || Utils.IsInGroup("admin"))
                {
                    _delete.Enabled = true;
                }
            }
        }
        protected void OnFileBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                WikiFile wf = (WikiFile)e.Item.DataItem;

                Literal _name    = (Literal)e.Item.FindControl("lt_name");
                Literal _date    = (Literal)e.Item.FindControl("lt_date");
                Button  _delete  = (Button)e.Item.FindControl("bt_delete");
                Literal _type    = (Literal)e.Item.FindControl("lt_type");
                Literal _version = (Literal)e.Item.FindControl("lt_version");

                Button _archive = (Button)e.Item.FindControl("bt_archive");

                _archive.CommandArgument = wf.Id.ToString();

                if (wf.Archived)
                {
                    _archive.Text        = "Unarchive";
                    _archive.CommandName = "Unarchive";
                }
                else
                {
                    _archive.Text        = "Archive";
                    _archive.CommandName = "Archive";
                }

                if (wf.FileType.Trim().ToLower() == "screenshot")
                {
                    _archive.Visible = false;
                }

                if (wf.Versions != null)
                {
                    _version.Text = WikiFile.ToVersionString(wf.Versions);
                }

                _type.Text = wf.FileType;
                _name.Text = "<a href='" + wf.Path + "'>" + wf.Name + "</a>";
                _date.Text = wf.CreateDate.ToShortDateString() + " - " + wf.CreateDate.ToShortTimeString();
                _delete.CommandArgument = wf.Id.ToString();
            }
        }