Ejemplo n.º 1
0
		public PublicEditor(BXCustomType type)
		{
			this.type = type;
		}
Ejemplo n.º 2
0
		public void Store(BXCustomField field, BXCustomType type)
		{
			if (field == null)
			{
				State.Value = string.Empty;
				return;
			}
			BXParamsBag<object> state = new BXParamsBag<object>();
			state.Add("Settings", field.Settings);
			state.Add("CustomTypeId", field.CustomTypeId);
			state.Add("EditInList", field.EditInList);
			state.Add("FieldName", field.Name);
			state.Add("IsSearchable", field.IsSearchable);
			state.Add("Mandatory", field.Mandatory);
			state.Add("Multiple", field.Multiple);
			state.Add("ShowInFilter", (int)field.ShowInFilter);
			state.Add("ShowInList", field.ShowInList);
			state.Add("Sort", field.Sort);
			state.Add("XmlId", field.XmlId);

			foreach (BXCustomFieldLocalization l in field.Localization)
			{
				string[] phrases = new string[5];
				phrases[0] = l.TextEncoder.Decode(l.EditFormLabel);
				phrases[1] = l.TextEncoder.Decode(l.ErrorMessage);
				phrases[2] = l.TextEncoder.Decode(l.HelpMessage);
				phrases[3] = l.TextEncoder.Decode(l.ListColumnLabel);
				phrases[4] = l.TextEncoder.Decode(l.ListFilterLabel);

				state.Add("Loc." + l.LanguageId, phrases);
			}

			if (type != null)
			{

				IBXCustomTypeAdvancedSetting adv = null;
				try
				{
					adv = type.AdvancedSettings as IBXCustomTypeAdvancedSetting;
				}
				catch
				{
				}
				if (adv != null)
				{
					adv.Initialize(field);
					state.Add("Extras", adv.GetSettings());
				}
			}

			Store(state);
		}
		public Container(BXCustomType type, BXCustomField field, BXCustomProperty value)
		{
			editorRaw = type.Edit;
			editorRaw.ID = string.Format("ed");
			editor = (IBXCustomTypeEdit)editorRaw;
			editor.Initialize(field, value);
			Controls.Add(editorRaw);

			deleteButton = new ImageButton();
			deleteButton.ID = string.Format("bt");
			deleteButton.ImageUrl =  VirtualPathUtility.ToAbsolute("~/bitrix/images/delete_button.gif");
			deleteButton.ImageAlign = ImageAlign.AbsMiddle;
			deleteButton.CausesValidation = false;
			Controls.Add(deleteButton);
	
			Literal br = new Literal();
			br.Text = "<br/>";
			Controls.Add(br);
		}
Ejemplo n.º 4
0
	private void SaveExtras(object state, BXCustomField field, BXCustomType t)
	{
		if (state != null && t != null)
		{
			IBXCustomTypeAdvancedSetting extras = null;
			try
			{
				extras = t.AdvancedSettings as IBXCustomTypeAdvancedSetting;
			}
			catch
			{
			}
			if (extras != null)
			{
				extras.Initialize(field);
				extras.SetSettings(state);
				extras.Save();
			}
		}
	}
    public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
    {
        field = currentField;
        value = currentValue;
		type = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		Bind();
    }