Exemple #1
0
        protected override void CreateChildControls()
        {
            this.DisableInputFieldLabel = true;
            base.ControlMode            = SPContext.Current.FormContext.FormMode;
            base.CreateChildControls();
            try
            {
                titleField = (HTML5TitleField)ItemFieldValue;
            }
            catch (Exception)
            {
            }

            _title = ListItem.Fields[SPBuiltInFieldId.Title];

            if (titleField == null)
            {
                titleField = new HTML5TitleField();
            }

            if (base.ControlMode == SPControlMode.Edit || base.ControlMode == SPControlMode.New)
            {
                //this.CssClass = "HTML5-editable";
                html_title_hidden = (HiddenField)this.TemplateContainer.FindControl("html_title_hidden");
                html_title        = (Title)this.TemplateContainer.FindControl("html_title");

                if (string.IsNullOrEmpty(titleField.Title))
                {
                    html_title_hidden.Value = _title.GetFieldValueAsHtml(ListItem[SPBuiltInFieldId.Title]);
                    html_title.Controls.AddAt(0, new LiteralControl {
                        Text = _title.GetFieldValueAsHtml(ListItem[SPBuiltInFieldId.Title])
                    });
                    //html_title.Text = _title.GetFieldValueAsHtml(ListItem[SPBuiltInFieldId.Title]);
                }
                else
                {
                    html_title_hidden.Value = titleField.Title;
                    html_title.Controls.AddAt(0, new LiteralControl {
                        Text = titleField.Title
                    });
                    //html_title.Text = titleField.Title;
                }
            }
            else
            {
                html_title = (Title)this.TemplateContainer.FindControl("html_title");
                html_title.Controls.AddAt(0, new LiteralControl {
                    Text = _title.GetFieldValueAsHtml(ListItem[SPBuiltInFieldId.Title])
                });
                //html_title.InnerHtml = _title.GetFieldValueAsHtml(ListItem[SPBuiltInFieldId.Title]);
            }
        }
        /// <summary>
        /// Gets the field special values.
        /// </summary>
        /// <param name="spField">The sp field.</param>
        /// <param name="stringValue">The string value.</param>
        /// <param name="value">The value.</param>
        /// <param name="fieldEditValue">The field edit value.</param>
        /// <param name="fieldTextValue">The field text value.</param>
        /// <param name="fieldHtmlValue">The field HTML value.</param>
        private static void GetFieldSpecialValues(SPField spField, string stringValue, object value,
                                                  out string fieldEditValue,
                                                  out string fieldTextValue, out string fieldHtmlValue)
        {
            fieldTextValue = string.IsNullOrEmpty(stringValue)
                                 ? string.Empty
                                 : spField.GetFieldValueAsText(value) ?? string.Empty;

            fieldHtmlValue = string.IsNullOrEmpty(stringValue)
                                 ? string.Empty
                                 : spField.GetFieldValueAsHtml(value) ?? string.Empty;

            fieldEditValue = string.IsNullOrEmpty(stringValue)
                                 ? string.Empty
                                 : spField.GetFieldValueForEdit(value) ?? string.Empty;
        }
Exemple #3
0
        /// <summary>
        /// Gets the field special values.
        /// </summary>
        /// <param name="spField">The sp field.</param>
        /// <param name="stringValue">The string value.</param>
        /// <param name="value">The value.</param>
        /// <param name="fieldEditValue">The field edit value.</param>
        /// <param name="fieldTextValue">The field text value.</param>
        /// <param name="fieldHtmlValue">The field HTML value.</param>
        protected void GetFieldSpecialValues(SPField spField, string stringValue, object value,
                                             out string fieldEditValue,
                                             out string fieldTextValue, out string fieldHtmlValue)
        {
            if (spField.Type != SPFieldType.DateTime)
            {
                fieldTextValue = stringValue;
                fieldEditValue = stringValue;
                fieldHtmlValue = stringValue;

                try
                {
                    fieldTextValue = string.IsNullOrEmpty(stringValue)
                                     ? string.Empty
                                     : spField.GetFieldValueAsText(value) ?? string.Empty;

                    fieldEditValue = string.IsNullOrEmpty(stringValue)
                                         ? string.Empty
                                         : spField.GetFieldValueForEdit(value) ?? string.Empty;

                    fieldHtmlValue = string.IsNullOrEmpty(stringValue)
                                         ? string.Empty
                                         : spField.GetFieldValueAsHtml(value) ?? string.Empty;
                }
                catch
                {
                }
            }
            else
            {
                string specialValue = string.IsNullOrEmpty(stringValue)
                                          ? string.Empty
                                          : ((DateTime)value).ToShortDateString();

                fieldTextValue = specialValue;
                fieldHtmlValue = specialValue;
                fieldEditValue = specialValue;
            }
        }
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            SPFieldUrl url;
            SPListItem relItem  = rec.RelItem as SPListItem;
            SPField    property = prop.Property as SPField;
            SPUser     mainItem = rec.MainItem as SPUser;

            if (prop.Name == "roxVcardExport")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null));
            }
            if ((prop.Name == "roxSiteGroups") && (mainItem != null))
            {
                List <object> list = new List <object>();
                foreach (SPGroup group in ProductPage.TryEach <SPGroup>(mainItem.Groups))
                {
                    try
                    {
                        list.Add(group.Name);
                    }
                    catch
                    {
                    }
                }
                return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null));
            }
            if (prop.Name == "roxUserPersonalUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPersonalUrl(rec) }, null, null, null));
            }
            if (prop.Name == "roxUserPublicUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPublicUrl(rec) }, null, null, null));
            }
            if ((relItem == null) || (property == null))
            {
                return(null);
            }
            object obj2 = relItem[property.Id];

            if (obj2 is DateTime)
            {
                obj2 = ((DateTime)obj2).ToUniversalTime();
            }
            if (((url = property as SPFieldUrl) != null) && (obj2 is string))
            {
                if (url.DisplayFormat == SPUrlFieldFormatType.Image)
                {
                    obj2 = new SPFieldUrlValue(obj2 as string).Url;
                }
                else
                {
                    obj2 = new SPFieldUrlValue(obj2 as string);
                }
            }
            return(new RecordPropertyValueCollection(this, rec, prop, (obj2 is object[]) ? (obj2 as object[]) : ((obj2 == null) ? new object[0] : new object[] { ((url != null) ? obj2 : property.GetFieldValueAsHtml(obj2)) }), null, null, null));
        }
 public string GetFieldValueAsHtml(object value)
 {
     return(m_field.GetFieldValueAsHtml(value));
 }