SmartAPI
Open Source .NET RQL library for RedDot CMS / OpenText WSM Management Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
IHitList.cs
Go to the documentation of this file.
1 ï»¿// SmartAPI - .Net programmatic access to RedDot servers
2 //
3 // Copyright (C) 2013 erminas GbR
4 //
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free Software Foundation,
7 // either version 3 of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 // See the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program.
14 // If not, see <http://www.gnu.org/licenses/>.
15 
16 using System;
17 using System.Xml;
18 using erminas.SmartAPI.CMS.Converter;
19 
20 namespace erminas.SmartAPI.CMS.Project.ContentClasses.Elements
21 {
22  public interface IHitList : IList
23  {
24  BasicAlignment Align { get; set; }
25 
26  string AltText { get; set; }
27 
28  string Border { get; set; }
29 
30  string HSpace { get; set; }
31 
32  HitListType HitListType { get; set; }
33 
34  bool IsAltPreassignedAutomatically { get; set; }
35 
36  string Supplement { get; set; }
37 
38  string Usemap { get; set; }
39 
40  string VSpace { get; set; }
41  }
42 
43  internal class HitList : List, IHitList
44  {
45  internal HitList(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
46  {
47  }
48 
49  [RedDot("eltalign", ConverterType = typeof (StringEnumConverter<BasicAlignment>))]
50  public BasicAlignment Align
51  {
52  get { return GetAttributeValue<BasicAlignment>(); }
53  set { SetAttributeValue(value); }
54  }
55 
56  [RedDot("eltalt")]
57  public string AltText
58  {
59  get { return GetAttributeValue<string>(); }
60  set { SetAttributeValue(value); }
61  }
62 
63  [RedDot("eltborder")]
64  public string Border
65  {
66  get { return GetAttributeValue<string>(); }
67  set { SetAttributeValue(value); }
68  }
69 
70  public override void CommitInLanguage(string abbreviation)
71  {
72  var element = GetElementForLanguage(abbreviation);
73  //we need to have an eltsrc attribute with value sessionkey, otherwise eltalt won't get stored on the server oO
74  element.SetAttributeValue("eltsrc", RQL.SESSIONKEY_PLACEHOLDER);
75 
76  base.CommitInLanguage(abbreviation);
77  }
78 
79  [RedDot("elthspace")]
80  public string HSpace
81  {
82  get { return GetAttributeValue<string>(); }
83  set { SetAttributeValue(value); }
84  }
85 
86  [RedDot("elthittype", ConverterType = typeof (StringEnumConverter<HitListType>))]
88  {
89  get { return GetAttributeValue<HitListType>(); }
90  set
91  {
92  if (value == HitListType.NotSet)
93  {
94  throw new ArgumentException(string.Format("Hit list type cannot be set to {0} by the user",
95  HitListType.NotSet));
96  }
97  SetAttributeValue(value);
98  }
99  }
100 
101  [RedDot("eltpresetalt")]
102  public bool IsAltPreassignedAutomatically
103  {
104  get { return GetAttributeValue<bool>(); }
105  set { SetAttributeValue(value); }
106  }
107 
108  [RedDot("eltsupplement")]
109  public string Supplement
110  {
111  get { return GetAttributeValue<string>(); }
112  set { SetAttributeValue(value); }
113  }
114 
115  [RedDot("eltusermap")]
116  public string Usemap
117  {
118  get { return GetAttributeValue<string>(); }
119  set { SetAttributeValue(value); }
120  }
121 
122  [RedDot("eltvspace")]
123  public string VSpace
124  {
125  get { return GetAttributeValue<string>(); }
126  set { SetAttributeValue(value); }
127  }
128  }
129 }