| Commit | Line | Data |
|---|---|---|
| db205271 EM |
1 | <?php |
| 2 | // $Id$ | |
| 3 | ||
| 4 | /** | |
| 5 | * Install the panels tables | |
| 6 | */ | |
| 7 | function panels_page_schema() { | |
| 67b5a6d3 | 8 | return panels_page_schema_1(); |
| db205271 EM |
9 | } |
| 10 | ||
| 11 | /** | |
| 12 | * Schema version 1 for Panels in D6. | |
| 13 | */ | |
| 14 | function panels_page_schema_1() { | |
| 15 | $schema = array(); | |
| 16 | ||
| 17 | $schema['panels_page'] = array( | |
| 67b5a6d3 | 18 | 'description' => t('Holds the configuration data for panels pages.'), |
| db205271 EM |
19 | 'fields' => array( |
| 20 | 'pid' => array( | |
| 21 | 'type' => 'serial', | |
| 22 | 'not null' => TRUE, | |
| 23 | ), | |
| 24 | 'name' => array( | |
| 25 | 'type' => 'varchar', | |
| 33eaa0be | 26 | 'length' => 128, |
| 67b5a6d3 SB |
27 | 'not null' => TRUE, |
| 28 | 'default' => '', | |
| db205271 EM |
29 | ), |
| 30 | 'did' => array( | |
| a59c07b2 | 31 | 'type' => 'int', |
| 67b5a6d3 | 32 | 'default' => NULL, |
| db205271 EM |
33 | ), |
| 34 | 'title' => array( | |
| 35 | 'type' => 'varchar', | |
| 33eaa0be | 36 | 'length' => 128, |
| db205271 EM |
37 | ), |
| 38 | 'access' => array( | |
| 39 | 'type' => 'varchar', | |
| 33eaa0be | 40 | 'length' => 128, |
| f6c1a273 | 41 | 'storage_type' => 'implode', |
| db205271 EM |
42 | ), |
| 43 | 'path' => array( | |
| 44 | 'type' => 'varchar', | |
| 33eaa0be | 45 | 'length' => 128, |
| db205271 | 46 | ), |
| eed01932 SB |
47 | 'load_flags' => array( |
| 48 | 'description' => t('Bitval-as-integer metadata used in determining panel_page behavior at runtime.'), | |
| dbc53470 | 49 | 'type' => 'int', |
| eed01932 | 50 | 'size' => 'tiny', |
| dbc53470 SB |
51 | 'not null' => TRUE, |
| 52 | 'default' => 0, | |
| 53 | ), | |
| db205271 EM |
54 | 'css_id' => array( |
| 55 | 'type' => 'varchar', | |
| 33eaa0be | 56 | 'length' => 128, |
| db205271 EM |
57 | ), |
| 58 | 'css' => array( | |
| 59 | 'type' => 'text', | |
| a59c07b2 | 60 | 'size' => 'big', |
| db205271 EM |
61 | ), |
| 62 | 'arguments' => array( | |
| 63 | 'type' => 'text', | |
| a59c07b2 | 64 | 'size' => 'big', |
| f6c1a273 | 65 | 'storage_type' => 'serialize', |
| db205271 EM |
66 | ), |
| 67 | 'displays' => array( | |
| 68 | 'type' => 'text', | |
| a59c07b2 | 69 | 'size' => 'big', |
| f6c1a273 | 70 | 'storage_type' => 'serialize', |
| db205271 EM |
71 | ), |
| 72 | 'contexts' => array( | |
| 73 | 'type' => 'text', | |
| a59c07b2 | 74 | 'size' => 'big', |
| f6c1a273 | 75 | 'storage_type' => 'serialize', |
| db205271 EM |
76 | ), |
| 77 | 'relationships' => array( | |
| 78 | 'type' => 'text', | |
| a59c07b2 | 79 | 'size' => 'big', |
| f6c1a273 | 80 | 'storage_type' => 'serialize', |
| db205271 EM |
81 | ), |
| 82 | 'no_blocks' => array( | |
| 83 | 'type' => 'int', | |
| 67b5a6d3 | 84 | 'size' => 'tiny', |
| db205271 EM |
85 | 'default' => 0, |
| 86 | ), | |
| 67b5a6d3 SB |
87 | 'switcher_options' => array( |
| 88 | 'type' => 'text', | |
| 89 | 'size' => 'big', | |
| 90 | 'not null' => FALSE, | |
| f6c1a273 | 91 | 'storage_type' => 'serialize', |
| 67b5a6d3 SB |
92 | ), |
| 93 | 'switcher_name' => array( | |
| 94 | 'type' => 'varchar', | |
| 33eaa0be | 95 | 'length' => 128, |
| 67b5a6d3 SB |
96 | 'not null' => FALSE, |
| 97 | ), | |
| 98 | 'switcher_type' => array( | |
| 99 | 'type' => 'varchar', | |
| 33eaa0be | 100 | 'length' => 128, |
| 67b5a6d3 SB |
101 | 'not null' => FALSE, |
| 102 | ), | |
| db205271 EM |
103 | 'menu' => array( |
| 104 | 'type' => 'int', | |
| 67b5a6d3 | 105 | 'size' => 'tiny', |
| db205271 EM |
106 | 'default' => 0, |
| 107 | ), | |
| 108 | 'menu_tab' => array( | |
| 109 | 'type' => 'int', | |
| 67b5a6d3 | 110 | 'size' => 'tiny', |
| 359f39dd | 111 | 'not null' => FALSE, |
| db205271 EM |
112 | ), |
| 113 | 'menu_tab_weight' => array( | |
| 114 | 'type' => 'int', | |
| 67b5a6d3 | 115 | 'size' => 'tiny', |
| db205271 EM |
116 | ), |
| 117 | 'menu_title' => array( | |
| 118 | 'type' => 'varchar', | |
| 33eaa0be | 119 | 'length' => 255, |
| db205271 EM |
120 | ), |
| 121 | 'menu_tab_default' => array( | |
| 122 | 'type' => 'int', | |
| a59c07b2 | 123 | 'size' => 'small', |
| db205271 EM |
124 | ), |
| 125 | 'menu_tab_default_parent_type' => array( | |
| 126 | 'type' => 'varchar', | |
| 33eaa0be | 127 | 'length' => 10, |
| db205271 EM |
128 | ), |
| 129 | 'menu_parent_title' => array( | |
| 130 | 'type' => 'varchar', | |
| 33eaa0be | 131 | 'length' => 255, |
| db205271 EM |
132 | ), |
| 133 | 'menu_parent_tab_weight' => array( | |
| 134 | 'type' => 'int', | |
| 67b5a6d3 | 135 | 'size' => 'tiny', |
| eed01932 | 136 | ), |
| db205271 EM |
137 | ), |
| 138 | 'primary key' => array('pid'), | |
| 139 | 'unique keys' => array( | |
| 140 | 'name' => array('name'), | |
| 141 | ), | |
| 142 | 'indexes' => array( | |
| 143 | 'path_idx' => array('path'), | |
| 67b5a6d3 | 144 | 'did_idx' => array('did'), |
| db205271 EM |
145 | ), |
| 146 | ); | |
| 67b5a6d3 SB |
147 | // Straight copy from the menu schema; duping it for storage purposes. |
| 148 | $schema['panels_page_router_store'] = array( | |
| 149 | 'description' => t('Maps paths to various callbacks (access, page and title)'), | |
| 82ada790 | 150 | 'fields' => array( |
| 82ada790 | 151 | 'path' => array( |
| 67b5a6d3 | 152 | 'description' => t('The Drupal path this entry describes.'), |
| 82ada790 | 153 | 'type' => 'varchar', |
| 67b5a6d3 SB |
154 | 'length' => 255, |
| 155 | 'not null' => TRUE, | |
| eed01932 | 156 | 'default' => '', |
| 67b5a6d3 SB |
157 | ), |
| 158 | 'load_functions' => array( | |
| 159 | 'description' => t('A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.'), | |
| 160 | 'type' => 'varchar', | |
| 161 | 'length' => 255, | |
| 162 | 'not null' => TRUE, | |
| eed01932 | 163 | 'default' => '', |
| 67b5a6d3 SB |
164 | ), |
| 165 | 'to_arg_functions' => array( | |
| 166 | 'description' => t('A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.'), | |
| 167 | 'type' => 'varchar', | |
| 168 | 'length' => 255, | |
| 169 | 'not null' => TRUE, | |
| eed01932 | 170 | 'default' => '', |
| 67b5a6d3 SB |
171 | ), |
| 172 | 'access_callback' => array( | |
| 173 | 'description' => t('The callback which determines the access to this router path. Defaults to user_access.'), | |
| 174 | 'type' => 'varchar', | |
| 175 | 'length' => 255, | |
| 176 | 'not null' => TRUE, | |
| eed01932 | 177 | 'default' => '', |
| 67b5a6d3 SB |
178 | ), |
| 179 | 'access_arguments' => array( | |
| 180 | 'description' => t('A serialized array of arguments for the access callback.'), | |
| 181 | 'type' => 'text', | |
| eed01932 | 182 | 'not null' => FALSE, |
| 67b5a6d3 SB |
183 | ), |
| 184 | 'page_callback' => array( | |
| 185 | 'description' => t('The name of the function that renders the page.'), | |
| 186 | 'type' => 'varchar', | |
| 187 | 'length' => 255, | |
| 188 | 'not null' => TRUE, | |
| eed01932 | 189 | 'default' => '', |
| 67b5a6d3 SB |
190 | ), |
| 191 | 'page_arguments' => array( | |
| 192 | 'description' => t('A serialized array of arguments for the page callback.'), | |
| 193 | 'type' => 'text', | |
| eed01932 | 194 | 'not null' => FALSE, |
| 67b5a6d3 SB |
195 | ), |
| 196 | 'fit' => array( | |
| 197 | 'description' => t('A numeric representation of how specific the path is.'), | |
| 198 | 'type' => 'int', | |
| 199 | 'not null' => TRUE, | |
| eed01932 | 200 | 'default' => 0, |
| 67b5a6d3 SB |
201 | ), |
| 202 | 'number_parts' => array( | |
| 203 | 'description' => t('Number of parts in this router path.'), | |
| 204 | 'type' => 'int', | |
| 205 | 'not null' => TRUE, | |
| 206 | 'default' => 0, | |
| eed01932 | 207 | 'size' => 'small', |
| 67b5a6d3 SB |
208 | ), |
| 209 | 'tab_parent' => array( | |
| 210 | 'description' => t('Only for local tasks (tabs) - the router path of the parent page (which may also be a local task).'), | |
| 211 | 'type' => 'varchar', | |
| 212 | 'length' => 255, | |
| 213 | 'not null' => TRUE, | |
| eed01932 | 214 | 'default' => '', |
| 67b5a6d3 SB |
215 | ), |
| 216 | 'tab_root' => array( | |
| 217 | 'description' => t('Router path of the closest non-tab parent page. For pages that are not local tasks, this will be the same as the path.'), | |
| 218 | 'type' => 'varchar', | |
| 219 | 'length' => 255, | |
| 220 | 'not null' => TRUE, | |
| eed01932 | 221 | 'default' => '', |
| 67b5a6d3 SB |
222 | ), |
| 223 | 'title' => array( | |
| 224 | 'description' => t('The title for the current page, or the title for the tab if this is a local task.'), | |
| 225 | 'type' => 'varchar', | |
| 226 | 'length' => 255, | |
| 227 | 'not null' => TRUE, | |
| eed01932 | 228 | 'default' => '', |
| 67b5a6d3 SB |
229 | ), |
| 230 | 'title_callback' => array( | |
| 231 | 'description' => t('A function which will alter the title. Defaults to t()'), | |
| 232 | 'type' => 'varchar', | |
| 233 | 'length' => 255, | |
| 234 | 'not null' => TRUE, | |
| eed01932 | 235 | 'default' => '', |
| 67b5a6d3 SB |
236 | ), |
| 237 | 'title_arguments' => array( | |
| 238 | 'description' => t('A serialized array of arguments for the title callback. If empty, the title will be used as the sole argument for the title callback.'), | |
| 239 | 'type' => 'varchar', | |
| 240 | 'length' => 255, | |
| 241 | 'not null' => TRUE, | |
| eed01932 | 242 | 'default' => '', |
| 67b5a6d3 SB |
243 | ), |
| 244 | 'type' => array( | |
| 245 | 'description' => t('Numeric representation of the type of the menu item, like MENU_LOCAL_TASK.'), | |
| 246 | 'type' => 'int', | |
| 247 | 'not null' => TRUE, | |
| eed01932 | 248 | 'default' => 0, |
| 67b5a6d3 SB |
249 | ), |
| 250 | 'block_callback' => array( | |
| 251 | 'description' => t('Name of a function used to render the block on the system administration page for this item.'), | |
| 252 | 'type' => 'varchar', | |
| 253 | 'length' => 255, | |
| 254 | 'not null' => TRUE, | |
| eed01932 | 255 | 'default' => '', |
| 67b5a6d3 SB |
256 | ), |
| 257 | 'description' => array( | |
| 258 | 'description' => t('A description of this item.'), | |
| 259 | 'type' => 'text', | |
| eed01932 | 260 | 'not null' => TRUE, |
| 67b5a6d3 SB |
261 | ), |
| 262 | 'position' => array( | |
| 263 | 'description' => t('The position of the block (left or right) on the system administration page for this item.'), | |
| 264 | 'type' => 'varchar', | |
| 265 | 'length' => 255, | |
| 266 | 'not null' => TRUE, | |
| eed01932 | 267 | 'default' => '', |
| 67b5a6d3 SB |
268 | ), |
| 269 | 'weight' => array( | |
| 270 | 'description' => t('Weight of the element. Lighter weights are higher up, heavier weights go down.'), | |
| 271 | 'type' => 'int', | |
| 272 | 'not null' => TRUE, | |
| eed01932 | 273 | 'default' => 0, |
| 67b5a6d3 SB |
274 | ), |
| 275 | 'file' => array( | |
| 276 | 'description' => t('The file to include for this element, usually the page callback function lives in this file.'), | |
| 277 | 'type' => 'text', | |
| eed01932 | 278 | 'size' => 'medium', |
| 82ada790 | 279 | ), |
| 82ada790 SB |
280 | ), |
| 281 | 'indexes' => array( | |
| 67b5a6d3 | 282 | 'fit_idx' => array('fit'), |
| 82ada790 | 283 | 'number_parts_idx' => array('number_parts'), |
| 67b5a6d3 | 284 | ), |
| 359f39dd | 285 | 'primary key' => array('path'), |
| 67b5a6d3 | 286 | ); |
| db205271 EM |
287 | return $schema; |
| 288 | } | |
| 289 | ||
| db205271 | 290 | function panels_page_install() { |
| 67b5a6d3 | 291 | db_query("UPDATE {system} SET weight = 15 WHERE name = 'panels_page'"); |
| db205271 EM |
292 | drupal_install_schema('panels_page'); |
| 293 | } | |
| 294 | ||
| 295 | function panels_page_uninstall() { | |
| 296 | drupal_uninstall_schema('panels_page'); | |
| 297 | } | |
| 298 | ||
| eed01932 SB |
299 | function panels_page_update_6000() { |
| 300 | $ret = array(); | |
| 301 | db_add_field($ret, 'panels_page', 'load_flags', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0)); | |
| 302 | return $ret; | |
| 303 | } | |
| 304 |