View | Details | Raw Unified | Return to bug 31151
Collapse All | Expand All

(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/data/umc-module-category.dtd (+23 lines)
Line 0    Link Here 
1
<!-- top level element -->
2
<!--  version: onyl 2.0 is allowed -->
3
<!ELEMENT umc (categories)>
4
<!ATTLIST umc
5
	version (2.0) #REQUIRED
6
	>
7
8
<!-- definition of categories -->
9
<!ELEMENT categories (category+)>
10
11
<!-- a category -->
12
<!--  priority: favories=100, monitor=1 -->
13
<!ELEMENT category (name+)>
14
<!ATTLIST category
15
	priority CDATA #REQUIRED
16
	id ID #REQUIRED
17
	>
18
19
<!-- translated names of vatehory -->
20
<!ELEMENT name (#PCDATA)>
21
<!ATTLIST name
22
	lang CDATA #IMPLIED
23
	>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/data/umc-module.dtd (-4 / +60 lines)
 Lines 1-7    Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
1
<!-- top level element -->
2
<!--  version: onyl 2.0 is allowed -->
2
<!ELEMENT umc (module)>
3
<!ELEMENT umc (module)>
3
<!ELEMENT module (name, description, command)*
4
<!ATTLIST umc
5
	version (2.0) #REQUIRED
6
	>
7
8
<!-- definition of a module -->
9
<!--  icon: path fragment for icon -->
10
<!--  version: onyl 1.0 is allowed -->
11
<!ELEMENT module ((name+, description+)?, flavor*, categories?, command*)>
12
<!ATTLIST module
13
	id CDATA #REQUIRED
14
	icon CDATA #REQUIRED
15
	priority CDATA #IMPLIED
16
	version (1.0) #REQUIRED
17
	translationId ID #IMPLIED
18
	>
19
20
<!-- translated names of module -->
4
<!ELEMENT name (#PCDATA)>
21
<!ELEMENT name (#PCDATA)>
5
<!ELEMENT command (description*)>
22
<!ATTLIST name
6
<!ELEMENT command (description*)>
23
	lang CDATA #IMPLIED
24
	>
25
26
<!-- translated description for module -->
27
<!ELEMENT description (#PCDATA)>
28
<!ATTLIST description
29
	lang CDATA #IMPLIED
30
	>
31
32
<!-- LDAP modules -->
33
<!ELEMENT flavor (name,description)?>
34
<!ATTLIST flavor
35
	icon CDATA #IMPLIED
36
	priority CDATA #IMPLIED
37
	id CDATA #REQUIRED
38
	deactivated (yes|no) "no"
39
	>
40
41
<!-- definition of categories -->
42
<!ELEMENT categories (category+)>
43
<!-- a category -->
44
<!--  priority: favories=100, monitor=1 -->
45
<!ELEMENT category EMPTY>
46
<!ATTLIST category
47
	name ID #REQUIRED
48
	>
49
50
<!-- mapping from UMC command to Python function -->
51
<!--  name: UMC command -->
52
<!--  function: Python function name -->
53
<!ELEMENT command (description*, return?)>
54
<!ATTLIST command
55
	name CDATA #REQUIRED
56
	function NMTOKEN #REQUIRED
57
	>
7
58
59
<!-- return value type -->
60
<!ELEMENT return EMPTY>
61
<!ATTLIST return
62
	syntax (Boolean|Dictionary|UCR-Variables|umc-boolean) #REQUIRED
63
	>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/data/umc-module.rng (+207 lines)
Line 0    Link Here 
1
<?xml version="1.0"?>
2
<rng:grammar
3
	xmlns:rng="http://relaxng.org/ns/structure/1.0"
4
	xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
5
	ns=""
6
	datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
7
8
	<a:documentation>
9
		Univention Corporate Server Management Console definition.
10
		Copyriught 2013 Univention GmbH.
11
	</a:documentation>
12
13
	<rng:define name="language">
14
		<a:documentation>Counte_Language code.</a:documentation>
15
		<rng:data type="string">
16
			<param name="pattern">[a-z][a-z]_[A-Z][A-Z]</param>
17
		</rng:data>
18
	</rng:define>
19
20
	<rng:define name="translated">
21
		<a:documentation>Translation to multiple languages.</a:documentation>
22
		<rng:optional>
23
			<rng:attribute name="lang">
24
				<rng:ref name="language"/>
25
			</rng:attribute>
26
		</rng:optional>
27
		<rng:data type="string"/>
28
	</rng:define>
29
30
	<rng:define name="version">
31
		<a:documentation>Version string with major and minor number.</a:documentation>
32
		<rng:data type="string">
33
			<rng:param name="pattern">[0-9]+\.[0-9]+</rng:param>
34
		</rng:data>
35
	</rng:define>
36
37
	<rng:define name="category">
38
		<a:documentation>Category string.</a:documentation>
39
		<rng:data type="string"/>
40
	</rng:define>
41
42
	<rng:start>
43
		<rng:element name="umc">
44
			<a:documentation>Top level element to define either UMC modules or categories.</a:documentation>
45
			<rng:choice>
46
				<rng:ref name="Module"/>
47
				<rng:ref name="Categories"/>
48
			</rng:choice>
49
			<rng:attribute name="version">
50
				<rng:ref name="version"/>
51
			</rng:attribute>
52
		</rng:element>
53
	</rng:start>
54
55
	<rng:define name="Module">
56
		<rng:element name="module">
57
			<a:documentation>UMC module definition</a:documentation>
58
			<rng:interleave>
59
				<rng:optional>
60
					<rng:oneOrMore>
61
						<rng:element name="name">
62
							<rng:ref name="translated"/>
63
						</rng:element>
64
					</rng:oneOrMore>
65
					<rng:oneOrMore>
66
						<rng:element name="description">
67
							<rng:ref name="translated"/>
68
						</rng:element>
69
					</rng:oneOrMore>
70
				</rng:optional>
71
				<rng:optional>
72
					<rng:element name="categories">
73
						<rng:oneOrMore>
74
							<rng:element name="category">
75
								<rng:attribute name="name">
76
									<rng:ref name="category"/>
77
								</rng:attribute>
78
							</rng:element>
79
						</rng:oneOrMore>
80
					</rng:element>
81
				</rng:optional>
82
				<rng:zeroOrMore>
83
					<rng:choice>
84
						<rng:ref name="Flavor"/>
85
						<rng:ref name="Command"/>
86
					</rng:choice>
87
				</rng:zeroOrMore>
88
			</rng:interleave>
89
			<rng:optional>
90
				<rng:attribute name="id">
91
					<rng:data type="string"/>
92
				</rng:attribute>
93
			</rng:optional>
94
			<rng:attribute name="icon">
95
				<rng:data type="string"/>
96
			</rng:attribute>
97
			<rng:optional>
98
				<rng:attribute name="priority">
99
					<rng:data type="integer"/>
100
				</rng:attribute>
101
			</rng:optional>
102
			<rng:attribute name="version">
103
				<rng:ref name="version"/>
104
			</rng:attribute>
105
			<rng:optional>
106
				<rng:attribute name="translationId">
107
					<rng:data type="ID"/>
108
				</rng:attribute>
109
			</rng:optional>
110
		</rng:element>
111
	</rng:define>
112
113
	<rng:define name="Flavor">
114
		<rng:element name="flavor">
115
			<a:documentation>Definition of UDM modules.</a:documentation>
116
			<rng:attribute name="id">
117
				<rng:data type="string"/>
118
			</rng:attribute>
119
			<rng:choice>
120
				<rng:group>
121
					<rng:attribute name="deactivated">
122
						<rng:value>yes</rng:value>
123
					</rng:attribute>
124
					<rng:empty/>
125
				</rng:group>
126
				<rng:group>
127
					<rng:optional>
128
						<rng:attribute name="deactivated">
129
							<rng:value>no</rng:value>
130
						</rng:attribute>
131
					</rng:optional>
132
					<rng:oneOrMore>
133
						<rng:element name="name">
134
							<rng:ref name="translated"/>
135
						</rng:element>
136
					</rng:oneOrMore>
137
					<rng:oneOrMore>
138
						<rng:element name="description">
139
							<rng:ref name="translated"/>
140
						</rng:element>
141
					</rng:oneOrMore>
142
					<rng:optional>
143
						<rng:attribute name="icon">
144
							<rng:data type="string"/>
145
						</rng:attribute>
146
					</rng:optional>
147
					<rng:optional>
148
						<rng:attribute name="priority">
149
							<rng:data type="integer"/>
150
						</rng:attribute>
151
					</rng:optional>
152
				</rng:group>
153
			</rng:choice>
154
		</rng:element>
155
	</rng:define>
156
157
	<rng:define name="Command">
158
		<rng:element name="command">
159
			<a:documentation>Definition of UMC command mapping to Python functions.</a:documentation>
160
			<rng:zeroOrMore>
161
				<rng:element name="description">
162
					<rng:ref name="translated"/>
163
				</rng:element>
164
			</rng:zeroOrMore>
165
			<rng:optional>
166
				<rng:element name="return">
167
					<rng:attribute name="syntax">
168
						<rng:choice>
169
							<rng:value>Boolean</rng:value>
170
							<rng:value>Dictionary</rng:value>
171
							<rng:value>UCR-Variables</rng:value>
172
							<rng:value>umc-boolean</rng:value>
173
						</rng:choice>
174
					</rng:attribute>
175
				</rng:element>
176
			</rng:optional>
177
			<rng:attribute name="name">
178
				<rng:data type="string"/>
179
			</rng:attribute>
180
			<rng:attribute name="function">
181
				<rng:data type="string"/>
182
			</rng:attribute>
183
		</rng:element>
184
	</rng:define>
185
186
	<rng:define name="Categories">
187
		<rng:element name="categories">
188
			<a:documentation>Definition of UMC categories.</a:documentation>
189
			<rng:oneOrMore>
190
				<rng:element name="category">
191
					<rng:oneOrMore>
192
						<rng:element name="name">
193
							<rng:ref name="translated"/>
194
						</rng:element>
195
					</rng:oneOrMore>
196
					<rng:attribute name="priority">
197
						<rng:data type="integer"/>
198
					</rng:attribute>
199
					<rng:attribute name="id">
200
						<rng:ref name="category"/>
201
					</rng:attribute>
202
				</rng:element>
203
			</rng:oneOrMore>
204
		</rng:element>
205
	</rng:define>
206
207
</rng:grammar>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/data/umc-module.xml.example (-13 / +19 lines)
 Lines 1-16    Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<umc version="2.0">
2
<umc version="2.0">
3
  <module icon="ucr/module" version="2.0">
3
	<module id="ucr/module" icon="ucr/module" version="1.0" priority="42" translationId="umc-module">
4
	<name>Univention Configuration Registry</name>
4
		<name>Univention Configuration Registry</name>
5
	<name lang="de_DE">Univention Configuration Registry</name>
5
		<name lang="de_DE">Univention Configuration Registry</name>
6
	<description>Managing UCR variables</description>
6
		<description>Managing UCR variables</description>
7
	<description lang="de_DE">Verwaltung von UCR-Variablen</description>
7
		<description lang="de_DE">Verwaltung von UCR-Variablen</description>
8
	<command name="ucr/set" function="set">
8
		<flavor id="group/module" priority="42" icon="udm-group-module">
9
	  <description>Set UCR variables</description>
9
			<name>UDM Module</name>
10
	  <description lang="de_DE">Setzen von UCR-Variablen</description>
10
			<description>Module description</description>
11
	  <return>
11
		</flavor>
12
		<syntax type="umc-boolean"/>
12
		<flavor id="mail/mail" deactivated="yes"/>
13
	  </return>
13
		<categories>
14
	</command>
14
			<category name="system"/>
15
  </module>
15
		</categories>
16
		<command name="ucr/set" function="set">
17
			<description>Set UCR variables</description>
18
			<description lang="de_DE">Setzen von UCR-Variablen</description>
19
			<return syntax="umc-boolean"/>
20
		</command>
21
	</module>
16
</umc>
22
</umc>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/data/umc-module.xsd (-8 / +168 lines)
 Lines 1-8    Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version='1.0' encoding='utf-8'?>
2
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
2
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
3
  <xsd:element name="umc">
3
4
	<xsd:element name="module">
4
	<xs:annotation>
5
	  <xsd:attribute 
5
		<xs:documentation xml:lang='en'>
6
	</xsd:element>
6
			Univention Corporate Server Management Console definition.
7
  </xsd:element>
7
			Copyriught 2013 Univention GmbH.
8
</xsd:schema>
8
		</xs:documentation>
9
	</xs:annotation>
10
11
	<xs:complexType name='translated'>
12
		<xs:annotation>
13
			<xs:documentation xml:lang='en'>
14
				Translation to multiple languages.
15
			</xs:documentation>
16
		</xs:annotation>
17
		<xs:simpleContent>
18
			<xs:extension base='xs:string'>
19
				<xs:attribute name='lang' type='xs:language' use='optional'/>
20
			</xs:extension>
21
		</xs:simpleContent>
22
	</xs:complexType>
23
24
	<xs:simpleType name="version">
25
		<xs:annotation>
26
			<xs:documentation xml:lang='en'>
27
				Version string with major and minor number.
28
			</xs:documentation>
29
		</xs:annotation>
30
		<xs:restriction base="xs:string">
31
			<xs:pattern value="[0-9]+\.[0-9]+"/>
32
		</xs:restriction>
33
	</xs:simpleType>
34
35
	<xs:simpleType name="category">
36
		<xs:annotation>
37
			<xs:documentation xml:lang='en'>
38
				Category string.
39
			</xs:documentation>
40
		</xs:annotation>
41
		<xs:restriction base="xs:string"/>
42
	</xs:simpleType>
43
44
	<xs:element name='umc'>
45
		<xs:annotation>
46
			<xs:documentation xml:lang='en'>
47
				Top level element to define either UMC modules or categories.
48
			</xs:documentation>
49
		</xs:annotation>
50
		<xs:complexType>
51
			<xs:choice>
52
				<xs:element ref='module'/>
53
				<xs:element ref='categories'/>
54
			</xs:choice>
55
			<xs:attribute name='version' type='version' use='required' fixed='2.0'/>
56
		</xs:complexType>
57
	</xs:element>
58
59
	<xs:element name='module'>
60
		<xs:annotation>
61
			<xs:documentation xml:lang='en'>
62
				UMC module definition
63
			</xs:documentation>
64
		</xs:annotation>
65
		<xs:complexType>
66
			<xs:sequence>
67
				<xs:sequence minOccurs='0' maxOccurs='1'>
68
					<xs:element name='name' type='translated' maxOccurs='unbounded'/>
69
					<xs:element name='description' type='translated' maxOccurs='unbounded'/>
70
				</xs:sequence>
71
				<xs:element ref='flavor' minOccurs='0' maxOccurs='unbounded'/>
72
				<xs:element name='categories' minOccurs='0' maxOccurs='1'>
73
					<xs:complexType>
74
						<xs:sequence>
75
							<xs:element name='category' maxOccurs='unbounded'>
76
								<xs:complexType>
77
									<xs:attribute name='name' type='category' use='required'/>
78
								</xs:complexType>
79
							</xs:element>
80
						</xs:sequence>
81
					</xs:complexType>
82
				</xs:element>
83
				<xs:element ref='command' minOccurs='0' maxOccurs='unbounded'/>
84
			</xs:sequence>
85
			<xs:attribute name='id' type='xs:string' use='optional'/>
86
			<xs:attribute name='icon' type='xs:string' use='required'/>
87
			<xs:attribute name='priority' type='xs:integer' use='optional'/>
88
			<xs:attribute name='version' type='version' use='required' fixed='1.0'/>
89
			<xs:attribute name='translationId' type='xs:ID' use='optional'/>
90
		</xs:complexType>
91
	</xs:element>
92
93
	<xs:element name='flavor'>
94
		<xs:annotation>
95
			<xs:documentation xml:lang='en'>
96
				Definition of UDM modules.
97
			</xs:documentation>
98
		</xs:annotation>
99
		<xs:complexType>
100
			<xs:sequence minOccurs='0' maxOccurs='1'>
101
				<xs:element name='name' type='translated' maxOccurs='unbounded'/>
102
				<xs:element name='description' type='translated' maxOccurs='unbounded'/>
103
			</xs:sequence>
104
			<xs:attribute name='icon' type='xs:string' use='optional'/>
105
			<xs:attribute name='priority' type='xs:integer' use='optional'/>
106
			<xs:attribute name='id' type='xs:string' use='required'/>
107
			<xs:attribute name='deactivated' use='optional' default='no'>
108
				<xs:simpleType>
109
					<xs:restriction base='xs:string'>
110
						<xs:enumeration value='yes'/>
111
						<xs:enumeration value='no'/>
112
					</xs:restriction>
113
				</xs:simpleType>
114
			</xs:attribute>
115
		</xs:complexType>
116
	</xs:element>
117
118
	<xs:element name='command'>
119
		<xs:annotation>
120
			<xs:documentation xml:lang='en'>
121
				Definition of UMC command mapping to Python functions.
122
			</xs:documentation>
123
		</xs:annotation>
124
		<xs:complexType>
125
			<xs:sequence>
126
				<xs:element name='description' type='translated' minOccurs='0' maxOccurs='unbounded'/>
127
				<xs:element name='return' minOccurs='0' maxOccurs='1'>
128
					<xs:complexType>
129
						<xs:attribute name='syntax' use='required'>
130
							<xs:simpleType>
131
								<xs:restriction base='xs:string'>
132
									<xs:enumeration value='Boolean'/>
133
									<xs:enumeration value='Dictionary'/>
134
									<xs:enumeration value='UCR-Variables'/>
135
									<xs:enumeration value='umc-boolean'/>
136
								</xs:restriction>
137
							</xs:simpleType>
138
						</xs:attribute>
139
					</xs:complexType>
140
				</xs:element>
141
			</xs:sequence>
142
			<xs:attribute name='name' type='xs:string' use='required'/>
143
			<xs:attribute name='function' type='xs:string' use='required'/>
144
		</xs:complexType>
145
	</xs:element>
146
147
	<xs:element name='categories'>
148
		<xs:annotation>
149
			<xs:documentation xml:lang='en'>
150
				Definition of UMC categories.
151
			</xs:documentation>
152
		</xs:annotation>
153
		<xs:complexType>
154
			<xs:sequence>
155
				<xs:element name='category' maxOccurs='unbounded'>
156
					<xs:complexType>
157
						<xs:sequence>
158
							<xs:element name='name' type='translated' maxOccurs='unbounded'/>
159
						</xs:sequence>
160
						<xs:attribute name='priority' type='xs:integer' use='required'/>
161
						<xs:attribute name='id' type='category' use='required'/>
162
					</xs:complexType>
163
				</xs:element>
164
			</xs:sequence>
165
		</xs:complexType>
166
	</xs:element>
167
168
</xs:schema>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/debian/changelog (+8 lines)
 Lines 1-3    Link Here 
1
univention-management-console (5.0.62-3) UNRELEASED; urgency=low
2
3
  * Fix DTD and XSD for UMC module definition (Bug #00000)
4
  * Fix examples to be XML valid.
5
  * umc-create-module: Fix command line parsing.
6
7
 -- Philipp Hahn <hahn@univention.de>  Tue, 23 Apr 2013 21:10:02 +0200
8
1
univention-management-console (5.0.62-2) unstable; urgency=low
9
univention-management-console (5.0.62-2) unstable; urgency=low
2
10
3
  * Do not log UNIVENTION_DEBUG_{BEGIN, END} information (Bug #29603)
11
  * Do not log UNIVENTION_DEBUG_{BEGIN, END} information (Bug #29603)
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/dev/dh-umc-module-build (-29 / +35 lines)
 Lines 2-8    Link Here 
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
#
3
#
4
# Univention Configuration Registry
4
# Univention Configuration Registry
5
#  build UMC module
5
"""
6
Install UMC modules. It parses a RFC 822 file called
7
$(package).umc-modules and installs the specified components of a module
8
into the correct directories.
9
"""
6
#
10
#
7
# Copyright 2011-2012 Univention GmbH
11
# Copyright 2011-2012 Univention GmbH
8
#
12
#
 Lines 31-86    Link Here 
31
# /usr/share/common-licenses/AGPL-3; if not, see
35
# /usr/share/common-licenses/AGPL-3; if not, see
32
# <http://www.gnu.org/licenses/>.
36
# <http://www.gnu.org/licenses/>.
33
37
34
import os
35
import sys
38
import sys
36
from optparse import OptionParser
39
from optparse import OptionParser
37
40
38
import univention.debhelper as dh_ucs
41
import univention.debhelper as dh_ucs
42
import univention.dh_umc as dh_umc
39
43
40
try:
41
	sys.path.insert( 0, './dev' )
42
	import dh_umc
43
except BaseException, e:
44
	print 'warning:', str( e )
45
	import univention.dh_umc as dh_umc
46
47
"""Helps installing UMC modules. It parses a RFC 822 file called
48
$(package).umc-modules and installs the specified components of a module
49
into the correct directories."""
50
44
51
def do_package( package, core ):
45
def do_package(package, core):
46
	"""
47
	Compile translation files for package.
48
	"""
52
	try:
49
	try:
53
		modules = dh_umc.read_modules( package, core )
50
		modules = dh_umc.read_modules(package, core)
54
	except AttributeError, e:
51
	except AttributeError, ex:
55
		print >>sys.stderr, str( e )
52
		print >> sys.stderr, ex
56
		sys.exit( 1 )
53
		sys.exit(1)
57
54
58
	if not options.core:
55
	if not core:
59
		# build python PO files
56
		# build python PO files
60
		for module in modules:
57
		for module in modules:
61
			for po_file in module.python_po_files:
58
			for po_file in module.python_po_files:
62
				dh_umc.create_po_file( po_file, package, module.python_files )
59
				dh_umc.create_po_file(po_file, package, module.python_files)
63
				dh_umc.create_mo_file( po_file )
60
				dh_umc.create_mo_file(po_file )
64
61
65
		# build javascript PO files
62
		# build javascript PO files
66
		for module in modules:
63
		for module in modules:
67
			for po_file in module.js_po_files:
64
			for po_file in module.js_po_files:
68
				# using python as language seems to work better than perl
65
				# using python as language seems to work better than perl
69
				dh_umc.create_po_file( po_file, package, module.js_files, 'python' )
66
				dh_umc.create_po_file(po_file, package, module.js_files, 'python')
70
				dh_umc.create_json_file( po_file )
67
				dh_umc.create_json_file(po_file)
71
68
72
	# build xml PO files
69
	# build xml PO files
73
	for module in modules:
70
	for module in modules:
74
		for lang, po_file in module.xml_po_files:
71
		for lang, po_file in module.xml_po_files:
75
			dh_umc.module_xml2po( module, po_file, lang )
72
			dh_umc.module_xml2po(module, po_file, lang)
76
			dh_umc.create_mo_file( po_file )
73
			dh_umc.create_mo_file(po_file)
77
74
78
75
79
if __name__ == '__main__':
76
def main():
77
	"""
78
	Compile translation files for all packages.
79
	"""
80
	# parse all options
80
	# parse all options
81
	parser = OptionParser( usage = 'usage: %prog [--core]' )
81
	parser = OptionParser(usage='usage: %prog [--core]')
82
	parser.add_option( '-c', '--core', action = 'store_true', dest = 'core', help = 'If specified modules without javascript and python code are excepted' )
82
	parser.add_option('-c', '--core',
83
			action='store_true', dest='core',
84
			help='If specified modules without javascript and python code are excepted')
83
85
84
	( options, args ) = parser.parse_args()
86
	options, _args = parser.parse_args()
85
	for package in dh_ucs.binary_packages():
87
	for package in dh_ucs.binary_packages():
86
		do_package( package, options.core )
88
		do_package(package, options.core)
89
90
91
if __name__ == '__main__':
92
	main()
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/dev/dh-umc-module-install (-128 / +211 lines)
 Lines 2-8    Link Here 
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
#
3
#
4
# Univention Configuration Registry
4
# Univention Configuration Registry
5
#  install UMC module
5
"""
6
Install UMC modules. It parses a RFC 822 file called
7
$(package).umc-modules and installs the specified components of a module
8
into the correct directories.
9
"""
6
#
10
#
7
# Copyright 2011-2012 Univention GmbH
11
# Copyright 2011-2012 Univention GmbH
8
#
12
#
 Lines 36-187   import sys Link Here 
36
from optparse import OptionParser
40
from optparse import OptionParser
37
41
38
import univention.debhelper as dh_ucs
42
import univention.debhelper as dh_ucs
39
try:
43
import univention.dh_umc as dh_umc
40
	sys.path.insert( 0, './dev' )
41
	import dh_umc
42
except:
43
	import univention.dh_umc as dh_umc
44
44
45
"""Helps installing UMC modules. It parses a RFC 822 file called
46
$(package).umc-modules and installs the specified components of a module
47
into the correct directories."""
48
45
49
def do_package( package, core ):
46
def do_python(module, destdir):
50
	try:
47
	"""
51
		modules = dh_umc.read_modules( package, core )
48
	Copy Python module and translation.
52
	except AttributeError, e:
49
	"""
53
		print >>sys.stderr, str( e )
50
	# copy python module
54
		sys.exit( 1 )
51
	py_dir = os.path.join(destdir, 'usr', 'share', 'pyshared', 'univention',
52
			'management', 'console', 'modules', '%(Module)s' % module)
53
	dh_ucs.doIt('install', '-d', py_dir)
55
54
56
	if not modules:
55
	filename = None
56
	for filename in module.python_files:
57
		dh_ucs.doIt('install',
58
				'-m', '644',
59
				'-t', py_dir, filename)
60
	if filename is None:
61
		print >> sys.stderr, 'W: no python files found in %s' % (module.python_path,)
57
		return
62
		return
58
63
59
	for module in modules:
64
	# copy translation files (python)
60
		# prepare directory
65
	for lang in dh_umc.LANGUAGES:
61
		if not core:
66
		mo_dir = os.path.join(destdir, 'usr', 'share', 'locale', lang, 'LC_MESSAGES')
62
			dh_ucs.doIt( 'install', '-d', 'debian/%(package)s/usr/share/pyshared/univention/management/console/modules/%(Module)s' % module )
67
		dh_ucs.doIt('install', '-d', mo_dir)
63
			dh_ucs.doIt( 'install', '-d', 'debian/%(package)s/usr/share/univention-management-console/modules' % module )
68
		mo_file = os.path.join(module.python_path, '%s.mo' % lang)
64
			for lang in dh_umc.LANGUAGES:
69
		mo_dest = os.path.join(mo_dir, '%(package)s.mo' % module)
65
				module[ 'lang' ] = lang
70
		dh_ucs.doIt('install',
66
				dh_ucs.doIt( 'install', '-d', 'debian/%(package)s/usr/share/locale/%(lang)s/LC_MESSAGES' % module )
71
				'-m', '644',
67
				dh_ucs.doIt( 'install', '-d', 'debian/%(package)s/usr/share/univention-management-console-frontend/js/umc/modules/i18n/%(lang)s' % module )
72
				'-D', mo_file, mo_dest)
68
73
69
		if module.xml_categories:
70
			dh_ucs.doIt( 'install', '-d', 'debian/%(package)s/usr/share/univention-management-console/categories' % module )
71
		else:
72
			print >>sys.stderr, 'info: no category definition file'
73
74
74
		if module.icons is not None and not os.path.isdir( module.icons ):
75
def do_javascript(module, destdir):
75
			print >>sys.stderr, 'error: could not find icon directory %s' % module.icons
76
	"""
77
	Copy javaScript module and translation.
78
	"""
79
	# copy javascript files
80
	js_base = os.path.join(destdir, 'usr', 'share',
81
			'univention-management-console-frontend', 'js', 'umc', 'modules')
76
82
77
		if not core:
83
	filename = None
78
			# copy python module
84
	for filename in module.js_files:
79
			install_python = []
85
		js_dest = os.path.join(js_base, filename[len(module.js_path):])
80
			for entry in os.listdir( module.python_path ):
86
		dh_ucs.doIt('install',
81
				filename = os.path.join( module.python_path, entry )
87
				'-m', '644',
82
				if os.path.isfile( filename ) and entry.endswith( '.py' ):
88
				'-D', filename, js_dest)
83
					install_python.append( filename )
89
	if filename is None:
84
			if not install_python:
90
		print >> sys.stderr, 'W: no javascript files found in %s' % (module.js_path,)
85
				print >>sys.stderr, 'error: no python files found in %s' % module.python_path
91
		return
86
				sys,exit( 1 )
92
87
			install_python.append( 'debian/%(package)s/usr/share/pyshared/univention/management/console/modules/%(Module)s' % module )
93
	# copy translation files (javascript)
88
			install_python_command = ['install', '-m', '644']
94
	for lang in dh_umc.LANGUAGES:
89
			install_python_command.extend(install_python)
95
		json_dir = os.path.join(js_base, 'i18n', lang)
90
			dh_ucs.doIt( *install_python_command )
96
		dh_ucs.doIt('install', '-d', json_dir)
91
97
		json_file = os.path.join(module.js_path, '%s.json' % (lang,))
92
			# copy javascript files
98
		json_dest = os.path.join(json_dir, '%(Module)s.json' % module)
93
			for srcFile in module.js_files:
99
		dh_ucs.doIt('install',
94
				# get destination path
100
				'-m', '644',
95
				destFile = 'debian/%s/usr/share/univention-management-console-frontend/js/umc/modules/%s' % ( package, srcFile[len(module.js_path):] )
101
				'-D', json_file, json_dest)
96
102
97
				# check whether we need to create the destination dir
103
98
				destDir = os.path.dirname(destFile)
104
def do_html(module, destdir):
99
				if not os.path.exists( destDir ):
105
	"""
100
					dh_ucs.doIt( 'install', '-d', destDir )
106
	Copy HTML files.
101
107
	"""
102
				# copy the .js file
108
	html_base = os.path.join(destdir, 'usr', 'share',
103
				dh_ucs.doIt( 'install', '-m', '644', srcFile, destFile )
109
			'univention-management-console-frontend', 'js', 'umc', 'modules')
104
110
105
			# copy html files
111
	for filename in module.html_files:
106
			for srcFile in module.html_files:
112
		html_dest = os.path.join(html_base, filename[len(module.js_path):])
107
				# get destination path
113
		dh_ucs.doIt('install',
108
				destFile = 'debian/%s/usr/share/univention-management-console-frontend/js/umc/modules/%s' % ( package, srcFile[len(module.js_path):] )
114
				'-m', '644',
109
				# copy the .html file
115
				'-D', filename, html_dest)
110
				dh_ucs.doIt( 'install', srcFile, destFile )
116
111
117
112
			# copy XML definitions
118
def do_xml(module, destdir):
113
			dh_ucs.doIt( 'install', module.xml_definition, 'debian/%(package)s/usr/share/univention-management-console/modules' % module )
119
	"""
114
120
	Copy XML definition and translation.
115
		if module.xml_categories:
121
	"""
116
			dh_ucs.doIt( 'install', module.xml_categories, 'debian/%(package)s/usr/share/univention-management-console/categories' % module )
122
	# copy XML definitions
123
	xml_dir = os.path.join(destdir, 'usr', 'share',
124
			'univention-management-console', 'modules')
125
	dh_ucs.doIt('install',
126
			'-d', xml_dir)
127
	dh_ucs.doIt('install',
128
			'-m', '644',
129
			'-t', xml_dir, module.xml_definition)
130
131
	# copy translation files (xml)
132
	for lang in dh_umc.LANGUAGES:
133
		mo_dir = os.path.join(destdir, 'usr', 'share',
134
				'univention-management-console', 'i18n', lang)
135
		dh_ucs.doIt('install', '-d', mo_dir)
136
		mo_file = os.path.join(os.path.dirname(module.xml_definition),
137
				'%s.mo' % (lang,))
138
		mo_dest = os.path.join(mo_dir, '%(Module)s.mo' % module)
139
		dh_ucs.doIt('install',
140
				'-m', '644',
141
				'-D', mo_file, mo_dest)
142
143
144
def do_categories(module, destdir):
145
	"""
146
	Copy XML categories.
147
	"""
148
	if not module.xml_categories:
149
		print >> sys.stderr, 'I: no category definition file'
150
		return
151
152
	# copy XML categories
153
	cat_dir = os.path.join(destdir, 'usr', 'share',
154
			'univention-management-console', 'categories')
155
	dh_ucs.doIt('install',
156
			'-d', cat_dir)
157
	dh_ucs.doIt('install',
158
			'-m', '644',
159
			'-t', cat_dir, module.xml_categories)
117
160
118
		if not core:
161
119
			# copy translation files (python)
162
def do_icons(module, destdir):
120
			for lang in dh_umc.LANGUAGES:
163
	"""
121
				mo_file = os.path.join( module.python_path, '%s.mo' % lang )
164
	Copy icons.
122
				module[ 'lang' ] = lang
165
	"""
123
				dh_ucs.doIt( 'install', mo_file, 'debian/%(package)s/usr/share/locale/%(lang)s/LC_MESSAGES/%(package)s.mo' % module )
166
	if module.icons is None:
124
167
		return
125
			# copy translation files (javascript)
168
	if not os.path.isdir(module.icons):
126
			for lang in dh_umc.LANGUAGES:
169
		print >> sys.stderr, 'W: could not find icon directory %s' % (module.icons,)
127
				json_file = os.path.join( module.js_path, '%s.json' % lang )
170
		return
128
				module[ 'lang' ] = lang
171
129
				dh_ucs.doIt( 'install', json_file, 'debian/%(package)s/usr/share/univention-management-console-frontend/js/umc/modules/i18n/%(lang)s/%(Module)s.json' % module )
172
	# copy icons
130
173
	icon_base = os.path.join(destdir, 'usr', 'share',
131
		# copy translation files (xml)
174
			'univention-management-console-frontend', 'js', 'dijit', 'themes',
132
		for lang in dh_umc.LANGUAGES:
175
			'umc', 'icons')
133
			mo_file = os.path.join( os.path.dirname( module.xml_definition ), '%s.mo' % lang )
176
	for dirname, dirs, files in os.walk(module.icons):
134
			module[ 'lang' ] = lang
177
		if '.svn' in dirs:
135
			dh_ucs.doIt( 'install', '-D', mo_file, 'debian/%(package)s/usr/share/univention-management-console/i18n/%(lang)s/%(Module)s.mo' % module )
178
			dirs.remove( '.svn' )
136
179
		icon_dir = os.path.join(icon_base, dirname[len(module.icons):])
137
		# join script
180
		dh_ucs.doIt('install',
138
		join_script = '%s.inst' % package
181
				'-d', icon_dir)
139
		join_dest = 'debian/%s/usr/lib/univention-install' % package
182
		for icon in files:
140
		join_exists = False
183
			dh_ucs.doIt('install',
141
		for filename in os.listdir( '.' ):
184
					'-m', '644',
142
			if filename.endswith( join_script ):
185
					'-t', icon_dir, os.path.join(dirname, icon))
143
				join_script = filename
186
144
				if not os.path.exists( join_dest ):
187
145
					dh_ucs.doIt( 'install', '-d', join_dest )
188
def do_join(package, destdir):
146
				dh_ucs.doIt( 'install', '-t', join_dest, '-m', '755', filename )
189
	"""
147
				join_exists = True
190
	Copy join script.
148
				break
191
	"""
192
	join_dir = os.path.join(destdir, 'usr', 'lib', 'univention-install')
193
	for filename in os.listdir('.'):
194
		if filename.endswith('%s.inst' % (package,)):
195
			dh_ucs.doIt('install',
196
					'-d', join_dir)
197
			dh_ucs.doIt('install',
198
					'-m', '755',
199
					'-t', join_dir, filename)
200
			return filename
201
	return None
202
203
204
def do_package(package, core):
205
	"""
206
	Install files for one binary package.
207
	"""
208
	try:
209
		modules = dh_umc.read_modules(package, core)
210
	except AttributeError, ex:
211
		print >> sys.stderr, ex
212
		sys.exit(1)
213
214
	base = os.path.join('debian', package)
215
216
	for module in modules:
217
		do_xml(module, base)
218
		do_categories(module, base)
149
219
150
		if not core:
220
		if not core:
151
			# copy icons
221
			do_python(module, base)
152
			for dirname, dirs, files in os.walk( module.icons ):
222
			do_javascript(module, base)
153
				if '.svn' in dirs:
223
			do_html(module, base)
154
					dirs.remove( '.svn' )
224
			do_icons(module, base)
155
				dest = 'debian/%s/usr/share/univention-management-console-frontend/js/dijit/themes/umc/icons/%s' % ( package, dirname[ len( module.icons ) : ] )
225
156
				if not os.path.exists( dest ):
226
	join_script = do_join(package, base)
157
					dh_ucs.doIt( 'install', '-d', dest )
227
158
				for icon in files:
228
	f_postinst = open(base + '.postinst.debhelper', 'a')
159
					dh_ucs.doIt( 'install', '-t', dest, '-m', '644', os.path.join( dirname, icon ) )
229
	f_postinst.write('# generated by dh-umc-module-install\n')
160
230
	if join_script:
161
		f_postinst = open( os.path.join( 'debian', package + '.postinst.debhelper' ), 'a' )
231
		f_postinst.write('''\
162
		if join_exists:
163
			f_postinst.write( '''
164
# run join script on DC master and DC backup
232
# run join script on DC master and DC backup
165
. /usr/share/univention-lib/base.sh
233
. /usr/share/univention-lib/base.sh
166
call_joinscript %s || true
234
call_joinscript %s || true
167
''' % join_script )
235
''' % (join_script,))
168
		f_postinst.write( 'invoke-rc.d univention-management-console-server reload || true\n' )
236
	f_postinst.write('invoke-rc.d univention-management-console-server reload '
169
		f_postinst.write( '''
237
			'|| true\n')
238
	f_postinst.write('''\
170
# generate a new hash for the UMC frontend in order to avoid caching problems
239
# generate a new hash for the UMC frontend in order to avoid caching problems
171
. /usr/share/univention-lib/umc.sh
240
. /usr/share/univention-lib/umc.sh
172
umc_frontend_new_hash
241
umc_frontend_new_hash
173
''' )
242
''')
174
		f_postinst.close()
243
	f_postinst.close()
175
244
176
		f_prerm = open( os.path.join( 'debian', package + '.prerm.debhelper' ), 'a' )
245
	f_postrm = open(base + '.prerm.debhelper', 'a')
177
		f_prerm.write( 'invoke-rc.d univention-management-console-server reload || true\n' )
246
	f_postrm.write('# generated by dh-umc-module-install\n')
178
		f_prerm.close()
247
	f_postrm.write('invoke-rc.d univention-management-console-server reload '
248
			'|| true\n')
249
	f_postrm.close()
179
250
180
if __name__ == '__main__':
251
252
def main():
253
	"""
254
	Install UMC modules. It parses a RFC 822 file called
255
	$(package).umc-modules and installs the specified components of a module
256
	into the correct directories.
257
	"""
181
	# parse all options
258
	# parse all options
182
	parser = OptionParser( usage = 'usage: %prog [--core]' )
259
	parser = OptionParser(usage='usage: %prog [--core]')
183
	parser.add_option( '-c', '--core', action = 'store_true', dest = 'core', help = 'If specified modules without javascript and python code are excepted' )
260
	parser.add_option('-c', '--core',
261
			action='store_true', dest='core',
262
			help='If specified modules without javascript and python code are excepted')
184
263
185
	( options, args ) = parser.parse_args()
264
	options, _args = parser.parse_args()
186
	for package in dh_ucs.binary_packages():
265
	for package in dh_ucs.binary_packages():
187
		do_package( package, options.core )
266
		do_package(package, options.core)
267
268
269
if __name__ == '__main__':
270
	main()
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/dev/dh-umc-translate (-37 / +32 lines)
 Lines 2-8    Link Here 
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
#
3
#
4
# Univention Configuration Registry
4
# Univention Configuration Registry
5
#  build UMC module
5
"""
6
Tool creates .json files for translation using gettext.
7
"""
6
#
8
#
7
# Copyright 2011-2012 Univention GmbH
9
# Copyright 2011-2012 Univention GmbH
8
#
10
#
 Lines 32-63    Link Here 
32
# <http://www.gnu.org/licenses/>.
34
# <http://www.gnu.org/licenses/>.
33
35
34
import os
36
import os
35
import sys
36
37
37
from optparse import OptionParser
38
from optparse import OptionParser
38
39
39
import univention.dh_umc as dh_umc
40
import univention.dh_umc as dh_umc
40
import univention.debhelper as dh_ucs
41
41
42
"""Tool creates .json files for translation using gettext."""
43
42
44
def main():
43
def main():
44
	"""
45
	Tool creates .json files for translation using gettext.
46
	"""
45
	# parse all options
47
	# parse all options
46
	parser = OptionParser( usage = 'usage: %prog --package <packageName> --outdir <outDir> [options] <jsFile> ...' )
48
	parser = OptionParser(usage='usage: %prog --package <packageName> --outdir <outDir> [options] <jsFile> ...')
47
	parser.add_option( '-p', '--package', action = 'store',
49
	parser.add_option('-p', '--package',
48
					   dest = 'package',
50
			action='store', dest='package',
49
					   help = 'Specifies the package name which is needed for the creation of .po files. (Mandatory)' )
51
			help='Specifies the package name which is needed for the creation of .po files. (Mandatory)')
50
	parser.add_option( '-t', '--type', action = 'store', type = 'choice', choices = ['json', 'mo', 'po', 'core'],
52
	parser.add_option('-t', '--type',
51
					   dest = 'type', default = 'json',
53
			action='store', type='choice', choices=('json', 'mo', 'po',),
52
					   help = 'Type of the final output file; note that "json" and "mo" will both also create .po files [%default]')
54
			dest='type', default='json',
53
	parser.add_option( '-o', '--outdir', action = 'store',
55
			help='Type of the final output file; note that "json" and "mo" will both also create .po files [%default]')
54
					   dest = 'outdir',
56
	parser.add_option('-o', '--outdir',
55
					   help = 'Specifies the output directory where translations from all js files are saved to. (Mandatory)')
57
			action='store', dest='outdir',
56
	parser.add_option( '-l', '--lang', action = 'append',
58
			help='Specifies the output directory where translations from all js files are saved to. (Mandatory)')
57
					   dest = 'lang',
59
	parser.add_option('-l', '--lang',
58
					   help = 'Specifies the languages that are processed (default: de)')
60
			action='append', dest='lang',
61
			help='Specifies the languages that are processed (default: de)')
59
62
60
	( options, args ) = parser.parse_args()
63
	options, args = parser.parse_args()
61
64
62
#	# make sure we have javascript files
65
#	# make sure we have javascript files
63
#	if not len(args):
66
#	if not len(args):
 Lines 70-105   def main(): Link Here 
70
73
71
	# make sure we have enough parameters
74
	# make sure we have enough parameters
72
	if not options.package:
75
	if not options.package:
73
		print '\nYou need to specify a package-name (--package) as well as a list of JavaScript files to process!\n'
76
		parser.error('You need to specify a package-name (--package) as well as a list of JavaScript files to process!')
74
		sys.exit(1)
75
77
76
	# make sure that we have an output file specified
78
	# make sure that we have an output file specified
77
	if not options.outdir:
79
	if not options.outdir:
78
		print '\nYou need to specify an output directory (--outdir)!\n'
80
		parser.error('You need to specify an output directory (--outdir)!')
79
		sys.exit(1)
80
81
81
	# set the po/mo/json file names and the correct function for generating the
82
	# set the po/mo/json file names and the correct function for generating the
82
	# final output
83
	# final output
83
	po_file = '%s/%%s.po' % options.outdir
84
	create_final_output = {
84
	create_final_output = lambda x: None
85
			'json': dh_umc.create_json_file,
85
	if 'json' == options.type:
86
			'mo': dh_umc.create_mo_file,
86
		# output is json
87
			'po': lambda x: None,
87
		create_final_output = dh_umc.create_json_file
88
			}[options.type]
88
	elif 'mo' == options.type:
89
		# output is mo
90
		create_final_output = dh_umc.create_mo_file
91
	elif 'po' != options.type:
92
		# invalid output type
93
		print '\nThe output type needs to be one of the following: ".json", ".mo", ".po"!\n'
94
		sys.exit(1)
95
89
96
	# build translation files
90
	# build translation files
97
	for lang in dh_umc.LANGUAGES:
91
	for lang in dh_umc.LANGUAGES:
98
		ipo_file = po_file % lang
92
		ipo_file = os.path.join(options.outdir, '%s.po' % (lang,))
99
		if len(args):
93
		if len(args):
100
			# only re-create po files if javascript files are given
94
			# only re-create po files if javascript files are given
101
			dh_umc.create_po_file( ipo_file, options.package, args)
95
			dh_umc.create_po_file(ipo_file, options.package, args)
102
		create_final_output( ipo_file)
96
		create_final_output(ipo_file)
97
103
98
104
if __name__ == '__main__':
99
if __name__ == '__main__':
105
	main()
100
	main()
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/dev/dh_umc.py (-141 / +201 lines)
 Lines 2-8    Link Here 
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
#
3
#
4
# Univention Configuration Registry
4
# Univention Configuration Registry
5
#  build UMC module
5
"""
6
Each module definition contains the following entries:
7
8
 Module: The internal name of the module
9
 Python: A directory containing the python module. There must be a subdirectory named like the internal name of the module.
10
 Definition: The XML definition of the module
11
 Javascript: The directory of the javascript code. In this directory must be a a file called <Module>.js
12
 Category: The XML definition of additional categories
13
 Icons: A directory containing the icons used by the module. The
14
   directory structure must follow the following pattern
15
   <weight>x<height>/<icon>.(png|gif)
16
17
The entry Category is optional.
18
19
Example:
20
 Module: ucr
21
 Python: umc/module
22
 Definition: umc/ucr.xml
23
 Javascript: umc/js
24
 Category: umc/categories/ucr.xml
25
 Icons: umc/icons
26
"""
27
6
#
28
#
7
# Copyright 2011-2012 Univention GmbH
29
# Copyright 2011-2012 Univention GmbH
8
#
30
#
 Lines 48-54   JAVASCRIPT = 'Javascript' Link Here 
48
CATEGORY = 'Category'
70
CATEGORY = 'Category'
49
ICONS = 'Icons'
71
ICONS = 'Icons'
50
72
51
LANGUAGES = ( 'de', )
73
LANGUAGES = ('de',)
52
74
53
PO_HEADER = 'This file is auto-generated by the dh-umc tools and should not be edited!'
75
PO_HEADER = 'This file is auto-generated by the dh-umc tools and should not be edited!'
54
PO_METADATA = {
76
PO_METADATA = {
 Lines 64-286   PO_METADATA = { Link Here 
64
	'Content-Transfer-Encoding' : '8bit'
86
	'Content-Transfer-Encoding' : '8bit'
65
	}
87
	}
66
88
67
"""Each module definition contains the following entries:
68
89
69
 Module: The internal name of the module
90
class UMC_Module(dict):
70
 Python: A directory containing the python module. There must be a subdirectory named like the internal name of the module.
91
	"""
71
 Definition: The XML definition of the module
92
	Container for UMC module definition.
72
 Javascript: The directory of the javascript code. In this directory must be a a file called <Module>.js
93
	"""
73
 Category: The XML definition of additional categories
74
 Icons: A directory containing the icons used by the module. The
75
   directory structure must follow the following pattern
76
   <weight>x<height>/<icon>.(png|gif)
77
94
78
The entry Category is optional.
95
	def __init__(self, *args):
79
96
		dict.__init__(self, *args)
80
Example:
97
		for key in (MODULE, PYTHON, JAVASCRIPT, DEFINITION, CATEGORY, ICONS):
81
 Module: ucr
98
			if key in self and self[key]:
82
 Python: umc/module
99
				self[key] = self[key][0]
83
 Definition: umc/ucr.xml
84
 Javascript: umc/js
85
 Category: umc/categories/ucr.xml
86
 Icons: umc/icons
87
"""
88
89
class UMC_Module( dict ):
90
	def __init__( self, *args ):
91
		dict.__init__( self, *args )
92
		for key in ( MODULE, PYTHON, JAVASCRIPT, DEFINITION, CATEGORY, ICONS ):
93
			if key in self and self[ key ]:
94
				self[ key ] = self[ key ][ 0 ]
95
100
96
	@property
101
	@property
97
	def package( self ):
102
	def package(self):
98
		return self.get( 'package' )
103
		"""
104
		Return the name of the Debian binary package.
105
		"""
106
		return self.get('package')
99
107
100
	@property
108
	@property
101
	def python_path( self ):
109
	def python_path( self ):
110
		"""
111
		Return path to Python UMC directory.
112
		"""
102
		return '%(Python)s/%(Module)s/' % self
113
		return '%(Python)s/%(Module)s/' % self
103
114
104
	@property
115
	@property
105
	def js_path( self ):
116
	def js_path( self ):
117
		"""
118
		Return path to JavaScript UMC directory.
119
		"""
106
		return '%(Javascript)s/' % self
120
		return '%(Javascript)s/' % self
107
121
108
	@property
122
	@property
109
	def js_module_file( self ):
123
	def js_module_file( self ):
124
		"""
125
		Return path to main JavaScript file.
126
		"""
110
		return '%(Javascript)s/%(Module)s.js' % self
127
		return '%(Javascript)s/%(Module)s.js' % self
111
128
112
	def iter_files( self, suffix ):
129
	@staticmethod
113
		for dirname, dirs, files in os.walk( self.js_path ):
130
	def _iter_files(base, suffix):
131
		"""
132
		Iterate over all files below base ending with suffix.
133
		"""
134
		for dirname, dirs, files in os.walk(base):
114
			# ignore .svn directories
135
			# ignore .svn directories
115
			if '.svn' in dirs:
136
			if '.svn' in dirs:
116
				dirs.remove( '.svn' )
137
				dirs.remove('.svn')
117
			# we are only interested in .js files
138
			# we are only interested in .js files
118
			for ifile in files:
139
			for ifile in files:
119
				if ifile.endswith( suffix ):
140
				if ifile.endswith(suffix):
120
					yield os.path.join(dirname, ifile)
141
					yield os.path.join(dirname, ifile)
121
142
122
	@property
143
	@property
123
	def js_files( self ):
144
	def js_files(self):
124
		return self.iter_files( '.js' )
145
		"""
125
		# for dirname, dirs, files in os.walk( self.js_path ):
146
		Iterate over all JavaScript UMC files.
126
		# 	# ignore .svn directories
147
		"""
127
		# 	if '.svn' in dirs:
148
		return UMC_Module._iter_files(self.js_path, '.js')
128
		# 		dirs.remove( '.svn' )
129
		# 	# we are only interested in .js files
130
		# 	for ifile in files:
131
		# 		if ifile.endswith('.js'):
132
		# 			yield os.path.join(dirname, ifile)
133
149
134
	@property
150
	@property
135
	def html_files( self ):
151
	def html_files(self):
136
		return self.iter_files( '.html' )
152
		"""
137
		# for dirname, dirs, files in os.walk( self.js_path ):
153
		Iterate over all JavaScript HTML files.
138
		# 	# ignore .svn directories
154
		"""
139
		# 	if '.svn' in dirs:
155
		return UMC_Module._iter_files(self.js_path, '.html')
140
		# 		dirs.remove( '.svn' )
141
		# 	# we are only interested in .js files
142
		# 	for ifile in files:
143
		# 		if ifile.endswith('.html'):
144
		# 			yield os.path.join(dirname, ifile)
145
156
146
	@property
157
	@property
147
	def module_name( self ):
158
	def module_name(self):
148
		return self.__getitem__( MODULE )
159
		"""
160
		Return the name of the UMC module.
161
		"""
162
		return self.__getitem__(MODULE)
149
163
150
	@property
164
	@property
151
	def xml_definition( self ):
165
	def xml_definition(self):
152
		return self.get( DEFINITION )
166
		"""
167
		Return the path to the XML UMC definition.
168
		"""
169
		return self.get(DEFINITION)
153
170
154
	@property
171
	@property
155
	def xml_categories( self ):
172
	def xml_categories(self):
173
		"""
174
		Return the path to the XML file defining categories.
175
		"""
156
		if CATEGORY in self:
176
		if CATEGORY in self:
157
			return self.get( CATEGORY, '' )
177
			return self.get(CATEGORY, '')
158
178
159
	@property
179
	@property
160
	def python_files( self ):
180
	def python_files(self):
161
		for filename in os.listdir( self.python_path ):
181
		"""
162
			if not filename.endswith( '.py' ):
182
		Iterate over all Python UMC files.
163
				continue
183
		"""
164
			yield os.path.join( self.python_path, filename )
184
		return UMC_Module._iter_files(self.python_path, '.py')
165
185
166
	@property
186
	@property
167
	def python_po_files( self ):
187
	def python_po_files(self):
188
		"""
189
		Iterate over all Python UMC message catalogs.
190
		"""
168
		path = '%(Python)s/%(Module)s/' % self
191
		path = '%(Python)s/%(Module)s/' % self
169
		for lang in LANGUAGES:
192
		for lang in LANGUAGES:
170
			yield os.path.join( path, '%s.po' % lang )
193
			yield os.path.join( path, '%s.po' % lang )
171
194
172
	@property
195
	@property
173
	def js_po_files( self ):
196
	def js_po_files( self ):
197
		"""
198
		Iterate over all JavaScript UMC message catalogs.
199
		"""
174
		for lang in LANGUAGES:
200
		for lang in LANGUAGES:
175
			yield os.path.join( self.__getitem__( JAVASCRIPT ), '%s.po' % lang )
201
			yield os.path.join( self.__getitem__( JAVASCRIPT ), '%s.po' % lang )
176
202
177
	@property
203
	@property
178
	def xml_po_files( self ):
204
	def xml_po_files(self):
179
		if self.xml_definition is None: return
205
		"""
180
		dirpath = os.path.dirname( self.xml_definition )
206
		Iterate over all XML UMC message catalogs.
207
		"""
208
		if self.xml_definition is None:
209
			return
210
		dirpath = os.path.dirname(self.xml_definition)
181
		for lang in LANGUAGES:
211
		for lang in LANGUAGES:
182
			yield ( lang, os.path.join( dirpath, '%s.po' % lang ) )
212
			yield (lang, os.path.join(dirpath, '%s.po' % lang))
183
213
184
	@property
214
	@property
185
	def icons( self ):
215
	def icons(self):
186
		return self.get( ICONS )
216
		"""
217
		Return path to UMC icon directory.
218
		"""
219
		return self.get(ICONS)
220
187
221
188
def read_modules( package, core = False ):
222
def read_modules(package, core=False):
223
	"""
224
	Read UMC module definition from debian/<package>.umc-modules.
225
	"""
189
	modules = []
226
	modules = []
190
227
191
	file_umc_module = os.path.join( 'debian/', package + '.umc-modules' )
228
	file_umc_module = os.path.join('debian', package + '.umc-modules')
192
229
193
	if not os.path.isfile( file_umc_module ):
230
	if not os.path.isfile(file_umc_module):
194
		return modules
231
		return modules
195
232
196
	f_umc_module = open( file_umc_module, 'r' )
233
	f_umc_module = open(file_umc_module, 'r')
197
234
198
	for item in dh_ucs.parseRfc822( f_umc_module.read() ):
235
	for item in dh_ucs.parseRfc822(f_umc_module.read()):
199
		# required fields
236
		# required fields
200
		if not core:
237
		if not core:
201
			for required in ( MODULE, PYTHON, DEFINITION, JAVASCRIPT ):
238
			for required in (MODULE, PYTHON, DEFINITION, JAVASCRIPT):
202
				if not required in item or not item[ required ]:
239
				if not required in item or not item[required]:
203
					raise AttributeError( 'UMC module definition incomplete. key %s missing' % required )
240
					raise AttributeError('UMC module definition incomplete. key %s missing' % (required,))
204
241
205
		# single values
242
		# single values
206
		item[ 'package' ] = package
243
		item['package'] = package
207
		module = UMC_Module( item )
244
		module = UMC_Module(item)
208
		if core:
245
		if core:
209
			if module.module_name != 'umc-core' or not module.xml_categories:
246
			if module.module_name != 'umc-core' or not module.xml_categories:
210
				raise ValueError( 'Module definition does not match core module' )
247
				raise ValueError( 'Module definition does not match core module' )
211
		modules.append( module )
248
		modules.append(module)
249
250
	f_umc_module.close()
212
251
213
	return modules
252
	return modules
214
253
215
def _appendPoEntry( poFile, xmlEntry ):
216
	"""Helper function to access text property of XML elements and to find the
217
	corresponding po-entry."""
218
	if xmlEntry != None:
219
		poFile.append( polib.POEntry( msgid = xmlEntry.text, msgstr = '' ) )
220
254
221
def module_xml2po( module, po_file, language ):
255
def module_xml2po(module, po_file, language):
222
	"""Create a PO file the XML definition of an UMC module"""
256
	"""Create a PO file the XML definition of an UMC module"""
223
	message_po = '%s/messages.po' % ( os.path.dirname( po_file ) or '.' )
257
	message_pot = '%s/messages.pot' % (os.path.dirname(po_file) or '.',)
224
258
225
	po = polib.POFile()
259
	pot = polib.POFile()
226
	po.header = PO_HEADER
260
	pot.header = PO_HEADER
227
	po.metadata = copy.copy( PO_METADATA )
261
	pot.metadata = copy.copy(PO_METADATA)
228
	po.metadata[ 'Project-Id-Version' ] = module.package
262
	pot.metadata['Project-Id-Version'] = module.package
229
	po.metadata[ 'POT-Creation-Date' ] = formatdate( localtime = True )
263
	pot.metadata['POT-Creation-Date'] = formatdate(localtime=True)
230
	po.metadata[ 'Language' ] = language
264
	pot.metadata['Language'] = language
231
265
232
	if module.xml_definition and os.path.isfile( module.xml_definition ):
266
	def _append_po_entry(xml_entry):
233
		tree = ET.ElementTree( file = module.xml_definition )
267
		"""Helper function to access text property of XML elements and to find the
234
		_appendPoEntry( po, tree.find( 'module/name' ) )
268
		corresponding po-entry."""
235
		_appendPoEntry( po, tree.find( 'module/description' ) )
269
		if xml_entry is not None:
236
		for flavor in tree.findall( 'module/flavor' ):
270
			pot.append(polib.POEntry(msgid=xml_entry.text, msgstr=''))
237
			_appendPoEntry( po, flavor.find( 'name' ) )
271
238
			_appendPoEntry( po, flavor.find( 'description' ) )
272
	if module.xml_definition and os.path.isfile(module.xml_definition):
239
273
		tree = ET.ElementTree(file=module.xml_definition)
240
	if module.xml_categories and os.path.isfile( module.xml_categories ):
274
		_append_po_entry(tree.find('module/name'))
241
		tree = ET.ElementTree( file = module.xml_categories )
275
		_append_po_entry(tree.find('module/description'))
242
		for cat in tree.findall( 'categories/category' ):
276
		for flavor in tree.findall('module/flavor'):
243
			_appendPoEntry( po, cat.find( 'name' ) )
277
			_append_po_entry(flavor.find('name'))
244
278
			_append_po_entry(flavor.find('description'))
245
	po.save( message_po )
279
246
	if os.path.isfile( po_file ):
280
	if module.xml_categories and os.path.isfile(module.xml_categories):
247
		dh_ucs.doIt( 'msgmerge', '--update', '--sort-output', po_file, message_po )
281
		tree = ET.ElementTree(file=module.xml_categories)
248
		if os.path.isfile( message_po ):
282
		for cat in tree.findall('categories/category'):
249
			os.unlink( message_po )
283
			_append_po_entry(cat.find('name'))
284
285
	pot.save(message_pot)
286
287
	if os.path.isfile(po_file):
288
		dh_ucs.doIt('msgmerge', '--update', '--sort-output', po_file, message_pot)
289
		if os.path.isfile(message_pot):
290
			os.unlink(message_pot)
250
	else:
291
	else:
251
		dh_ucs.doIt( 'mv', message_po, po_file )
292
		dh_ucs.doIt('mv', message_pot, po_file)
293
252
294
253
def create_po_file( po_file, package, files, language = 'python' ):
295
def create_po_file(po_file, package, files, language='python'):
254
	"""Create a PO file for a defined set of files"""
296
	"""Create a PO file for a defined set of files"""
255
	message_po = '%s/messages.po' % ( os.path.dirname( po_file ) or '.' )
297
	message_pot = '%s/messages.pot' % (os.path.dirname(po_file) or '.',)
256
298
257
	if os.path.isfile( message_po ):
299
	if os.path.isfile(message_pot):
258
		os.unlink( message_po )
300
		os.unlink(message_pot)
259
	if isinstance( files, basestring ):
301
	if isinstance(files, basestring):
260
		files = [ files ]
302
		files = [files]
261
	dh_ucs.doIt( 'xgettext', '--force-po', '--from-code=UTF-8', '--sort-output', '--package-name=%s' % package, '--msgid-bugs-address=packages@univention.de', '--copyright-holder=Univention GmbH', '--language', language, '-o', message_po, *files )
303
	dh_ucs.doIt('xgettext',
262
	po = polib.pofile( message_po )
304
			'--force-po',
263
	po.header = PO_HEADER
305
			'--from-code=UTF-8',
264
	po.metadata[ 'Content-Type' ] = 'text/plain; charset=UTF-8'
306
			'--sort-output',
265
	po.save()
307
			'--package-name=%s' % (package,),
266
	if os.path.isfile( po_file ):
308
			'--msgid-bugs-address=packages@univention.de',
267
		dh_ucs.doIt( 'msgmerge', '--update', '--sort-output', po_file, message_po )
309
			'--copyright-holder=Univention GmbH',
268
		if os.path.isfile( message_po ):
310
			'--language', language,
269
			os.unlink( message_po )
311
			'-o', message_pot,
312
			*files)
313
	pot = polib.pofile(message_pot)
314
	pot.header = PO_HEADER
315
	pot.metadata['Content-Type'] = 'text/plain; charset=UTF-8'
316
	pot.save()
317
318
	if os.path.isfile(po_file):
319
		dh_ucs.doIt('msgmerge', '--update', '--sort-output', po_file, message_pot)
320
		if os.path.isfile(message_pot):
321
			os.unlink(message_pot)
270
	else:
322
	else:
271
		dh_ucs.doIt( 'mv', message_po, po_file )
323
		dh_ucs.doIt('mv', message_pot, po_file)
324
272
325
273
def create_mo_file( po_file ):
326
def create_mo_file( po_file ):
274
	dh_ucs.doIt( 'msgfmt', '--check', '--output-file', po_file.replace( '.po', '.mo' ), po_file )
327
	"""
328
	Compile textual message catalog to binary message catalog.
329
	"""
330
	mo_file = po_file.replace('.po', '.mo')
331
	dh_ucs.doIt('msgfmt', '--check', '--output-file', mo_file, po_file)
332
275
333
276
def create_json_file( po_file ):
334
def create_json_file( po_file ):
277
	json_file = po_file.replace( '.po', '.json' )
335
	"""
278
	json_fd = open( json_file, 'w' )
336
	Compile textual message catalog to JSON message catalog.
279
	pofile = polib.pofile( po_file )
337
	"""
338
	json_file = po_file.replace('.po', '.json')
339
	pofile = polib.pofile(po_file)
280
	data = {}
340
	data = {}
281
	for entry in pofile:
341
	for entry in pofile:
282
		data[ entry.msgid ] = entry.msgstr
342
		data[entry.msgid] = entry.msgstr
283
343
284
	json_fd.write( json.dumps( data ) )
344
	json_fd = open(json_file, 'w')
345
	json_fd.write(json.dumps(data))
285
	json_fd.close()
346
	json_fd.close()
286
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/dev/umc-create-module (-71 / +83 lines)
 Lines 31-157    Link Here 
31
# /usr/share/common-licenses/AGPL-3; if not, see
31
# /usr/share/common-licenses/AGPL-3; if not, see
32
# <http://www.gnu.org/licenses/>.
32
# <http://www.gnu.org/licenses/>.
33
33
34
# default values
35
MODULEID=
36
MODULENAME="Dummy module"
37
MODULEDESC="This is a dummy module"
38
PACKAGENAME=
39
CATEGORYNAME="system"
40
ICONFILE=
41
TEMPLATE="grid_with_detailpage"
42
NO_DEBIAN=
43
34
usage () {
44
usage () {
35
	cat <<EOF
45
	cat <<EOF
36
usage: $(basename $0) [<options>...] <moduleID> [<destinationDir>]
46
usage: ${0##*/} [<options>...] <moduleID> [<destinationDir>]
47
       ${0##*/} --list
37
48
38
destination dir:
49
destinationDir:
39
  If not given, it defaults to the current working directory.
50
  If not given, it defaults to the current working directory.
40
51
41
options:
52
options:
53
  --list         list available templates
42
  --name         displayed name of the module
54
  --name         displayed name of the module
43
  --description  verbose module description (shown as tooltip)
55
  --description  verbose module description (shown as tooltip)
44
  --category     category id (default: system)
56
  --category     category id (default: $CATEGORYNAME)
45
  --package      package name
57
  --package      package name
46
  --icon         path to SVG icon file
58
  --icon         path to SVG icon file
47
  --list         list available templates
59
  --template     name of the template (default: $TEMPLATE)
48
  --template     name of the template (default: grid_with_detailpage)
49
  --no-debian    do not copy debian packages files
60
  --no-debian    do not copy debian packages files
50
51
EOF
61
EOF
52
}
62
}
53
63
54
if [ $# -eq 0 -o "$1" == "--help" -o "$1" == "-h" ]; then
64
err () {
55
	usage
56
	exit 1
57
fi
58
59
function err() {
60
	echo
65
	echo
61
	echo "ERROR: $@"
66
	echo "ERROR: $*"
62
	echo "... aborting"
67
	echo "... aborting"
63
	echo
68
	echo
64
	exit 1
69
	exit 1
65
}
70
}
66
71
67
function warn() {
72
warn () {
68
	echo
73
	echo
69
	echo "WARNING: $@"
74
	echo "WARNING: $*"
70
	echo
75
	echo
71
}
76
}
72
77
73
KEYS=(MODULEID MODULENAME MODULEDESC PACKAGENAME CATEGORYNAME YEAR)
78
SRC_DIR="/usr/share/univention-management-console-dev/umc-module-templates"
79
YEAR=$(date +'%Y')
74
80
75
function replace_var() {
81
replace_var () {
76
	str="$1"
82
	local ikey str="$1"
77
	for ikey in ${KEYS[@]}; do
83
	for ikey in MODULEID MODULENAME MODULEDESC PACKAGENAME CATEGORYNAME YEAR
78
		eval "ival=\${$ikey}"
84
	do
79
		str=${str/$ikey/$ival}
85
		str=${str//$ikey/${!ikey}}
80
	done
86
	done
81
	echo "$str"
87
	echo "$str"
82
}
88
}
83
89
84
# default values
85
MODULEID=dummy
86
MODULENAME="Dummy module"
87
MODULEDESC="This is a dummy module"
88
PACKAGENAME=""
89
CATEGORYNAME="system"
90
ICONFILE=""
91
DESTDIR="$PWD"
92
TEMPLATE="grid_with_detailpage"
93
SRC_DIR="/usr/share/univention-management-console-dev/umc-module-templates"
94
YEAR=$(date +'%Y')
95
NO_DEBIAN=""
96
97
# parse the CLI parameters
90
# parse the CLI parameters
98
for iparam in "$@"; do
91
while [ $# -ge 1 ]
99
	case "$iparam" in
92
do
93
	case "$1" in
94
		--help|-h)
95
			usgae
96
			exit 0
97
			;;
100
		--name)
98
		--name)
101
			MODULENAME="$2"
99
			MODULENAME="$2"
102
			shift 2
100
			shift 2 || err "Missing argument"
103
			;;
101
			;;
104
		--description)
102
		--description)
105
			MODULEDESC="$2"
103
			MODULEDESC="$2"
106
			shift 2
104
			shift 2 || err "Missing argument"
107
			;;
105
			;;
108
		--category)
106
		--category)
109
			CATEGORYNAME="$2"
107
			CATEGORYNAME="$2"
110
			shift 2
108
			shift 2 || err "Missing argument"
111
			;;
109
			;;
112
		--package)
110
		--package)
113
			PACKAGENAME="$2"
111
			PACKAGENAME="$2"
114
			shift 2
112
			shift 2 || err "Missing argument"
115
			;;
113
			;;
116
		--icon)
114
		--icon)
117
			ICONFILE="$2"
115
			ICONFILE="$2"
118
			shift 2
116
			shift 2 || err "Missing argument"
119
			;;
117
			;;
120
		--template)
118
		--template)
121
			TEMPLATE="$2"
119
			TEMPLATE="$2"
122
			shift 2
120
			shift 2 || err "Missing argument"
123
			;;
121
			;;
124
		--list)
122
		--list)
125
			echo "Available templates:"
123
			echo "Available templates:"
126
			(cd $SRC_DIR && find -maxdepth 1 -type d ! -name debian -a ! -name "." | sed 's,./,  ,')
124
			find "$SRC_DIR" -maxdepth 1 -name debian -prune -o -type d -printf '  %P\n'
127
			exit 0
125
			exit 0
128
			;;
126
			;;
129
		--no-debian)
127
		--no-debian)
130
			NO_DEBIAN="yes"
128
			NO_DEBIAN="yes"
131
			shift 1
129
			shift 1
132
			;;
130
			;;
131
		-*)
132
			err "Unknown option: $1"
133
			;;
134
		*)
135
			MODULEID="$1"
136
			break
137
			;;
133
	esac
138
	esac
134
done
139
done
135
140
136
SRC="$SRC_DIR/$TEMPLATE"
141
[ -n "$MODULEID" ] || err "module ID missing!"
137
if [ ! -d "$SRC" ]; then
138
	echo "error: unknown template $TEMPLATE"
139
	exit 1
140
fi
141
142
142
MODULEID="$1"
143
SRC="$SRC_DIR/$TEMPLATE"
143
if [ -z "$MODULEID" ]; then
144
[ -d "$SRC" ] || err "unknown template $TEMPLATE"
144
	usage
145
	echo "error: module ID missing!"
146
	exit 1
147
fi
148
145
149
if [ $# -ge 2 ]; then
146
if [ $# -ge 1 ]
150
	DESTDIR=$(readlink -f "$2")
147
then
148
	DESTDIR=$(readlink -f "$1")
149
else
150
	DESTDIR="$PWD"
151
fi
151
fi
152
152
153
# default values
153
# default values
154
if [ -z "$PACKAGENAME" ]; then
154
if [ -z "$PACKAGENAME" ]
155
then
155
	PACKAGENAME=univention-management-console-module-$MODULEID
156
	PACKAGENAME=univention-management-console-module-$MODULEID
156
fi
157
fi
157
158
 Lines 162-189   cp -r "$SRC" "$moduleDir" Link Here 
162
[ -z "$NO_DEBIAN" ] && cp -r "$SRC_DIR/debian" "$moduleDir"
163
[ -z "$NO_DEBIAN" ] && cp -r "$SRC_DIR/debian" "$moduleDir"
163
164
164
# fix directory and file names
165
# fix directory and file names
165
for findParam in "-type d" "-type f"; do
166
for findParam in d f
166
	find "$moduleDir" $findParam | sort -r | while read ipath; do
167
do
168
	find "$moduleDir" -depth -type "$findParam" |
169
	while read ipath
170
	do
167
		jpath=$(replace_var "$ipath")
171
		jpath=$(replace_var "$ipath")
168
		[ "$ipath" != "$jpath" ] && mv "$ipath" "$jpath"
172
		[ "$ipath" != "$jpath" ] && mv "$ipath" "$jpath"
169
	done
173
	done
170
done
174
done
171
175
172
# replace file content
176
# replace file content
173
sedParam=""
177
sedParam=
174
for ikey in ${KEYS[@]}; do
178
for ikey in "${KEYS[@]}"
179
do
175
	eval "ival=\${$ikey}"
180
	eval "ival=\${$ikey}"
176
	sedParam="${sedParam}s/$ikey/$ival/g; "
181
	sedParam="${sedParam}s/$ikey/$ival/g; "
177
done
182
done
178
sed -i "$sedParam" $(find "$moduleDir" -type f)
183
find "$moduleDir" -type f -exec sed -i "$sedParam" {} +
179
184
180
# create empty changelog
185
# create empty changelog
181
cd "$moduleDir"
186
cd "$moduleDir"
182
dch --create --package "$PACKAGENAME" --newversion 0.1.0-1 --distribution unstable "Initial release (Bug #XXXXXX)"
187
dch --create \
188
	--package "$PACKAGENAME" \
189
	--newversion 0.1.0-1 \
190
	--distribution unstable \
191
	"Initial release (Bug #XXXXXX)"
183
192
184
# custom icon file
193
# custom icon file
185
icon="$moduleDir/umc/icons/scalable/$MODULEID.svgz"
194
icon="$moduleDir/umc/icons/scalable/$MODULEID.svgz"
186
if [ -n "$ICONFILE" ]; then
195
if [ -n "$ICONFILE" ]
196
then
187
	# we got a custom icon file... remove the default and copy the custom icon
197
	# we got a custom icon file... remove the default and copy the custom icon
188
	ext=${ICONFILE##*.}
198
	ext=${ICONFILE##*.}
189
	rm -f "$icon"
199
	rm -f "$icon"
 Lines 192-208   if [ -n "$ICONFILE" ]; then Link Here 
192
fi
202
fi
193
203
194
# scale icons
204
# scale icons
195
for i in 50 16; do
205
for size in 50 16
196
	out="$moduleDir/umc/icons/${i}x${i}/$MODULEID.png"
206
do
207
	out="$moduleDir/umc/icons/${size}x${size}/$MODULEID.png"
197
	mkdir -p "${out%/*}"
208
	mkdir -p "${out%/*}"
198
	if which inkscape > /dev/null 2>&1; then
209
	if which inkscape > /dev/null 2>&1
210
	then
199
		# inkscape is available
211
		# inkscape is available
200
		inkscape -C -w $i -h $i -e "$out" "$icon"
212
		inkscape -C -w "$size" -h "$size" -e "$out" "$icon"
201
	elif which convert > /dev/null 2>&1; then
213
	elif which convert > /dev/null 2>&1
214
	then
202
		# ImageMagick is available
215
		# ImageMagick is available
203
		convert -background none "$icon" -resize "${i}x${i}" "$out"
216
		convert -background none "$icon" -resize "${size}x${size}" "$out"
204
	else
217
	else
205
		warn "Could not find inkscape or ImageMagick to convert SVG icon to PNG format."
218
		warn "Could not find inkscape or ImageMagick to convert SVG icon to PNG format."
206
	fi
219
	fi
207
done
220
done
208
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/tests/sanitizer/sanitize.xml (-16 / +16 lines)
 Lines 6-26    Link Here 
6
		<categories>
6
		<categories>
7
			<category name="system"/>
7
			<category name="system"/>
8
		</categories>
8
		</categories>
9
		<command name="sanitize/bool" function="bool"></command>
9
		<command name="sanitize/bool" function="bool"/>
10
		<command name="sanitize/choices" function="choices"></command>
10
		<command name="sanitize/choices" function="choices"/>
11
		<command name="sanitize/dict" function="dict"></command>
11
		<command name="sanitize/dict" function="dict"/>
12
		<command name="sanitize/dict_a" function="dict_a"></command>
12
		<command name="sanitize/dict_a" function="dict_a"/>
13
		<command name="sanitize/email" function="email"></command>
13
		<command name="sanitize/email" function="email"/>
14
		<command name="sanitize/int" function="int"></command>
14
		<command name="sanitize/int" function="int"/>
15
		<command name="sanitize/ldapsearch" function="ldapsearch"></command>
15
		<command name="sanitize/ldapsearch" function="ldapsearch"/>
16
		<command name="sanitize/list" function="list"></command>
16
		<command name="sanitize/list" function="list"/>
17
		<command name="sanitize/list_a" function="list_a"></command>
17
		<command name="sanitize/list_a" function="list_a"/>
18
		<command name="sanitize/mapping" function="mapping"></command>
18
		<command name="sanitize/mapping" function="mapping"/>
19
		<command name="sanitize/pattern" function="pattern"></command>
19
		<command name="sanitize/pattern" function="pattern"/>
20
		<command name="sanitize/search" function="search"></command>
20
		<command name="sanitize/search" function="search"/>
21
		<command name="sanitize/string" function="string"></command>
21
		<command name="sanitize/string" function="string"/>
22
		<command name="sanitize/simple" function="simple"></command>
22
		<command name="sanitize/simple" function="simple"/>
23
		<command name="sanitize/multi" function="multi"></command>
23
		<command name="sanitize/multi" function="multi"/>
24
		<command name="sanitize/upload" function="upload"></command>
24
		<command name="sanitize/upload" function="upload"/>
25
	</module>
25
	</module>
26
</umc>
26
</umc>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/umc-module-templates/grid_with_detailpage/umc/MODULEID.xml (-8 / +8 lines)
 Lines 1-13    Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<umc version="2.0">
2
<umc version="2.0">
3
	<module id="MODULEID" icon="MODULEID" version="1.0">
3
	<module id="MODULEID" icon="MODULEID" version="1.0">
4
	<name>MODULENAME</name>
4
		<name>MODULENAME</name>
5
	<description>MODULEDESC</description>
5
		<description>MODULEDESC</description>
6
	<categories>
6
		<categories>
7
		<category name="CATEGORYNAME"/>
7
			<category name="CATEGORYNAME"/>
8
	</categories>
8
		</categories>
9
	<command name="MODULEID/query" function="query"></command>
9
		<command name="MODULEID/query" function="query"/>
10
	<command name="MODULEID/colors" function="colors"></command>
10
		<command name="MODULEID/colors" function="colors"/>
11
	<command name="MODULEID/get" function="get"></command>
11
		<command name="MODULEID/get" function="get"/>
12
	</module>
12
	</module>
13
</umc>
13
</umc>
(-)a/branches/ucs-3.1/ucs-3.1-1/management/univention-management-console/umc-module-templates/simple_form/umc/MODULEID.xml (-12 / +9 lines)
 Lines 1-15    Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<umc version="2.0">
2
<umc version="2.0">
3
  <module id="MODULEID" icon="MODULEID" version="1.0">
3
	<module id="MODULEID" icon="MODULEID" version="1.0">
4
	<name>MODULENAME</name>
4
		<name>MODULENAME</name>
5
	<description>MODULEDESC</description>
5
		<description>MODULEDESC</description>
6
	<categories>
6
		<categories>
7
	  <category name="CATEGORYNAME"/>
7
			<category name="CATEGORYNAME"/>
8
	</categories>
8
		</categories>
9
9
		<command name="MODULEID/configuration" function="configuration"/>
10
	<command name="MODULEID/configuration" function="configuration">
10
		<command name="MODULEID/send" function="send"/>
11
	</command>
11
	</module>
12
	<command name="MODULEID/send" function="send">
13
	</command>
14
  </module>
15
</umc>
12
</umc>

Return to bug 31151