/[drupal]/contributions/modules/copyright/copyright.install
ViewVC logotype

Contents of /contributions/modules/copyright/copyright.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Fri Aug 8 19:51:37 2008 UTC (15 months, 2 weeks ago) by robrechtj
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +171 -91 lines
File MIME type: text/x-php
#222729 : port to Drupal 6. Work in progress!!

TODO:
- copyright.admin.inc : rewrite the forms
- replace some db_query()s with drupal_write_record()
- hook_update() to change BOOL columns (from D5) into (TINY)INT
- general checking and debugging
1 <?php
2 // $Id: copyright.install,v 1.4.4.10 2007/10/05 15:47:40 robrechtj Exp $
3
4 /**
5 * @file
6 * Installing, uninstalling and updating the COPYRIGHT module.
7 */
8
9 /**
10 * Implementation of hook_install().
11 */
12 function copyright_install() {
13 drupal_install_schema('copyright');
14
15 // Insert some common copyrights
16 $copyrights = array(
17 array(
18 'name' => 'All Rights Reserved',
19 'description' => 'All Rights Reserved',
20 'site_notice' => 'Copyright &copy; @year @site<br />All Rights Reserved',
21 'node_notice' => 'Copyright &copy; @year @author<br />All Rights Reserved',
22 ),
23
24 array(
25 'name' => 'Public Domain',
26 'description' => 'Public Domain',
27 'site_notice' => 'All content of this site is released into the public domain except where otherwise noted.',
28 'node_notice' => 'This page is released into the public domain.',
29 ),
30
31 array(
32 'name' => 'Creative Commons BY-NC-SA',
33 'description' => 'Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License',
34 'site_notice' => 'Except where otherwise noted, this work is licensed under a <a href="@source_url">Creative Commons License</a>.
35 <!--
36 <rdf:RDF xmlns="http://web.resource.org/cc/"
37 xmlns:dc="http://purl.org/dc/elements/1.1/"
38 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
39 <Work rdf:about="">
40 <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
41 <license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/" />
42 </Work>
43 <License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/">
44 <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
45 <permits rdf:resource="http://web.resource.org/cc/Distribution" />
46 <requires rdf:resource="http://web.resource.org/cc/Notice" />
47 <requires rdf:resource="http://web.resource.org/cc/Attribution" />
48 <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
49 </License>
50 </rdf:RDF>
51 -->',
52 'node_notice' => 'This page is licensed under a <a href="@source_url">Creative Commons License</a>.',
53 'source_url' => 'http://creativecommons.org/licenses/by-nc-sa/2.0/',
54 'image_url' => 'http://creativecommons.org/images/public/somerights20.gif',
55 ),
56
57 array(
58 'name' => 'Creative Commons BY',
59 'description' => 'Creative Commons Attribution License',
60 'site_notice' => 'Except where otherwise noted, this work is licensed under a <a href="@source_url">Creative Commons License</a>.
61 <!--
62 <rdf:RDF xmlns="http://web.resource.org/cc/"
63 xmlns:dc="http://purl.org/dc/elements/1.1/"
64 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
65 <Work rdf:about="">
66 <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
67 <license rdf:resource="http://creativecommons.org/licenses/by/2.0/" />
68 </Work>
69 <License rdf:about="http://creativecommons.org/licenses/by/2.0/">
70 <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
71 <permits rdf:resource="http://web.resource.org/cc/Distribution" />
72 <requires rdf:resource="http://web.resource.org/cc/Notice" />
73 <requires rdf:resource="http://web.resource.org/cc/Attribution" />
74 <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
75 </License>
76 </rdf:RDF>
77 -->',
78 'node_notice' => 'This page is licensed under a <a href="@source_url">Creative Commons License</a>.',
79 'source_url' => 'http://creativecommons.org/licenses/by/2.0/',
80 'image_url' => 'http://creativecommons.org/images/public/somerights20.gif',
81 ),
82
83 array(
84 'name' => 'GNU FDL',
85 'description' => 'GNU Free Documentation License',
86 'site_notice' => 'Copyright (c) @year @site<br />
87 Permission is granted to copy, distribute and/or modify the content of<br />
88 this site (except where otherwise noted) under the terms of the GNU Free<br />
89 Documentation License, Version 1.2 or any later version published by the<br />
90 Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, <br />
91 and no Back-Cover Texts. A copy of the license is available at <br />
92 <a href="@source_url">@source_url</a>',
93 'node_notice' => 'Copyright (c) @year @author<br />
94 Permission is granted to copy, distribute and/or modify the content of<br />
95 this page under the terms of the GNU Free Documentation License, Version 1.2<br />
96 or any later version published by the Free Software Foundation; with no <br />
97 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.<br />
98 A copy of the license is available at <a href="@source_url">@source_url</a>',
99 'source_url' => 'http://www.gnu.org/licenses/fdl.html',
100 ),
101 );
102
103 foreach ($copyrights as $copyright) {
104 drupal_write_record($copyright);
105 }
106
107 // Now make sure the footer-block is displayed right away.
108 if (function_exists('_block_rehash')) {
109 _block_rehash();
110 }
111 }
112
113 /**
114 * Implementation of hook_uninstall().
115 */
116 function copyright_uninstall() {
117 drupal_uninstall_schema('copyright');
118
119 variable_del('copyright-default');
120 foreach ((array)node_get_types() as $type => $object) {
121 variable_del('copyright-enable_'. $type);
122 }
123 }
124
125 /**
126 * Implementation of hook_schema().
127 */
128 function copyright_schema() {
129 $schema = array();
130
131 $schema['copyrights'] = array(
132 'description' => t('Stores the list of available copyright licenses.'),
133 'fields' => array(
134 'cpyid' => array(
135 'type' => 'serial',
136 'not null' => TRUE,
137 'unsigned' => TRUE,
138 ),
139 'name' => array(
140 'type' => 'varchar',
141 'length' => 60,
142 'not null' => TRUE,
143 'default' => '',
144 ),
145 'description' => array(
146 'type' => 'varchar',
147 'length' => 255,
148 ),
149 'site_notice' => array(
150 'type' => 'text',
151 'size' => 'medium',
152 ),
153 'node_notice' => array(
154 'type' => 'text',
155 'size' => 'medium',
156 ),
157 'image_url' => array(
158 'type' => 'varchar',
159 'length' => 255,
160 ),
161 'source_url' => array(
162 'type' => 'varchar',
163 'length' => 255,
164 ),
165 'license' => array(
166 'type' => 'text',
167 ),
168 ),
169 'primary key' => array('cpyid'),
170 );
171
172 $schema['copyright_node'] = array(
173 'description' => t('Stores the cpyid - nid relation.'),
174 'fields' => array(
175 'nid' => array(
176 'type' => 'int',
177 'unsigned' => TRUE,
178 'not null' => TRUE,
179 ),
180 'cpyid' => array(
181 'type' => 'int',
182 'unsigned' => TRUE,
183 'not null' => TRUE,
184 ),
185 'children_show_notice' => array(
186 'type' => 'int',
187 'size' => 'tiny',
188 'unsigned' => TRUE,
189 'not null' => TRUE,
190 'default' => 1,
191 ),
192 'original_author' => array(
193 'type' => 'varchar',
194 'length' => 255,
195 'default' => '',
196 ),
197 'children_allow_set' => array(
198 'type' => 'int',
199 'size' => 'tiny',
200 'unsigned' => TRUE,
201 'not null' => TRUE,
202 'default' => 1,
203 ),
204 ),
205 'primary key' => array('nid'),
206 );
207
208 $schema['copyright_user'] = array(
209 'description' => t('Stores the default copyright to use per user.'),
210 'fields' => array(
211 'uid' => array(
212 'type' => 'int',
213 'not null' => TRUE,
214 'unsigned' => TRUE,
215 ),
216 'cpyid' => array(
217 'type' => 'int',
218 'not null' => TRUE,
219 'unsigned' => TRUE,
220 'default' => 0,
221 ),
222 'original_author' => array(
223 'type' => 'varchar',
224 'length' => 255,
225 'default' => '',
226 ),
227 ),
228 'primary key' => array('uid'),
229 );
230
231 return $schema;
232 }
233
234 //TODO: update! {copyright_node}.children_show_notice and {copyright_node}.children_allow_set were BOOL and now they are TINYINT.

  ViewVC Help
Powered by ViewVC 1.1.2