Zeige letzte Bearbeiter
1 Auf dieser Seite werden verschiedene Beispiele für das Anpassen des Aussehens von Formularen dargestellt.
2
3 (% class="box xm-toc-box" data-content-hide="Verbergen" data-content-show="Anzeigen" style="width:auto;" %)
4 (((
5 Inhalt (% class="xm-toc-toggle" %)[ [[Verbergen>>path:javascript:void||class="xm-toc-togglelink"]] ]
6
7 (% class="xm-toc numbered-true" %)
8 (((
9 * [[Einfügen einer Grafik im Formularheader>>path:#HEinfFCgeneinerGrafikimFormularheader]]
10 ** [[Verwenden eines extern gehosteten Bildes>>path:#HVerwendeneinesexterngehostetenBildes]]
11 ** [[Verwenden einer Mandant- oder Formularressource>>path:#HVerwendeneinerMandant-oderFormularressource]]
12 ** [[Einfügen als Base64-String>>path:#HEinfFCgenalsBase64-String]]
13 * [[Anpassungen des Schriftbildes>>path:#HAnpassungendesSchriftbildes]]
14 * [[Hinzufügen einer eigenen Schriftart>>path:#HHinzufFCgeneinereigenenSchriftart]]
15 * [[Anpassen des Favicons>>path:#HAnpassendesFavicons]]
16 * [[Anpassung Abstand Fieldset nach oben>>path:#HAnpassungAbstandFieldsetnachoben]]
17 * [[Anpassung Hintergrundfarbe Fieldset>>path:#HAnpassungHintergrundfarbeFieldset]]
18 * [[Anpassung Seitenabstand>>path:#HAnpassungSeitenabstand]]
19 )))
20 )))
21
22 == Einfügen einer Grafik im Formularheader ==
23
24 Für das Einfügen einer Grafik im auf allen Formularseiten sichtbaren Headerbereich des Formulars sollen im folgenden 3 verschiedene Möglichkeiten vorgestellt werden. Die hier gezeigten Beispiele müssen im [[CSS-Bereich>>path:/xwiki/bin/view/Formcycle/Designer/Form/CodingPanel/CSSTab/]] des Designers, in einem [[Design>>path:/xwiki/bin/create/Formcycle/UserInterface/FilesAndTemplates/Design/WebHome?parent=Examples.FormStylingAdjustments]] oder in einer //.css//-Datei im Formular oder Mandanten eingefügt werden.
25
26 === Verwenden eines extern gehosteten Bildes ===
27
28 Um ein extern gehostets (kleines) Logo mittig rechts im Header zu postitionieren, kann der folgende Code als Basis verwendet werden:
29
30 (% class="box" %)
31 (((
32 (% class="code" %)
33 (((
34 .(% style="color:#0000ff; font-weight:bold" %)**XHeader**(%%) {
35 (% style="color:#008000; font-weight:bold" %)**background-image**(%%): (% style="color:#008000" %)url(%%)((% style="color:#ba2121" %)'https:~/~/beispiel.de/pfad/zum/bild/logo.png'(%%)); (% style="color:#408080; font-style:italic" %)///* Auswählen des Bildes per URL *///(%%)
36 (% style="color:#408080; font-style:italic" %)///* Positionierung des Bildes: *///(%%)
37 (% style="color:#008000; font-weight:bold" %)**background-size**(%%): (% style="color:#008000; font-weight:bold" %)**auto**(%%) (% style="color:#666666" %)25(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Das Bild hat 25 Pixel Höhe und die Breite wird automatisch passend zum Seitenverhältnis des Bildes ermittelt *///(%%)
38 (% style="color:#008000; font-weight:bold" %)**height**(%%): (% style="color:#666666" %)60(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Die Höhe des Headers wird auf 60 Pixel festgelegt *///(%%)
39 (% style="color:#008000; font-weight:bold" %)**background-repeat**(%%): (% style="color:#008000; font-weight:bold" %)**no-repeat**(%%); (% style="color:#408080; font-style:italic" %)///* Das Bild wird nur einmal angezeigt *///(%%)
40 background-position-x: (% style="color:#008000" %)calc(%%)((% style="color:#666666" %)100(% style="color:#b00040" %)%(%%) (% style="color:#666666" %)-(%%) (% style="color:#666666" %)30(% style="color:#b00040" %)px(%%)); (% style="color:#408080; font-style:italic" %)///* Das Bild wird 30 Pixel vom rechten Rand positioniert *///(%%)
41 background-position-y: (% style="color:#666666" %)20(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Das Bild wird 20 Pixel vom oberen Rand positioniert *///(%%)
42 }
43 )))
44 )))
45
46 === Verwenden einer Mandant- oder Formularressource ===
47
48 Für das Anzeigen eines als Formularressource hochgeladenen Bilddatei (% class="box code" %)headerbild.png(%%) mit dem Namen über die gesamte Headergröße eines Formulars mit der ID (% class="box code" %)1234(%%) kann folgender Code verwendet werden:
49
50 (% class="box" %)
51 (((
52 (% class="code" %)
53 (((
54 .(% style="color:#0000ff; font-weight:bold" %)**XHeader**(%%) {
55 (% style="color:#008000; font-weight:bold" %)**background-image**(%%): (% style="color:#008000" %)url(%%)((% style="color:#ba2121" %)'../includes/ressource?pid=1234&name=headerbild.png'(%%)); (% style="color:#408080; font-style:italic" %)///* Auswählen des Bildes per relativer URL zur Formularressource *///(%%)
56 (% style="color:#408080; font-style:italic" %)///* Positionierung des Bildes: *///(%%)
57 (% style="color:#008000; font-weight:bold" %)**background-size**(%%): (% style="color:#666666" %)100(% style="color:#b00040" %)%(%%) (% style="color:#666666" %)100(% style="color:#b00040" %)%(%%); (% style="color:#408080; font-style:italic" %)///* Bild über die gesamte Headergröße zeichnen *///(%%)
58 }
59 )))
60 )))
61
62 === Einfügen als Base64-String ===
63
64 Ein als Base64-String kodiertes Bild kann auch einfach im CSS eingefügt werden:
65
66 (% class="box" %)
67 (((
68 (% class="code" %)
69 (((
70 .(% style="color:#0000ff; font-weight:bold" %)**XHeader**(%%) {
71 (% style="color:#008000; font-weight:bold" %)**background-image**(%%): (% style="color:#008000" %)url(%%)((% style="color:#008000" %)data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAA5SURBVBhXdY1LFgAgCAK5/6UNQ6mFzkLj4wuxkxlQDT5MSrue5onbXjKimJTUIr8rurL9Z2u+G4g4ozy8RKSwCIwAAAAASUVORK5CYII=(%%)); (% style="color:#408080; font-style:italic" %)///* Auswahl eines Bildes per Base64-String*///(%%)
72 (% style="color:#408080; font-style:italic" %)///* Positionierung des Bildes: *///(%%)
73 (% style="color:#008000; font-weight:bold" %)**background-repeat**(%%): (% style="color:#008000; font-weight:bold" %)**no-repeat**(%%); (% style="color:#408080; font-style:italic" %)///* Das Bild wird nur einmal angezeigt *///(%%)
74 background-position-x: (% style="color:#666666" %)10(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Positionierung in horizontaler Richtung *///(%%)
75 background-position-y: (% style="color:#666666" %)10(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Positionierung in vertikaler Richtung *///(%%)
76 (% style="color:#008000; font-weight:bold" %)**background-size**(%%): (% style="color:#008000; font-weight:bold" %)**auto**(%%) (% style="color:#666666" %)40(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Größe des Bildes: 40px hoch und so breit, wie es das Seitenverhältnis des Bildes vorgibt *///(%%)
77 (% style="color:#008000; font-weight:bold" %)**height**(%%): (% style="color:#666666" %)60(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Gesamthöhe des Formularheaders *///(%%)
78 }
79 )))
80 )))
81
82 Die weiteren CSS dienen zur Positionierung des Bildes und zum Festelgen der Höhe des Headers.
83
84 Zu beachten ist hierbei, dass bei der Einbindung des Bildes als base64-String bei jedem Aufruf des Formulars das Bild erneut mitübertragen wird, da die Cachingmechanismen der Webbrowser für Dateien hier nicht greifen.
85
86 == Anpassungen des Schriftbildes ==
87
88 Um allgemein für alle Elemente im Formular die Eigenschaften der Schriftart festzulegen, kann bei Verwendung des //Modern Themes// folgender CSS-Code als Grundlage genommen werden:
89
90 (% class="box" %)
91 (((
92 (% class="code" %)
93 (((
94 .(% style="color:#0000ff; font-weight:bold" %)**xm-form**(%%).(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) (% style="color:#666666" %)*,(%%) .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**XPage**(%%) (% style="color:#666666" %)*(%%) { (% style="color:#408080; font-style:italic" %)///* Selektiert das gesamte Formular und alle Formularseiten*///(%%)
95 (% style="color:#008000; font-weight:bold" %)**font-family**(%%): Verdana; (% style="color:#408080; font-style:italic" %)///* Setzt die Default-Schriftart. *///(%%)
96 }
97 )))
98 )))
99
100 Für Labels und Text in Eigabefeldern müssen die Schriftgrößen und Farben gegebenenfalls noch angepasst werden. Dies kann beispielsweise wie folgt erreicht werden:
101
102 (% class="box" %)
103 (((
104 (% class="code" %)
105 (((
106 .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**xm-item-div**(%%) (% style="color:#008000; font-weight:bold" %)**LABEL**(%%) {
107 (% style="color:#008000; font-weight:bold" %)**font-size**(%%): (% style="color:#666666" %)14(% style="color:#b00040" %)px(%%); (% style="color:#408080; font-style:italic" %)///* Setzt die Schriftgröße. *///(%%)
108 (% style="color:#008000; font-weight:bold" %)**color**(%%): (% style="color:#666666" %)#111(%%); (% style="color:#408080; font-style:italic" %)///* Setzt die Schriftfarbe. *///(%%)
109 }
110 )))
111 )))
112
113 == Hinzufügen einer eigenen Schriftart ==
114
115 Um eine neue Schriftart hinzuzufügen, muss diese entweder im Formular unter //Mehr// > [[//Dateien// >>doc:Formcycle.UserInterface.MyForms.Files||target="_blank"]]im Format woff, woff2 und ttf hochgeladen werden. Wenn die Schriftart allgemein zum Einsatz kommt, dann sollte diese stattdessen unter //Dateien & Templates > //[[//Dateien// >>doc:Formcycle.UserInterface.FilesAndTemplates.Files||target="_blank"]]abgelegt werden. Dadurch werden die Schriftarten erstmal generell bereitgestellt.
116
117 Anschließend kann die Schriftart im CSS-Code eines Formulars eingebunden und verwendet werden. in dem folgenden Beispiel sind die Schriftarten im Formular hinterlegt, zu erkennen an dem Parameter //pid//. Sollten die Schriftarten unter Dateien & Templates abgelegt sein, beachten Sie hierbei dass der Parameter //mid// verwendet wird. Bitte beachten Sie, ddass die URL's zu den Schriftarten angepasst werden müssen. Die absolute URL finden Sie rechts im Eigenschaftsbereich.
118
119 (% class="box" %)
120 (((
121 (% class="code" %)
122 (((
123 @(% style="color:#0000ff; font-weight:bold" %)**font-face**(%%) {
124 (% style="color:#008000; font-weight:bold" %)**font-family**(%%): (% style="color:#666666" %)'myfont'(%%);
125 (% style="color:#008000; font-weight:bold" %)**src**(%%): (% style="color:#666666" %)url('?pid=8104&name=Roboto-Regular.woff2') format('woff2'),(%%)
126 (% style="color:#666666" %) url('?pid=8104&name=Roboto-Regular.woff') format('woff')(%%),
127 (% style="color:#666666" %) url('?pid=8104&name=Roboto-Regular.ttf') format('ttf')(%%);
128 (% style="color:#008000; font-weight:bold" %)**font-weight**(%%): (% style="color:#008000; font-weight:bold" %)**normal**(%%);
129 (% style="color:#008000; font-weight:bold" %)**font-style**(%%): (% style="color:#008000; font-weight:bold" %)**normal**(%%);
130 }
131
132 .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**XHeader**(%%) * {
133 (% style="color:#008000; font-weight:bold" %)**font-family**(%%): (% style="color:#666666" %)'myfont'(%%);
134 }
135 )))
136 )))
137
138 Es reicht nicht aus nur ein font-face zu definieren. Die neue Schriftart muss dann noch als font für den entsprechenden Abschnitt hinterlegt werden. In diesem Beispiel wird nun im Kopfbereich die neue Schriftart angewendet. Prüfen Sie dies ggf. noch über den Browser Inspector (F12).
139
140 == Anpassen des Favicons ==
141
142 (% class="xm-figure xm-float-right xm-clear-h2" data-alt="Im im Metabereich kann der Link auf ein anderes Favicon definiert werden." %)
143 (((
144 (% class="xm-figure-inner" style="width:310px" %)
145 (((
146 [[[[image:/xwiki/bin/download/Examples/FormStylingAdjustments/designer_favicon_meta_de.png?rev=1.1||width="300"]]>>path:/xwiki/bin/download/Examples/FormStylingAdjustments/designer_favicon_meta_de.png?rev=1.1||rel="lightbox[$group]" title="Im im Metabereich kann der Link auf ein anderes Favicon definiert werden."]]
147
148 (% class="xm-figure-caption" %)
149 (((
150 Im (% class="xm-smallcaps" %)Xima® Formcycle-Designer(%%) im Metabereich kann der Link auf ein anderes Favicon definiert werden.
151 )))
152 )))
153 )))
154
155 Um in einem Formular das Favicon zu verändern, kann im (% class="xm-smallcaps" %)Xima® Formcycle-Designer(%%) im [[Meta-Bereich>>path:/xwiki/bin/create/Formcycle/FormDesigner/CodingPanel/MetaTab/WebHome?parent=Examples.FormStylingAdjustments]] die Position des zu verwendenen Bildes angegeben werden. Dies erfolgt nach folgendem Muster:
156
157 (% class="box" %)
158 (((
159 (% class="code" %)
160 (((
161 <(% style="color:#008000; font-weight:bold" %)**link**(%%) (% style="color:#7d9029" %)rel(% style="color:#666666" %)=(% style="color:#ba2121" %)"shortcut icon"(%%) (% style="color:#7d9029" %)type(% style="color:#666666" %)=(% style="color:#ba2121" %)"image/png"(%%) (% style="color:#7d9029" %)href(% style="color:#666666" %)=(% style="color:#ba2121" %)"https:~/~/beispiel.de/pfad/zum/bild/favicon.png"(%%) />
162 )))
163 )))
164
165 Für ein Base64-Codiertes Bild erfolgt eine Einbindung analog:
166
167 (% class="box" %)
168 (((
169 (% class="code" %)
170 (((
171 <(% style="color:#008000; font-weight:bold" %)**link**(%%) (% style="color:#7d9029" %)rel(% style="color:#666666" %)=(% style="color:#ba2121" %)"shortcut icon"(%%) (% style="color:#7d9029" %)type(% style="color:#666666" %)=(% style="color:#ba2121" %)"image/png"(%%) (% style="color:#7d9029" %)href(% style="color:#666666" %)=(% style="color:#ba2121" %)"data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAA5SURBVBhXdY1LFgAgCAK5/6UNQ6mFzkLj4wuxkxlQDT5MSrue5onbXjKimJTUIr8rurL9Z2u+G4g4ozy8RKSwCIwAAAAASUVORK5CYII="(%%) />
172 )))
173 )))
174
175 Wenn das mehrere Favicons mit unterschiedlichen Größen als Formularressource unter Dateien hochgeladen wurde, könnte der entsprechende Code für ein Formular mit der ID (% class="box code" %)1234(%%) und einer Größe von 16 mal 16 und 32 mal 32 Pixeln wie folgt aussehen:
176
177 (% class="box" %)
178 (((
179 (% class="code" %)
180 (((
181 <(% style="color:#008000; font-weight:bold" %)**link**(%%) (% style="color:#7d9029" %)rel(% style="color:#666666" %)=(% style="color:#ba2121" %)"shortcut icon"(%%) (% style="color:#7d9029" %)type(% style="color:#666666" %)=(% style="color:#ba2121" %)"image/png"(%%) (% style="color:#7d9029" %)sizes(% style="color:#666666" %)=(% style="color:#ba2121" %)"16x16"(%%) (% style="color:#7d9029" %)href(% style="color:#666666" %)=(% style="color:#ba2121" %)"../includes/ressource?pid=1234&name=favicon16.png"(%%) />
182 <(% style="color:#008000; font-weight:bold" %)**link**(%%) (% style="color:#7d9029" %)rel(% style="color:#666666" %)=(% style="color:#ba2121" %)"shortcut icon"(%%) (% style="color:#7d9029" %)type(% style="color:#666666" %)=(% style="color:#ba2121" %)"image/png"(%%) (% style="color:#7d9029" %)sizes(% style="color:#666666" %)=(% style="color:#ba2121" %)"32x32"(%%) (% style="color:#7d9029" %)href(% style="color:#666666" %)=(% style="color:#ba2121" %)"../includes/ressource?pid=1234&name=favicon32.png"(%%) />
183 )))
184 )))
185
186 == Anpassung Abstand Fieldset nach oben ==
187
188 Beim //Modern Theme// sind standardmäßig die Abstände zu den oberen Elementen recht groß. Dies kann durch folgenen CSS-Code angepasst werden:
189
190 (% class="box" %)
191 (((
192 (% class="code" %)
193 (((
194 .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**CXFieldSet**(%%) .(% style="color:#0000ff; font-weight:bold" %)**XFieldSetWrapper**(%%) {
195 (% style="color:#008000; font-weight:bold" %)**margin-top**(%%): (% style="color:#666666" %)5(% style="color:#b00040" %)px(%%);
196 }
197 )))
198 )))
199
200 == Anpassung Hintergrundfarbe Fieldset ==
201
202 Um den Hintergrund eines Fieldsets komplett einzufärben, muss beachtet werden auch das legend-Element zu berücksichtigen.
203
204 (% class="box" %)
205 (((
206 (% class="code" %)
207 (((
208 .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**CXFieldSet**(%%) .(% style="color:#0000ff; font-weight:bold" %)**XFieldSetWrapper**(% style="color:#666666" %),(%%) .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**XFieldSet**(%%) (% style="color:#008000; font-weight:bold" %)**legend**(%%) {
209 (% style="color:#008000; font-weight:bold" %)**background-color**(%%): (% style="color:#008000; font-weight:bold" %)**lightsteelblue**(%%);
210 (% style="color:#008000; font-weight:bold" %)**width**(%%): (% style="color:#666666" %)100(% style="color:#b00040" %)%(%%);
211 }
212 )))
213 )))
214
215 == Anpassung Seitenabstand ==
216
217 Die CSS-Klasse //XPage// legt die Abstände einer Seite fest. Dabei bestimmt der erste Wert den Abstand für oben/unten, der zweite Wert den Abstand für rechts/links:
218
219 (% class="box" %)
220 (((
221 (% class="code" %)
222 (((
223 .(% style="color:#0000ff; font-weight:bold" %)**modern**(%%) .(% style="color:#0000ff; font-weight:bold" %)**XPage**(%%) {
224 (% style="color:#008000; font-weight:bold" %)**padding**(%%): (% style="color:#666666" %)25(% style="color:#b00040" %)px(%%) (% style="color:#666666" %)25(% style="color:#b00040" %)px(%%);
225 }
226 )))
227 )))
228
229
230