예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            try { clip = new DbContentClip(_dbContentClipID); }
            catch { return; }

            // adminMode must be set before child controls are created!
            if (_inlineEditEnabled)
            {
                adminView = Page.User.IsInRole(clip.ParentCatalog.EditorRole.Name);
            }

            EnsureChildControls();

            Amns.GreyFox.Web.Handlers.AssemblyResourceHandler.RegisterScript(this.Page, "Base.js");
        }
예제 #2
0
        protected override void OnPreRender(EventArgs e)
        {
            if (isCatalogSelected)
            {
                if (selectedID != -1)
                {
                    DbContentCatalog selectedCatalog = new DbContentCatalog(selectedID);

                    newButton.Enabled  = Page.User.IsInRole(selectedCatalog.EditorRole.Name);
                    editButton.Enabled = Page.User.IsInRole(selectedCatalog.EditorRole.Name);
                }
                else
                {
                    editButton.Enabled = false;
                    viewButton.Enabled = false;
                }
                //				upButton.Enabled = false;
                //				downButton.Enabled = false;
            }
            else
            {
                if (selectedClipID != -1)
                {
                    DbContentClip    clip            = new DbContentClip(selectedClipID);
                    DbContentCatalog selectedCatalog = clip.ParentCatalog;

                    // set edit button based on roles
                    editButton.Enabled = Page.User.IsInRole(clip.ParentCatalog.EditorRole.Name);
                    //upButton.Enabled = editButton.Enabled;
                    //downButton.Enabled = editButton.Enabled;

                    newButton.Enabled = selectedID != -1 &&
                                        (Page.User.IsInRole(selectedCatalog.AuthorRole.Name) |
                                         Page.User.IsInRole(selectedCatalog.EditorRole.Name));
                }
                else
                {
                    editButton.Enabled = false;
                    viewButton.Enabled = false;
                    newButton.Enabled  = false;
                    //upButton.Enabled = false;
                    //downButton.Enabled = false;
                }
            }

            ControlExtender.RegisterTooltipScript(this.Page, 1, "grey", 2, "white");
        }
예제 #3
0
        public DbCommandClip(DbContentClip clip)
        {
            if (clip == null)
            {
                throw(new Exception("DbContentClip cannot be null."));
            }

            _clip = clip;
            _xml  = new XmlDocument();

            try
            {
                _xml.LoadXml(_clip.Body);
            }
            catch
            {
                throw(exceptionConstructor("Could not load XML Command Document from DbContentClip '{0}'."));
            }
        }
예제 #4
0
        private string constructTooltip(DbContentClip clip)
        {
            StringBuilder s = new StringBuilder();

            s.Append("ID: ");
            s.Append(clip.ID);
            s.Append("<BR>");

            s.Append("Published: ");
            s.Append(clip.PublishDate.ToLongDateString());
            s.Append("<BR>");

            s.Append("Expires: ");
            s.Append(clip.ExpirationDate.ToLongDateString());

            if (clip.OverrideUrl != string.Empty)
            {
                s.Append("<BR>");
                s.Append("Override: ");
                s.Append(clip.OverrideUrl);
            }

            return(s.ToString());
        }
예제 #5
0
        protected override void OnPreRender(EventArgs e)
        {
            if (dbContentClipID != 0)
            {
                dbContentClip = new DbContentClip(dbContentClipID);

                #region Bind _system Folder

                //
                // Set Field Entries
                //

                ltCreateDate.Text = dbContentClip.CreateDate.ToString();
                ltModifyDate.Text = dbContentClip.ModifyDate.ToString();

                //
                // Set Children Selections
                //


                #endregion

                #region Bind General Folder

                //
                // Set Field Entries
                //

                ltTitle.Text       = dbContentClip.Title.ToString();
                ltDescription.Text = dbContentClip.Description.ToString();
                ltKeywords.Text    = dbContentClip.Keywords.ToString();
                ltIcon.Text        = dbContentClip.Icon.ToString();

                //
                // Set Children Selections
                //

                // References

                if (dbContentClip.References != null)
                {
                    ltReferences.Text = dbContentClip.References.ToString();
                }
                else
                {
                    ltReferences.Text = string.Empty;
                }

                // ParentCatalog

                if (dbContentClip.ParentCatalog != null)
                {
                    ltParentCatalog.Text = dbContentClip.ParentCatalog.ToString();
                }
                else
                {
                    ltParentCatalog.Text = string.Empty;
                }

                // Rating

                if (dbContentClip.Rating != null)
                {
                    ltRating.Text = dbContentClip.Rating.ToString();
                }
                else
                {
                    ltRating.Text = string.Empty;
                }

                // Status

                if (dbContentClip.Status != null)
                {
                    ltStatus.Text = dbContentClip.Status.ToString();
                }
                else
                {
                    ltStatus.Text = string.Empty;
                }


                #endregion

                #region Bind Body Folder

                //
                // Set Field Entries
                //

                ltBody.Text = dbContentClip.Body.ToString();

                //
                // Set Children Selections
                //


                #endregion

                #region Bind System Folder

                //
                // Set Field Entries
                //

                ltPublishDate.Text      = dbContentClip.PublishDate.ToString();
                ltExpirationDate.Text   = dbContentClip.ExpirationDate.ToString();
                ltArchiveDate.Text      = dbContentClip.ArchiveDate.ToString();
                ltPriority.Text         = dbContentClip.Priority.ToString();
                ltSortOrder.Text        = dbContentClip.SortOrder.ToString();
                ltCommentsEnabled.Text  = dbContentClip.CommentsEnabled.ToString();
                ltNotifyOnComments.Text = dbContentClip.NotifyOnComments.ToString();

                //
                // Set Children Selections
                //


                #endregion

                #region Bind Contributors Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // Authors

                if (dbContentClip.Authors != null)
                {
                    ltAuthors.Text = dbContentClip.Authors.ToString();
                }
                else
                {
                    ltAuthors.Text = string.Empty;
                }

                // Editors

                if (dbContentClip.Editors != null)
                {
                    ltEditors.Text = dbContentClip.Editors.ToString();
                }
                else
                {
                    ltEditors.Text = string.Empty;
                }


                #endregion

                #region Bind Menu Folder

                //
                // Set Field Entries
                //

                ltMenuLabel.Text         = dbContentClip.MenuLabel.ToString();
                ltMenuTooltip.Text       = dbContentClip.MenuTooltip.ToString();
                ltMenuEnabled.Text       = dbContentClip.MenuEnabled.ToString();
                ltMenuOrder.Text         = dbContentClip.MenuOrder.ToString();
                ltMenuLeftIcon.Text      = dbContentClip.MenuLeftIcon.ToString();
                ltMenuLeftIconOver.Text  = dbContentClip.MenuLeftIconOver.ToString();
                ltMenuRightIcon.Text     = dbContentClip.MenuRightIcon.ToString();
                ltMenuRightIconOver.Text = dbContentClip.MenuRightIconOver.ToString();
                ltMenuBreak.Text         = dbContentClip.MenuBreak.ToString();

                //
                // Set Children Selections
                //


                #endregion

                text = "View  - " + dbContentClip.ToString();
            }
        }
예제 #6
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            int i            = 0;
            int catalogDepth = _maxDepth;

            string[] titles = new string[_maxDepth];
            string[] urls   = new string[_maxDepth];

            if (_homeTitle != string.Empty)
            {
                catalogDepth--;
            }

            DbContentClip clip = null;

            try
            {
                clip = new DbContentClip(_clipID);
            }
            catch
            {
                output.Write("<div>Clip unavailable for navigation.</div>");
                return;
            }

            DbContentCatalog catalog = clip.ParentCatalog;

            while (i < catalogDepth && catalog != null && catalog.ID != _catalogID)
            {
                titles[i] = catalog.Title;
                if (catalog.DefaultClip != null)
                {
                    if (catalog.DefaultClip.OverrideUrl != null &&
                        catalog.DefaultClip.OverrideUrl != string.Empty)
                    {
                        urls[i] = Page.ResolveUrl(catalog.DefaultClip.OverrideUrl);
                    }
                    else
                    {
                        urls[i] = Page.ResolveUrl(string.Format(_linkFormat, catalog.DefaultClip.ID));
                    }
                }
                else
                {
                    urls[i] = string.Empty;
                }

                catalog = catalog.ParentCatalog;

                i++;
            }

            i--;

            if (_homeTitle != string.Empty)
            {
                i++;
                titles[i] = _homeTitle;
                if (_homeUrl != string.Empty)
                {
                    urls[i] = Page.ResolveUrl(_homeUrl);
                }
                else
                {
                    urls[i] = Page.ResolveUrl("~/");
                }
            }

            while (i != -1)
            {
                output.WriteBeginTag("a");
                output.WriteAttribute("href", urls[i]);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(titles[i]);
                output.WriteEndTag("a");
                if (i != 0)
                {
                    output.Write(" > ");
                }
                i--;
            }

            if (_includeClip)
            {
                output.Write(" > ");
                output.Write(clip.Title);
            }
        }
예제 #7
0
        protected override void itemCommand(object sender, ToolBarItemEventArgs e)
        {
            base.itemCommand(sender, e);

            switch (e.Item.Value)
            {
            case "Up":
                if (IsCatalogSelected)
                {
                    DbContentCatalogManager.PeerMove(new DbContentCatalog(this.SelectedID), -1, true, false);
                }
                else
                {
                    DbContentClipManager.PeerMove(new DbContentClip(this.SelectedClipID), -1, true, false);
                }
                break;

            case "Down":
                if (IsCatalogSelected)
                {
                    DbContentCatalogManager.PeerMove(new DbContentCatalog(this.SelectedID), -1, true, false);
                }
                else
                {
                    DbContentClipManager.PeerMove(new DbContentClip(this.SelectedClipID), 1, true, false);
                }
                break;

            case "Copy":
                if (isCatalogSelected)
                {
                    copyCatalogID = selectedID;
                    copyClipID    = -1;
                }
                else
                {
                    copyCatalogID = -1;
                    copyClipID    = selectedClipID;
                }
                break;

            case "Paste":
                if (copyCatalogID != -1)
                {
                    DbContentCatalog srcCatalog;
                    DbContentCatalog destCatalog;

                    srcCatalog = new DbContentCatalog(copyCatalogID);

                    if (isCatalogSelected)
                    {
                        destCatalog = DbContentCatalog.NewPlaceHolder(selectedID);
                    }
                    else
                    {
                        destCatalog = new DbContentClip(selectedClipID).ParentCatalog;
                    }

                    pasteCatalog(srcCatalog, destCatalog, false, false);
                }
                else if (copyClipID != -1)
                {
                    DbContentClip copyClip = new DbContentClip(selectedClipID);
                    DbContentClip newClip  = new DbContentClip();
                    newClip.ArchiveDate       = copyClip.ArchiveDate;
                    newClip.Authors           = copyClip.Authors;
                    newClip.Body              = copyClip.Body;
                    newClip.CommentsEnabled   = copyClip.CommentsEnabled;
                    newClip.CreateDate        = DateTime.Now;
                    newClip.Description       = copyClip.Description;
                    newClip.Editors           = copyClip.Editors;
                    newClip.ExpirationDate    = copyClip.ExpirationDate;
                    newClip.Icon              = copyClip.Icon;
                    newClip.Keywords          = copyClip.Keywords;
                    newClip.MenuBreak         = copyClip.MenuBreak;
                    newClip.MenuEnabled       = copyClip.MenuEnabled;
                    newClip.MenuLabel         = copyClip.MenuLabel;
                    newClip.MenuLeftIcon      = copyClip.MenuLeftIcon;
                    newClip.MenuLeftIconOver  = copyClip.MenuLeftIconOver;
                    newClip.MenuRightIcon     = copyClip.MenuRightIcon;
                    newClip.MenuRightIconOver = copyClip.MenuRightIconOver;
                    newClip.MenuTooltip       = copyClip.MenuTooltip;
                    newClip.ModifyDate        = DateTime.Now;
                    newClip.NotifyOnComments  = copyClip.NotifyOnComments;
                    newClip.OverrideUrl       = copyClip.OverrideUrl;
                    if (isCatalogSelected)
                    {
                        newClip.ParentCatalog = DbContentCatalog.NewPlaceHolder(selectedID);
                    }
                    else
                    {
                        newClip.ParentCatalog = new DbContentClip(selectedClipID).ParentCatalog;
                    }
                    newClip.Priority     = copyClip.Priority;
                    newClip.PublishDate  = copyClip.PublishDate;
                    newClip.Rating       = copyClip.Rating;
                    newClip.References   = copyClip.References;
                    newClip.SortOrder    = copyClip.SortOrder;
                    newClip.Status       = copyClip.Status;
                    newClip.Title        = copyClip.Title;
                    newClip.WorkingDraft = copyClip.WorkingDraft;
                    newClip.Save();
                }
                break;

            case "rPaste":
                if (copyCatalogID != -1)
                {
                    DbContentCatalog srcCatalog;
                    DbContentCatalog destCatalog;

                    srcCatalog = new DbContentCatalog(copyCatalogID);

                    if (isCatalogSelected)
                    {
                        destCatalog = DbContentCatalog.NewPlaceHolder(selectedID);
                    }
                    else
                    {
                        destCatalog = new DbContentClip(selectedClipID).ParentCatalog;
                    }

                    pasteCatalog(srcCatalog, destCatalog, true, true);
                }
                break;
            }
        }
예제 #8
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (dbContentClipID > 0)
                {
                    obj  = new DbContentClip(dbContentClipID);
                    text = "Edit  - " + obj.ToString();
                }
                else if (dbContentClipID <= 0)
                {
                    obj  = new DbContentClip();
                    text = "Add ";
                }

                //
                // Set Field Entries
                //
                ltCreateDate.Text          = obj.CreateDate.ToString();
                ltModifyDate.Text          = obj.ModifyDate.ToString();
                tbTitle.Text               = obj.Title;
                tbDescription.Text         = obj.Description;
                tbKeywords.Text            = obj.Keywords;
                tbIcon.Text                = obj.Icon;
                ftbBody.Text               = obj.Body;
                dePublishDate.Date         = obj.PublishDate;
                deExpirationDate.Date      = obj.ExpirationDate;
                deArchiveDate.Date         = obj.ArchiveDate;
                tbPriority.Text            = obj.Priority.ToString();
                tbSortOrder.Text           = obj.SortOrder.ToString();
                cbCommentsEnabled.Checked  = obj.CommentsEnabled;
                cbNotifyOnComments.Checked = obj.NotifyOnComments;
                tbOverrideUrl.Text         = obj.OverrideUrl;
                tbMenuLabel.Text           = obj.MenuLabel;
                tbMenuTooltip.Text         = obj.MenuTooltip;
                cbMenuEnabled.Checked      = obj.MenuEnabled;
                tbMenuOrder.Text           = obj.MenuOrder.ToString();
                tbMenuLeftIcon.Text        = obj.MenuLeftIcon;
                tbMenuLeftIconOver.Text    = obj.MenuLeftIconOver;
                tbMenuRightIcon.Text       = obj.MenuRightIcon;
                tbMenuRightIconOver.Text   = obj.MenuRightIconOver;
                cbMenuBreak.Checked        = obj.MenuBreak;

                //
                // Set Children Selections
                //
                if (obj.Status != null)
                {
                    foreach (ListItem item in msStatus.Items)
                    {
                        item.Selected = obj.Status.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msStatus.SelectedIndex = 0;
                }

                if (obj.ParentCatalog != null)
                {
                    foreach (ListItem item in msParentCatalog.Items)
                    {
                        item.Selected = obj.ParentCatalog.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msParentCatalog.SelectedIndex = 0;
                }

                if (obj.Rating != null)
                {
                    foreach (ListItem item in msRating.Items)
                    {
                        item.Selected = obj.Rating.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msRating.SelectedIndex = 0;
                }

                foreach (ListItem i in msReferences.Items)
                {
                    foreach (DbContentClip dbContentClip in obj.References)
                    {
                        if (i.Value == dbContentClip.ID.ToString())
                        {
                            i.Selected = true;
                            break;
                        }
                    }
                }
                foreach (ListItem i in msAuthors.Items)
                {
                    foreach (GreyFoxUser greyFoxUser in obj.Authors)
                    {
                        if (i.Value == greyFoxUser.ID.ToString())
                        {
                            i.Selected = true;
                            break;
                        }
                    }
                }
                foreach (ListItem i in msEditors.Items)
                {
                    foreach (GreyFoxUser greyFoxUser in obj.Editors)
                    {
                        if (i.Value == greyFoxUser.ID.ToString())
                        {
                            i.Selected = true;
                            break;
                        }
                    }
                }
            }
        }
예제 #9
0
 public SnapReferences(string linkFormat, DbContentClip clip)
 {
     this.linkFormat = linkFormat;
     this.clip       = clip;
 }
예제 #10
0
 public AluminumConstructor(DbContentClip clip)
 {
     this._clip = clip;
 }
예제 #11
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dbContentClipID == 0)
            {
                obj = new DbContentClip();
            }
            else
            {
                obj = new DbContentClip(dbContentClipID);
            }

            obj.Title             = tbTitle.Text;
            obj.Description       = tbDescription.Text;
            obj.Keywords          = tbKeywords.Text;
            obj.Icon              = tbIcon.Text;
            obj.Body              = ftbBody.Text;
            obj.PublishDate       = dePublishDate.Date;
            obj.ExpirationDate    = deExpirationDate.Date;
            obj.ArchiveDate       = deArchiveDate.Date;
            obj.Priority          = int.Parse(tbPriority.Text);
            obj.SortOrder         = int.Parse(tbSortOrder.Text);
            obj.CommentsEnabled   = cbCommentsEnabled.Checked;
            obj.NotifyOnComments  = cbNotifyOnComments.Checked;
            obj.OverrideUrl       = tbOverrideUrl.Text;
            obj.MenuLabel         = tbMenuLabel.Text;
            obj.MenuTooltip       = tbMenuTooltip.Text;
            obj.MenuEnabled       = cbMenuEnabled.Checked;
            obj.MenuOrder         = int.Parse(tbMenuOrder.Text);
            obj.MenuLeftIcon      = tbMenuLeftIcon.Text;
            obj.MenuLeftIconOver  = tbMenuLeftIconOver.Text;
            obj.MenuRightIcon     = tbMenuRightIcon.Text;
            obj.MenuRightIconOver = tbMenuRightIconOver.Text;
            obj.MenuBreak         = cbMenuBreak.Checked;

            if (msStatus.SelectedItem != null && msStatus.SelectedItem.Value != "Null")
            {
                obj.Status = DbContentStatus.NewPlaceHolder(
                    int.Parse(msStatus.SelectedItem.Value));
            }
            else
            {
                obj.Status = null;
            }

            if (msParentCatalog.SelectedItem != null && msParentCatalog.SelectedItem.Value != "Null")
            {
                obj.ParentCatalog = DbContentCatalog.NewPlaceHolder(
                    int.Parse(msParentCatalog.SelectedItem.Value));
            }
            else
            {
                obj.ParentCatalog = null;
            }

            if (msRating.SelectedItem != null && msRating.SelectedItem.Value != "Null")
            {
                obj.Rating = DbContentRating.NewPlaceHolder(
                    int.Parse(msRating.SelectedItem.Value));
            }
            else
            {
                obj.Rating = null;
            }

            if (msReferences.IsChanged)
            {
                obj.References = new DbContentClipCollection();
                foreach (ListItem i in msReferences.Items)
                {
                    if (i.Selected)
                    {
                        obj.References.Add(DbContentClip.NewPlaceHolder(int.Parse(i.Value)));
                    }
                }
            }

            if (msAuthors.IsChanged)
            {
                obj.Authors = new GreyFoxUserCollection();
                foreach (ListItem i in msAuthors.Items)
                {
                    if (i.Selected)
                    {
                        obj.Authors.Add(GreyFoxUser.NewPlaceHolder(int.Parse(i.Value)));
                    }
                }
            }

            if (msEditors.IsChanged)
            {
                obj.Editors = new GreyFoxUserCollection();
                foreach (ListItem i in msEditors.Items)
                {
                    if (i.Selected)
                    {
                        obj.Editors.Add(GreyFoxUser.NewPlaceHolder(int.Parse(i.Value)));
                    }
                }
            }

            if (editOnAdd)
            {
                dbContentClipID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbTitle.Text                  = string.Empty;
                tbDescription.Text            = string.Empty;
                tbKeywords.Text               = string.Empty;
                tbIcon.Text                   = string.Empty;
                ftbBody.Text                  = string.Empty;
                dePublishDate.Date            = DateTime.Now;
                deExpirationDate.Date         = DateTime.Now;
                deArchiveDate.Date            = DateTime.Now;
                tbPriority.Text               = string.Empty;
                tbSortOrder.Text              = string.Empty;
                cbCommentsEnabled.Checked     = false;
                cbNotifyOnComments.Checked    = false;
                tbOverrideUrl.Text            = string.Empty;
                tbMenuLabel.Text              = string.Empty;
                tbMenuTooltip.Text            = string.Empty;
                cbMenuEnabled.Checked         = false;
                tbMenuOrder.Text              = string.Empty;
                tbMenuLeftIcon.Text           = string.Empty;
                tbMenuLeftIconOver.Text       = string.Empty;
                tbMenuRightIcon.Text          = string.Empty;
                tbMenuRightIconOver.Text      = string.Empty;
                cbMenuBreak.Checked           = false;
                msStatus.SelectedIndex        = 0;
                msParentCatalog.SelectedIndex = 0;
                msRating.SelectedIndex        = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
예제 #12
0
 public ContentBuilder(DbContentClip clip)
 {
     __clip = clip;
 }
예제 #13
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dbContentHitID == 0)
            {
                obj = new DbContentHit();
            }
            else
            {
                obj = new DbContentHit(dbContentHitID);
            }

            obj.UserAgent       = tbUserAgent.Text;
            obj.UserHostAddress = tbUserHostAddress.Text;
            obj.UserHostName    = tbUserHostName.Text;
            obj.RequestDate     = DateTime.Parse(tbRequestDate.Text);
            obj.RequestReferrer = tbRequestReferrer.Text;
            obj.IsUnique        = cbIsUnique.Checked;

            if (msUser.SelectedItem != null && msUser.SelectedItem.Value != "Null")
            {
                obj.User = GreyFoxUser.NewPlaceHolder(
                    int.Parse(msUser.SelectedItem.Value));
            }
            else
            {
                obj.User = null;
            }

            if (msRequestContent.SelectedItem != null && msRequestContent.SelectedItem.Value != "Null")
            {
                obj.RequestContent = DbContentClip.NewPlaceHolder(
                    int.Parse(msRequestContent.SelectedItem.Value));
            }
            else
            {
                obj.RequestContent = null;
            }

            if (editOnAdd)
            {
                dbContentHitID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbUserAgent.Text               = string.Empty;
                tbUserHostAddress.Text         = string.Empty;
                tbUserHostName.Text            = string.Empty;
                tbRequestDate.Text             = DateTime.Now.ToString();
                tbRequestReferrer.Text         = string.Empty;
                cbIsUnique.Checked             = false;
                msUser.SelectedIndex           = 0;
                msRequestContent.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
예제 #14
0
        protected override void OnPreRender(EventArgs e)
        {
            //ratingComboBox.Enabled = Page.User.IsInRole("Tessen/Rater");

            if (dbContentClipID != 0 & loadFlag)
            {
                editDbContentClip = new DbContentClip(dbContentClipID);

                //
                // Set Field Entries
                //
                ltCreateDate.Text               = editDbContentClip.CreateDate.ToString();
                ltModifyDate.Text               = editDbContentClip.ModifyDate.ToString();
                tbTitle.Text                    = editDbContentClip.Title;
                tbDescription.Text              = editDbContentClip.Description;
                tbKeywords.Text                 = editDbContentClip.Keywords;
                tbOverrideUrl.Text              = editDbContentClip.OverrideUrl;
                tbIcon.Text                     = editDbContentClip.Icon;
                tbBody.Text                     = editDbContentClip.Body;
                calPublishDateP.SelectedDate    = editDbContentClip.PublishDate;
                calExpirationDateP.SelectedDate = editDbContentClip.ExpirationDate;
                calArchiveDateP.SelectedDate    = editDbContentClip.ArchiveDate;
                tbPriority.Text                 = editDbContentClip.Priority.ToString();
                tbSortOrder.Text                = editDbContentClip.SortOrder.ToString();
                cbCommentsEnabled.Checked       = editDbContentClip.CommentsEnabled;
                cbNotifyOnComments.Checked      = editDbContentClip.NotifyOnComments;
                tbMenuLabel.Text                = editDbContentClip.MenuLabel;
                tbMenuTooltip.Text              = editDbContentClip.MenuTooltip;
                cbMenuEnabled.Checked           = editDbContentClip.MenuEnabled;
                tbMenuOrder.Text                = editDbContentClip.MenuOrder.ToString();
                tbMenuLeftIcon.Text             = editDbContentClip.MenuLeftIcon;
                tbMenuLeftIconOver.Text         = editDbContentClip.MenuLeftIconOver;
                tbMenuRightIcon.Text            = editDbContentClip.MenuRightIcon;
                tbMenuRightIconOver.Text        = editDbContentClip.MenuRightIconOver;
                cbMenuBreak.Checked             = editDbContentClip.MenuBreak;

                //
                // Set Children Selections
                //
                tbReferences.Text = editDbContentClip.References.ToTitleString();

                if (editDbContentClip.ParentCatalog != null)
                {
                    foreach (ListItem item in msParentCatalog.Items)
                    {
                        item.Selected = editDbContentClip.ParentCatalog.ID.ToString() == item.Value;
                    }
                }

                if (editDbContentClip.Rating != null)
                {
                    foreach (ComboBoxItem item in ratingComboBox.Items)
                    {
                        item.Selected = editDbContentClip.Rating.ID.ToString() == item.Value;
                    }
                }

                if (editDbContentClip.Status != null)
                {
                    foreach (ListItem item in msStatus.Items)
                    {
                        item.Selected = editDbContentClip.Status.ID.ToString() == item.Value;
                    }
                }

                tbAuthors.Text = editDbContentClip.Authors.ToEncodedString(",", ",");
                tbEditors.Text = editDbContentClip.Editors.ToEncodedString(",", ",");

                tabstrip.SelectedTab = tabstrip.Tabs[0];

                headerText.Text = "Edit - " +
                                  Regex.Replace(editDbContentClip.Title, "<[^>]*>", "");
            }
            else
            {
                this.initializeDefaults();
                headerText.Text = "Edit - New Clip";
            }
        }
예제 #15
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dbContentClipID == 0)
            {
                editDbContentClip = new DbContentClip();
            }
            else
            {
                editDbContentClip = new DbContentClip(dbContentClipID);
            }

            editDbContentClip.Title             = tbTitle.Text;
            editDbContentClip.Description       = tbDescription.Text;
            editDbContentClip.Keywords          = tbKeywords.Text;
            editDbContentClip.OverrideUrl       = tbOverrideUrl.Text;
            editDbContentClip.Icon              = tbIcon.Text;
            editDbContentClip.Body              = tbBody.Text;
            editDbContentClip.PublishDate       = calPublishDateP.SelectedDate;
            editDbContentClip.ExpirationDate    = calExpirationDateP.SelectedDate;
            editDbContentClip.ArchiveDate       = calArchiveDateP.SelectedDate;
            editDbContentClip.Priority          = int.Parse(tbPriority.Text);
            editDbContentClip.SortOrder         = int.Parse(tbSortOrder.Text);
            editDbContentClip.CommentsEnabled   = cbCommentsEnabled.Checked;
            editDbContentClip.NotifyOnComments  = cbNotifyOnComments.Checked;
            editDbContentClip.MenuLabel         = tbMenuLabel.Text;
            editDbContentClip.MenuTooltip       = tbMenuTooltip.Text;
            editDbContentClip.MenuEnabled       = cbMenuEnabled.Checked;
            editDbContentClip.MenuOrder         = int.Parse(tbMenuOrder.Text);
            editDbContentClip.MenuLeftIcon      = tbMenuLeftIcon.Text;
            editDbContentClip.MenuLeftIconOver  = tbMenuLeftIconOver.Text;
            editDbContentClip.MenuRightIcon     = tbMenuRightIcon.Text;
            editDbContentClip.MenuRightIconOver = tbMenuRightIconOver.Text;
            editDbContentClip.MenuBreak         = cbMenuBreak.Checked;

            DbContentClipManager clipManager = new DbContentClipManager();

            editDbContentClip.References = clipManager.EncodeClips(tbReferences.Text);

            if (msParentCatalog.SelectedItem != null)
            {
                editDbContentClip.ParentCatalog = DbContentCatalog.NewPlaceHolder(
                    int.Parse(msParentCatalog.SelectedItem.Value));
            }
            else
            {
                editDbContentClip.ParentCatalog = null;
            }

            if (ratingComboBox.SelectedItem != null)
            {
                editDbContentClip.Rating = DbContentRating.NewPlaceHolder(
                    int.Parse(ratingComboBox.SelectedItem.Value));
            }
            else
            {
                editDbContentClip.Rating = null;
            }

            if (msStatus.SelectedItem != null)
            {
                editDbContentClip.Status = DbContentStatus.NewPlaceHolder(
                    int.Parse(msStatus.SelectedItem.Value));
            }
            else
            {
                editDbContentClip.Status = null;
            }


            GreyFoxUserManager userManager = new GreyFoxUserManager();

            editDbContentClip.Authors = userManager.DecodeString(tbAuthors.Text, ",");
            editDbContentClip.Editors = userManager.DecodeString(tbEditors.Text, ",");

            if (editOnAdd)
            {
                dbContentClipID = editDbContentClip.Save();
            }
            else
            {
                editDbContentClip.Save();
            }

            if (resetOnAdd)
            {
                tbTitle.Text                    = string.Empty;
                tbDescription.Text              = string.Empty;
                tbKeywords.Text                 = string.Empty;
                tbOverrideUrl.Text              = string.Empty;
                tbIcon.Text                     = string.Empty;
                tbBody.Text                     = string.Empty;
                calPublishDateP.SelectedDate    = DateTime.Now;
                calExpirationDateP.SelectedDate = DateTime.Now;
                calArchiveDateP.SelectedDate    = DateTime.Now;
                tbPriority.Text                 = string.Empty;
                tbSortOrder.Text                = string.Empty;
                cbCommentsEnabled.Checked       = false;
                cbNotifyOnComments.Checked      = false;
                tbMenuLabel.Text                = string.Empty;
                tbMenuTooltip.Text              = string.Empty;
                cbMenuEnabled.Checked           = false;
                tbMenuOrder.Text                = string.Empty;
                tbMenuLeftIcon.Text             = string.Empty;
                tbMenuLeftIconOver.Text         = string.Empty;
                tbMenuRightIcon.Text            = string.Empty;
                tbMenuRightIconOver.Text        = string.Empty;
                cbMenuBreak.Checked             = false;
                tbReferences.Text               = string.Empty;
                msParentCatalog.SelectedIndex   = 0;
                ratingComboBox.SelectedIndex    = 0;
                msStatus.SelectedIndex          = 0;
            }

            // Clear Caches
            Amns.GreyFox.Content.Caching.SiteMapCacheControl.ClearSiteMaps();
            Amns.GreyFox.Content.Caching.MenuCacheControl.ClearMenus();

            OnUpdated(EventArgs.Empty);
        }
예제 #16
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void RenderContent(HtmlTextWriter output)
        {
            //
            // Render Records
            //
            foreach (DbContentClip dbContentClip in clips)
            {
                if (!dbContentClip.PublishCheck(this.minPublishDate, this.maxPublishDate))
                {
                    continue;
                }

//				if(dbContentClip.ID == selectedID) rowCssClass = selectedRowCssClass;
//				else if(rowflag) rowCssClass = defaultRowCssClass;
//				else rowCssClass = alternateRowCssClass;
//				rowflag = !rowflag;

                if (titles)
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteLine();
                    output.Indent++;

                    if (bulletIcon != string.Empty || leftIcons)
                    {
                        output.WriteBeginTag("td");
                        output.WriteAttribute("valign", "top");
                        output.WriteAttribute("class", SubHeaderCssClass);
                        if (descriptions)
                        {
                            output.WriteAttribute("rowspan", "2");
                        }
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.WriteLine();
                        output.Indent++;
                        output.WriteBeginTag("img");
                        output.WriteAttribute("src", bulletIcon);
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.WriteLine();
                        output.Indent--;
                        output.WriteEndTag("td");
                        output.WriteLine();
                    }

                    output.WriteBeginTag("td");
                    output.WriteAttribute("valign", "top");
                    output.WriteAttribute("class", SubHeaderCssClass);
                    output.WriteAttribute("width", "100%");
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.WriteLine();
                    output.Indent++;

                    int refNum = -1;

                    if (linkFormat != string.Empty & dbContentClip.Body != string.Empty)
                    {
                        if (dbContentClip.Body.StartsWith("<?xml"))
                        {
                            Extensions.DbCommandClip c       = new Extensions.DbCommandClip(dbContentClip);
                            DbContentClip            forward = c.ForwardReference;
                            if (forward != null)
                            {
                                refNum = forward.ID;
                            }
                        }
                        else
                        {
                            refNum = dbContentClip.ID;
                        }
                    }

                    if (dbContentClip.OverrideUrl != string.Empty)
                    {
                        output.WriteBeginTag("a");
                        output.WriteAttribute("href", Page.ResolveUrl(dbContentClip.OverrideUrl));
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write(dbContentClip.Title);
                        output.WriteEndTag("a");
                    }
                    else if (refNum != -1)
                    {
                        output.WriteBeginTag("a");
                        output.WriteAttribute("href", Page.ResolveUrl(string.Format(linkFormat, refNum)));
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write(dbContentClip.Title);
                        output.WriteEndTag("a");
                    }
                    else
                    {
                        output.Write(dbContentClip.Title);
                    }

                    if (dateStyle == DbContentClientGridDateStyle.TitleBottom)
                    {
//						output.WriteFullBeginTag("tr");
//						output.WriteFullBeginTag("td");
                        output.Write("<br>");
                        output.Write(dbContentClip.PublishDate.ToString(dateFormat));
//						output.WriteEndTag("td");
//						output.WriteEndTag("tr");
                    }

                    output.WriteLine();
                    output.Indent--;
                    output.WriteEndTag("td");
                    output.WriteLine();

                    if (dateStyle == DbContentClientGridDateStyle.TitleRight)
                    {
                        output.WriteBeginTag("td");
                        output.WriteAttribute("valign", "top");
                        output.WriteAttribute("align", "right");
                        output.WriteAttribute("nowrap", "true");
                        if (SubHeaderCssClass != string.Empty)
                        {
                            output.WriteAttribute("class", SubHeaderCssClass);
                        }
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.WriteLine();
                        output.Indent++;
                        output.Write(dbContentClip.PublishDate.ToString(dateFormat));
                        output.WriteLine();
                        output.Indent--;
                        output.WriteEndTag("td");
                    }
                    output.WriteLine();

                    output.Indent--;
                    output.WriteEndTag("tr");
                    output.WriteLine();
                }

                if (descriptions)
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteLine();
                    output.Indent++;

//					if(bulletIcon != string.Empty || leftIcons)
//					{
//						output.WriteFullBeginTag("td");
//						output.Write("&nbsp;");
//						output.WriteEndTag("td");
//                        output.WriteLine();
//					}

                    output.WriteBeginTag("td");
                    output.WriteAttribute("valign", "top");
//					output.WriteAttribute("class", rowCssClass);
                    if (columnCount != 1)
                    {
                        output.WriteAttribute("colspan", columnCount.ToString());
                    }
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.WriteLine();
                    output.Indent++;
                    output.Write(dbContentClip.Description);
                    if (dateStyle == DbContentClientGridDateStyle.DescriptionUnder)
                    {
                        output.WriteBeginTag("div");
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write(dbContentClip.PublishDate.ToString(dateFormat));
                        output.WriteEndTag("div");
                    }
                    else if (dateStyle == DbContentClientGridDateStyle.DescriptionEnd)
                    {
                        output.Write(dbContentClip.PublishDate.ToString(dateFormat));
                    }
                    output.WriteLine();
                    output.Indent--;
                    output.WriteEndTag("td");
                    output.WriteLine();

                    output.Indent--;
                    output.WriteEndTag("tr");
                    output.WriteLine();
                }

                if (bodies)
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteLine();
                    output.Indent++;

                    if (bulletIcon != string.Empty || leftIcons)
                    {
                        output.WriteFullBeginTag("td");
                        output.Write("&nbsp;");
                        output.WriteEndTag("td");
                        output.WriteLine();
                    }

                    output.WriteBeginTag("td");
                    output.WriteAttribute("valign", "top");
//					output.WriteAttribute("class", rowCssClass);
                    if (columnCount != 1)
                    {
                        output.WriteAttribute("colspan", columnCount.ToString());
                    }
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.WriteLine();
                    output.Indent++;
                    output.Write(dbContentClip.Body);
                    output.WriteLine();
                    output.Indent--;
                    output.WriteEndTag("td");
                    output.WriteLine();

                    output.Indent--;
                    output.WriteEndTag("tr");
                    output.WriteLine();
                }
            }
        }