Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the ContentDataItemDecorator class with data item object and data context.
 /// </summary>
 /// <param name="model">The ContentDataitem object.</param>
 /// <param name="context">The data context.</param>
 public ContentDataItemDecorator(ContentDataItem model, IDataContext context)
 {
     Model = model;
     model.CopyTo(this, "ContentList", "Tags", "Attachments");
     Context     = context;
     this.Parent = new ContentListDecorator(context, model.Parent);
 }
Exemple #2
0
        public ContentDataItemDecorator ReshareTo(ContentList to = null, string annotation = "")
        {
            if (this.Parent.AllowResharing)
            {
                var list = to == null ? this.Parent : to;
                if (to != null)
                {
                    if (!to.BaseType.Equals(this.Parent.BaseType))
                    {
                        throw new Exception("The data item only allow share between same type list.");
                    }
                }

                var reshareItem = new ContentDataItem();
                Model.CopyTo(reshareItem, "ID", "RefID", "ShareID", "ParentItemID", "ParentID", "TotalAttachments", "TotalVotes", "ContentList", "Attachments");
                reshareItem.ID         = Guid.NewGuid();
                reshareItem.ShareID    = this.ID;
                reshareItem.Modified   = DateTime.Now;
                reshareItem.Modifier   = list.Owner;
                reshareItem.Annotation = annotation;

                //reshareItem.Published = DateTime.Now;
                //reshareItem.Created = DateTime.Now;

                reshareItem.Ratings          = 0;
                reshareItem.Reads            = 0;
                reshareItem.IsCurrentVersion = true;
                reshareItem.ModerateState    = (int)ModerateStates.Approved;
                reshareItem.ParentID         = list.ID;
                reshareItem.Parent           = list;

                reshareItem.Path = reshareItem.ID.ToString();

                //reshareItem.Owner = list.Owner;

                Context.Add(reshareItem);
                Context.SaveChanges();
                return(new ContentDataItemDecorator(reshareItem, Context));
            }

            throw new ResharingNotAllowException();
        }
Exemple #3
0
 /// <summary>
 /// Render the tags element for specified data item.
 /// </summary>
 /// <param name="helper">The html helper object.</param>
 /// <param name="dataItem">The data item instance.</param>
 /// <returns></returns>
 public static HelperResult Tags(this HtmlHelper helper, ContentDataItem dataItem)
 {
     return new HelperResult((w) =>
     {
         using (var writer = new Html32TextWriter(w))
         {
             if (!string.IsNullOrEmpty(dataItem.Tags))
             {
                 writer.WriteBeginTag("input");
                 writer.WriteAttribute("data-role", "tags");
                 writer.WriteAttribute("readonly", "readonly");
                 writer.WriteAttribute("value", dataItem.Tags);
                 writer.Write(Html32TextWriter.SelfClosingTagEnd);
             }
         }
     });
 }
Exemple #4
0
        protected override string BuildPackage()
        {
            var commands = new List <ICommand>();

            foreach (var item in Items)
            {
                var syncItem = ItemSynchronization.BuildSyncItem(item);

                var contentDataItem = new ContentDataItem(string.Empty, item.Paths.ParentPath, item.Name, syncItem);

                var command = new AddItemCommand(contentDataItem);

                commands.Add(command);
            }

            var rootPath = FileUtil.MapPath("/");

            foreach (var fileName in Files)
            {
                if (FileUtil.IsFolder(fileName))
                {
                    foreach (var file in Directory.GetFiles(FileUtil.MapPath(fileName), "*", SearchOption.AllDirectories))
                    {
                        var fileInfo = new FileInfo(file);
                        if ((fileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                        {
                            continue;
                        }

                        if ((fileInfo.Attributes & FileAttributes.System) == FileAttributes.System)
                        {
                            continue;
                        }

                        var fileItem = new FileSystemDataItem(rootPath, Path.GetDirectoryName(file), Path.GetFileName(file));
                        var command  = new AddFileCommand(fileItem);
                        commands.Add(command);
                    }
                }
                else
                {
                    var fileItem = new FileSystemDataItem(rootPath, Path.GetDirectoryName(fileName), Path.GetFileName(fileName));
                    var command  = new AddFileCommand(fileItem);
                    commands.Add(command);
                }
            }

            var diff = new DiffInfo(commands)
            {
                Author    = Author,
                PostStep  = PostStep,
                Publisher = Publisher,
                Readme    = Readme,
                Version   = Version,
                Title     = PackageName
            };

            var directoryName = Path.GetDirectoryName(FileName) ?? string.Empty;

            directoryName = directoryName.Replace("\\", "/");
            var folderPath = FileUtil.MapPath(directoryName);

            diff.Serialize(folderPath);

            var packageFileName = FileUtil.UnmapPath(folderPath, false) + "/" + DiffInfo.OutputFileName;

            PackageGenerator.GeneratePackage(diff, packageFileName);

            return(packageFileName);
        }
        private static void RenderChildren(Html32TextWriter writer, ContentListDecorator list, IEnumerable<ContentDataItem> items, ContentDataItem current)
        {
            var app = App.Get();
            var fieldName = list.GetDefaultTitleField().Name;
            var Url = DNA.Utility.UrlUtility.CreateUrlHelper();
            foreach (var item in items)
            {
                var itemWrapper = app.Wrap(item);
                writer.WriteBeginTag("li");
                var _class = "d-node";
                var children = itemWrapper.Children();
                var childrenCount = children.Count();
                if (childrenCount > 0)
                    _class += " d-node-hasChildren";

                //writer.WriteAttribute("class", "d-node d-node-hasChildren");

                var isInPath = false;
                if (current != null && !string.IsNullOrEmpty(current.Path) && !string.IsNullOrEmpty(item.Path) && current.Path.StartsWith(item.Path))
                {
                    isInPath = true;
                    if (childrenCount > 0)
                        writer.WriteAttribute("data-expanded", "true");

                }
                writer.WriteAttribute("data-id", itemWrapper.ID.ToString());

                if (current != null && itemWrapper.ID.Equals(current.ID))
                    writer.WriteAttribute("data-selected", "true");

                if (itemWrapper.ParentItemID != Guid.Empty)
                    writer.WriteAttribute("data-parentid", itemWrapper.ParentItemID.ToString());

                if (childrenCount > 0)
                {
                    if (!isInPath)
                    {
                        var urlformat = "~/api/contents/items?name={0}&slug={1}&parentId={2}";
                        var popupUrl = Url.Content(string.Format(urlformat, list.Name, list.Views.Default.Name, itemWrapper.ID.ToString()));
                        writer.WriteAttribute("data-popupurl", popupUrl);
                    }
                }
                writer.WriteAttribute("class", _class);
                writer.Write(Html32TextWriter.TagRightChar);

                writer.WriteBeginTag("a");
                writer.WriteAttribute("href", itemWrapper.UrlComponent);
                writer.Write(Html32TextWriter.TagRightChar);
                writer.Write(itemWrapper.Value(fieldName).Raw);
                writer.WriteEndTag("a");

                if (childrenCount > 0)
                {
                    if (isInPath)
                    {
                        writer.WriteFullBeginTag("ul");
                        RenderChildren(writer, list, children, current);
                        writer.WriteEndTag("ul");
                    }
                }

                writer.WriteEndTag("li");
            }
        }
Exemple #6
0
        /// <summary>
        /// Convert the content data item to dynamic object.
        /// </summary>
        /// <returns>An expando object defined in open activity object standard.</returns>
        public dynamic ToObject()
        {
            dynamic activity = new ExpandoObject();
            var     vals     = this.Values;
            var     Url      = DNA.Utility.UrlUtility.CreateUrlHelper();
            var     request  = HttpContext.Current.Request;
            string  baseUrl  = request.Url.Scheme + "://" + request.Url.Authority;

            dynamic actor = new ExpandoObject();

            #region base properties
            actor.id          = this.Modifier;
            actor.url         = baseUrl + "/profiles/" + this.Modifier;
            actor.displayName = this.Modifier;

            activity.id        = this.ID;
            activity.parentId  = this.ParentItemID;
            activity.published = this.Published;
            activity.updated   = this.Modified;
            activity.version   = this.Version;
            //activity.tags = this.Model.Tags;
            activity.slug   = this.Model.Slug;
            activity.locale = this.Locale;
            //activity.categories = !string.IsNullOrEmpty(this.Model.Categories) ? this.Model.Categories.Split(',') : null;
            activity.tags       = !string.IsNullOrEmpty(this.Model.Tags) ? this.Model.Tags.Split(',') : null;
            activity.pos        = this.Pos;
            activity.reads      = this.Reads;
            activity.actor      = actor;
            activity.annotation = this.Annotation;
            activity.verb       = this.ShareID != Guid.Empty ? "share" : "post";
            activity.url        = this.UrlComponent;

            #endregion

            #region object
            dynamic _obj  = new ExpandoObject();
            dynamic owner = new ExpandoObject();

            owner.id          = this.Owner;
            owner.url         = baseUrl + "/profiles/" + this.Owner;
            owner.displayName = this.Owner;
            _obj.actor        = owner;

            var j     = 0;
            var title = "";

            foreach (var key in Values.Keys)
            {
                if (j == 0)
                {
                    title = Values[key].ToString();
                    j++;
                }
                ((IDictionary <String, Object>)_obj).Add(key, Values[key]);
            }
            #endregion

            var objUrl = UrlComponent.ToString();
            _obj.objectType   = this.Parent.BaseType;
            _obj.objectTypeID = this.ParentID;
            _obj.id           = ShareID != Guid.Empty ? ShareID.ToString() : this.ID.ToString();

            ContentList     originalList = null;
            ContentDataItem originalItem = null;

            if (ShareID != Guid.Empty)
            {
                originalItem = Context.Find <ContentDataItem>(this.ShareID);
                originalList = originalItem.ParentID.Equals(this.ParentID) ? this.Parent.Model : Context.Find <ContentList>(originalItem.ParentID);
                var originalWeb = originalItem.ParentID.Equals(this.ParentID) ? this.Parent.Web.Model : Context.Find <Web>(originalList.WebID);
                objUrl = (new Uri(string.Format("{0}/{1}/lists/{2}/items/{3}.html", baseUrl, originalWeb.Name, originalList.Name, originalItem.Slug))).ToString();
            }

            _obj.url = objUrl;

            #region additional properties
            activity.links = new
            {
                //view = this.UrlComponent,
                edit = Url.Content(this.Parent.GetEditItemUrl(this)),
                del  = Url.Content("~/api/contents/deleteItem/" + this.ParentID.ToString())
            };

            activity.title = title;

            #endregion

            #region categories
            if (Categories != null && Categories.Count() > 0)
            {
                activity.categories = Categories.Select(c => new
                {
                    id       = c.ID,
                    parentId = c.ParentID,
                    name     = c.Name,
                    desc     = c.Description
                });
            }
            //dynamic categories = new ExpandoObject();
            #endregion

            #region comments
            dynamic replies = new ExpandoObject();
            replies.totalItems = ShareID != Guid.Empty ? Context.Count <Comment>(c => c.TargetUri.Equals(objUrl, StringComparison.OrdinalIgnoreCase)) : this.TotalComments;
            replies.disabled   = originalItem != null ? !originalItem.EnableComments : !this.Model.EnableComments;
            replies.link       = Url.Content(string.Format("~/api/comments?url={0}", objUrl));
            #endregion

            #region ratings
            dynamic ratings = new ExpandoObject();
            ratings.totalItems = originalItem != null ? originalItem.TotalVotes : this.TotalVotes;
            ratings.value      = originalItem != null ? originalItem.Ratings : this.Ratings;
            ratings.disabled   = originalList != null ? !originalList.AllowVotes : !this.Parent.AllowVotes;

            if (originalList != null)
            {
                ratings.url = Url.Content(string.Format("~/api/contents/vote/{0}?list={1}", ShareID.ToString(), originalList.Name));
            }
            else
            {
                if (this.Parent != null)
                {
                    ratings.url = Url.Content(string.Format("~/api/contents/vote/{0}?list={1}", this.ID.ToString(), this.Parent.Name));
                }
            }
            #endregion

            #region attachments

            dynamic attachs = new ExpandoObject();
            attachs.totalItems = originalItem != null ? originalItem.TotalAttachments : this.TotalAttachments;
            attachs.disabled   = originalList != null ? !originalList.AllowAttachments : !this.Parent.AllowAttachments;

            if (originalItem != null)
            {
                attachs.items = Context.Where <ContentAttachment>(c => c.ItemID.Equals(originalItem.ID)).ToList().Select(attach => new
                {
                    type = attach.ContentType,
                    url  = attach.Uri,
                    name = attach.Name,
                    id   = attach.ID,
                    size = attach.Size
                }).ToArray();
            }
            else
            {
                if (this.Parent != null && this.Attachments != null)
                {
                    if (this.Parent.AllowAttachments)
                    {
                        attachs.items = Attachments.Select(attach => new
                        {
                            type = attach.ContentType,
                            url  = attach.Uri,
                            name = attach.Name,
                            id   = attach.ID,
                            size = attach.Size
                        }).ToList().ToArray();
                    }
                    else
                    {
                        attachs.items = new object[0];
                    }
                }
            }
            _obj.attachments = attachs;

            #endregion

            dynamic reshares = new ExpandoObject();
            reshares.totalItems = 0;
            reshares.link       = Url.Content("~/api/contents/shares/" + (ShareID != Guid.Empty ? this.ShareID.ToString() : this.ID.ToString()));
            reshares.disabled   = !this.Parent.AllowResharing;

            if (ShareID != Guid.Empty)
            {
                reshares.totalItems = Context.Count <ContentDataItem>(i => i.ShareID == this.ShareID);
            }
            else
            if (this.Parent != null && this.Parent.AllowResharing)
            {
                reshares.totalItems = Reshares().Count();
            }


            _obj.reshares = reshares;
            _obj.replies  = replies;
            _obj.ratings  = ratings;

            activity.@object = _obj;

            return(activity);
        }
        private static void RenderChildren(Html32TextWriter writer, ContentListDecorator list, IEnumerable <ContentDataItem> items, ContentDataItem current)
        {
            var app       = App.Get();
            var fieldName = list.GetDefaultTitleField().Name;
            var Url       = DNA.Utility.UrlUtility.CreateUrlHelper();

            foreach (var item in items)
            {
                var itemWrapper = app.Wrap(item);
                writer.WriteBeginTag("li");
                var _class        = "d-node";
                var children      = itemWrapper.Children();
                var childrenCount = children.Count();
                if (childrenCount > 0)
                {
                    _class += " d-node-hasChildren";
                }

                //writer.WriteAttribute("class", "d-node d-node-hasChildren");


                var isInPath = false;
                if (current != null && !string.IsNullOrEmpty(current.Path) && !string.IsNullOrEmpty(item.Path) && current.Path.StartsWith(item.Path))
                {
                    isInPath = true;
                    if (childrenCount > 0)
                    {
                        writer.WriteAttribute("data-expanded", "true");
                    }
                }
                writer.WriteAttribute("data-id", itemWrapper.ID.ToString());

                if (current != null && itemWrapper.ID.Equals(current.ID))
                {
                    writer.WriteAttribute("data-selected", "true");
                }

                if (itemWrapper.ParentItemID != Guid.Empty)
                {
                    writer.WriteAttribute("data-parentid", itemWrapper.ParentItemID.ToString());
                }

                if (childrenCount > 0)
                {
                    if (!isInPath)
                    {
                        var urlformat = "~/api/contents/items?name={0}&slug={1}&parentId={2}";
                        var popupUrl  = Url.Content(string.Format(urlformat, list.Name, list.Views.Default.Name, itemWrapper.ID.ToString()));
                        writer.WriteAttribute("data-popupurl", popupUrl);
                    }
                }
                writer.WriteAttribute("class", _class);
                writer.Write(Html32TextWriter.TagRightChar);

                writer.WriteBeginTag("a");
                writer.WriteAttribute("href", itemWrapper.UrlComponent);
                writer.Write(Html32TextWriter.TagRightChar);
                writer.Write(itemWrapper.Value(fieldName).Raw);
                writer.WriteEndTag("a");

                if (childrenCount > 0)
                {
                    if (isInPath)
                    {
                        writer.WriteFullBeginTag("ul");
                        RenderChildren(writer, list, children, current);
                        writer.WriteEndTag("ul");
                    }
                }

                writer.WriteEndTag("li");
            }
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            //the actual list of standard items to return
            StandardValuesCollection list = null;

            if (context.Instance is Picker)
            {
                Picker picker = (Picker)context.Instance;

                var retVal = from item in Configuration.GetInstance().DataCommands
                             from column in item.Columns
                             where item.Name == picker.DataCommand
                             select column.Name;

                var tempList = retVal.ToList <String>();
                tempList.Insert(0, String.Empty);

                string[] items = tempList.ToArray <string>();

                list = new StandardValuesCollection(items);
            }

            if (context.Instance is ScreenPageTemplate)
            {
                ScreenPageTemplate pageTemplate = (ScreenPageTemplate)context.Instance;

                if (!String.IsNullOrEmpty(pageTemplate.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name == pageTemplate.DataCommand
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }



            if (context.Instance is Grid)
            {
                Grid grid = (Grid)context.Instance;

                if (!String.IsNullOrEmpty(grid.SelectDataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name == grid.SelectDataCommand
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is GridColumn)
            {
                GridColumn col = (GridColumn)context.Instance;

                if (!String.IsNullOrEmpty(col.Parent.SelectDataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name == col.Parent.SelectDataCommand
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is GridGroupByField)
            {
                GridGroupByField groupByField = (GridGroupByField)context.Instance;

                if ((groupByField.Expression != null) && (groupByField.Expression.Grid != null))
                {
                    if (!String.IsNullOrEmpty(groupByField.Expression.Grid.SelectDataCommand))
                    {
                        var retVal = from item in Configuration.GetInstance().DataCommands
                                     from column in item.Columns
                                     where item.Name == groupByField.Expression.Grid.SelectDataCommand
                                     select column.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();

                        list = new StandardValuesCollection(items);
                    }
                }
            }

            if (context.Instance is Widget)
            {
                //if propery is DataField
                if (context.PropertyDescriptor.Name.ToLower() == "datafield")
                {
                    list = GetDataFieldColumns(context, list);
                }
                else
                {
                    if (context.Instance is DropDownListControl)
                    {
                        DropDownListControl control = (DropDownListControl)context.Instance;

                        if (!String.IsNullOrEmpty(control.SelectDataCommand))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == control.SelectDataCommand.ToLower()
                                         select column.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }

                    if (context.Instance is ListBoxControl)
                    {
                        ListBoxControl control = (ListBoxControl)context.Instance;

                        if (!String.IsNullOrEmpty(control.SelectDataCommand))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == control.SelectDataCommand.ToLower()
                                         select column.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }

                    if (context.Instance is TreeViewControl)
                    {
                        TreeViewControl control = (TreeViewControl)context.Instance;

                        if (!String.IsNullOrEmpty(control.SelectDataCommand))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == control.SelectDataCommand.ToLower()
                                         select column.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                }
            }

            if (context.Instance is DataCommandValidator)
            {
                DataCommandValidator validator = (DataCommandValidator)context.Instance;

                if (!String.IsNullOrEmpty(validator.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == validator.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }



            if (context.Instance is WorkflowDynamicSecurityGroup)
            {
                WorkflowDynamicSecurityGroup dynamicGroup = (WorkflowDynamicSecurityGroup)context.Instance;

                if (!String.IsNullOrEmpty(dynamicGroup.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == dynamicGroup.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is EmailWorkflowAction)
            {
                EmailWorkflowAction emailAction = (EmailWorkflowAction)context.Instance;

                string dataCommandName = null;

                switch (context.PropertyDescriptor.Name.ToLower())
                {
                case "attachmentdocumentidfield":
                case "attachmenttoaddressfield":
                    dataCommandName = emailAction.AttachmentDataCommand;
                    break;

                case "bccaddressdisplaynamefield":
                case "bccaddressfield":
                case "bcctoaddressfield":
                    dataCommandName = emailAction.BCCAddressDataCommand;
                    break;

                case "ccaddressdisplaynamefield":
                case "ccaddressfield":
                case "cctoaddressfield":
                    dataCommandName = emailAction.CCAddressDataCommand;
                    break;

                case "contenttemplatefield":
                    dataCommandName = emailAction.ContentTemplateDataCommand;
                    break;

                case "fromaddressdisplaynamefield":
                case "fromaddressfield":
                case "fromtoaddressfield":
                    dataCommandName = emailAction.FromAddressDataCommand;
                    break;

                case "subjectfield":
                case "subjecttoaddressfield":
                    dataCommandName = emailAction.SubjectDataCommand;
                    break;

                case "toaddressdisplaynamefield":
                case "toaddressfield":
                    dataCommandName = emailAction.ToAddressDataCommand;
                    break;
                }

                if (!String.IsNullOrEmpty(dataCommandName))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == dataCommandName.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is WorkflowContentDataItem)
            {
                WorkflowContentDataItem emailDataItem = (WorkflowContentDataItem)context.Instance;

                if (!String.IsNullOrEmpty(emailDataItem.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == emailDataItem.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is ContentDataItem)
            {
                ContentDataItem contentDataItem = (ContentDataItem)context.Instance;

                if (!String.IsNullOrEmpty(contentDataItem.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == contentDataItem.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }



            if (context.Instance is SMSWorkflowAction)
            {
                SMSWorkflowAction smsAction = (SMSWorkflowAction)context.Instance;

                string dataCommandName = null;

                switch (context.PropertyDescriptor.Name.ToLower().Substring(0, 2))
                {
                case "co":    //content
                    dataCommandName = smsAction.ContentTemplateDataCommand;
                    break;

                case "ph":    //phone
                    dataCommandName = smsAction.PhoneDataCommand;
                    break;
                }

                if (!String.IsNullOrEmpty(dataCommandName))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == dataCommandName.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }



            return(list);
        }