Parent Directory
|
Revision Log
|
Revision Graph
Added by manfer: Added waitURL default value on update. Changed by manfer: prepairing module for drupal 7.
| 1 | <?php |
| 2 | // $Id: pageear.admin.inc,v 1.14 2009/10/30 13:28:39 manfer Exp $ |
| 3 | |
| 4 | /** |
| 5 | * @file |
| 6 | * Admin page callbacks for pageear module. |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * Menu callback for admin/build/pageear. |
| 11 | * List of pageears. |
| 12 | */ |
| 13 | function pageear_list_form(&$form_state) { |
| 14 | |
| 15 | $pageears = pageear_load(); |
| 16 | |
| 17 | if (count($pageears)) { |
| 18 | |
| 19 | foreach ($pageears as $pageear) { |
| 20 | $form['pageears'][$pageear->peid] = array( |
| 21 | '#tree' => TRUE, |
| 22 | ); |
| 23 | $form['pageears'][$pageear->peid]['peid'] = array( |
| 24 | '#type' => 'hidden', |
| 25 | '#value' => $pageear->peid, |
| 26 | ); |
| 27 | $form['pageears'][$pageear->peid]['name'] = array( |
| 28 | '#value' => $pageear->name, |
| 29 | ); |
| 30 | $form['pageears'][$pageear->peid]['link'] = array( |
| 31 | '#value' => $pageear->link, |
| 32 | ); |
| 33 | $form['pageears'][$pageear->peid]['peelPosition'] = array( |
| 34 | '#value' => $pageear->peelPosition, |
| 35 | ); |
| 36 | $form['pageears'][$pageear->peid]['status'] = array( |
| 37 | '#type' => 'checkbox', |
| 38 | '#default_value' => (bool) (isset($form_state['pageears'][$pageear->peid]['status']) ? $form_state['pageears'][$pageear->peid]['status'] : $pageear->status), |
| 39 | ); |
| 40 | $form['pageears'][$pageear->peid]['weight'] = array( |
| 41 | '#type' => 'weight', |
| 42 | '#delta' => 50, |
| 43 | '#default_value' => isset($form_state['pageears'][$pageear->peid]['weight']) ? $form_state['pageears'][$pageear->peid]['weight'] : $pageear->weight, |
| 44 | ); |
| 45 | $form['pageears'][$pageear->peid]['clone'] = array( |
| 46 | '#value' => l(t('clone'), 'admin/build/pageear/'. $pageear->peid .'/clone'), |
| 47 | ); |
| 48 | $form['pageears'][$pageear->peid]['edit'] = array( |
| 49 | '#value' => l(t('edit'), 'admin/build/pageear/'. $pageear->peid .'/edit'), |
| 50 | ); |
| 51 | $form['pageears'][$pageear->peid]['delete'] = array( |
| 52 | '#value' => l(t('delete'), 'admin/build/pageear/'. $pageear->peid .'/delete'), |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | $form['submit'] = array( |
| 57 | '#type' => 'submit', |
| 58 | '#value' => t('Save configuration'), |
| 59 | ); |
| 60 | |
| 61 | } |
| 62 | else { |
| 63 | $form['empty'] = array('#value' => t('There are no pageears yet. !Add_new a pageear first.', array('!Add_new' => l(t('Add'), 'admin/build/pageear/add')))); |
| 64 | } |
| 65 | |
| 66 | return $form; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Theme: List of pageears. |
| 71 | */ |
| 72 | function theme_pageear_list_form($form) { |
| 73 | |
| 74 | $header = array( |
| 75 | t('Pageear'), |
| 76 | t('Link'), |
| 77 | t('Position'), |
| 78 | array('data' => t('Enabled'), 'class' => 'checkbox'), |
| 79 | t('Weight'), |
| 80 | array('data' => t('Operations'), 'colspan' => '3'), |
| 81 | ); |
| 82 | |
| 83 | $pageears = array(); |
| 84 | |
| 85 | foreach (element_children($form['pageears']) as $peid) { |
| 86 | $form['pageears'][$peid]['weight']['#attributes']['class'] = 'pageear-weight'; |
| 87 | |
| 88 | $pageears[] = array( |
| 89 | 'data' => array( |
| 90 | drupal_render($form['pageears'][$peid]['name']), |
| 91 | drupal_render($form['pageears'][$peid]['link']), |
| 92 | drupal_render($form['pageears'][$peid]['peelPosition']), |
| 93 | array( |
| 94 | 'data' => drupal_render($form['pageears'][$peid]['status']), |
| 95 | 'class' => 'checkbox' |
| 96 | ), |
| 97 | drupal_render($form['pageears'][$peid]['weight']), |
| 98 | drupal_render($form['pageears'][$peid]['clone']), |
| 99 | drupal_render($form['pageears'][$peid]['edit']), |
| 100 | drupal_render($form['pageears'][$peid]['delete']), |
| 101 | ), |
| 102 | 'class' => 'draggable', |
| 103 | ); |
| 104 | } |
| 105 | |
| 106 | $output = ''; |
| 107 | |
| 108 | if (count($pageears)) { |
| 109 | $output .= theme('table', $header, $pageears, array('id' => 'order-pageears')); |
| 110 | } |
| 111 | |
| 112 | $output .= drupal_render($form); |
| 113 | |
| 114 | drupal_add_tabledrag('order-pageears', 'order', 'sibling', 'pageear-weight'); |
| 115 | |
| 116 | return $output; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Submit: List of pageears. |
| 121 | */ |
| 122 | function pageear_list_form_submit($form, &$form_state) { |
| 123 | |
| 124 | $num_enabled_pageears = 0; |
| 125 | |
| 126 | // for each pageear update its status and its weight. |
| 127 | foreach (element_children($form['pageears']) as $peid) { |
| 128 | $pageear->peid = $form['pageears'][$peid]['peid']['#value']; |
| 129 | $pageear->weight = $form['pageears'][$peid]['weight']['#value']; |
| 130 | $pageear->status = $form['pageears'][$peid]['status']['#value']; |
| 131 | |
| 132 | if ($pageear->status) { |
| 133 | $num_enabled_pageears++; |
| 134 | } |
| 135 | |
| 136 | drupal_write_record('pageears', $pageear, 'peid'); |
| 137 | } |
| 138 | |
| 139 | // Update the persistent variable numEnabledPageears that tracks number of pageears enabled |
| 140 | variable_set('numEnabledPageears', $num_enabled_pageears); |
| 141 | |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Menu callback; displays the pageear configuration form. |
| 146 | * |
| 147 | * Using the same form for three different operations ($op): |
| 148 | * - 'edit': edit an existing pageear (default) |
| 149 | * - 'add': add a new pageear |
| 150 | * - 'clone': clone an existing pageear |
| 151 | */ |
| 152 | function pageear_admin_edit($form_state, $pageear, $op = 'edit') { |
| 153 | |
| 154 | if ($op == 'add' || !$pageear->peid) { |
| 155 | $pageear = pageear_get_default(); |
| 156 | } |
| 157 | |
| 158 | if ($op == 'clone') { |
| 159 | $pageear->peid = 0; |
| 160 | } |
| 161 | |
| 162 | // Add Farbtastic color picker |
| 163 | drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', TRUE); |
| 164 | drupal_add_js('misc/farbtastic/farbtastic.js', 'module', 'header', FALSE, FALSE, TRUE); |
| 165 | |
| 166 | // Add js that links farbtastic pickers with its input fields |
| 167 | drupal_add_js(drupal_get_path('module', 'pageear') .'/earsConfigForm_farbtastic_ini.js', 'module', 'header', FALSE, FALSE, TRUE); |
| 168 | |
| 169 | $form = array(); |
| 170 | |
| 171 | $form['#attributes'] = array('enctype' => "multipart/form-data"); |
| 172 | |
| 173 | $form['peid'] = array( |
| 174 | '#type' => 'value', |
| 175 | '#value' => $pageear->peid, |
| 176 | ); |
| 177 | |
| 178 | // Info |
| 179 | $form['info'] = array( |
| 180 | '#type' => 'fieldset', |
| 181 | '#title' => t('Pageear info'), |
| 182 | '#collapsible' => TRUE, |
| 183 | ); |
| 184 | |
| 185 | $form['info']['status'] = array( |
| 186 | '#type' => 'checkbox', |
| 187 | '#title' => t('Enable pageear'), |
| 188 | '#default_value' => $pageear->status, |
| 189 | '#description' => t('If this setting is enabled, the current pageear is shown on the configured pages (you can edit visibility settings below).'), |
| 190 | ); |
| 191 | |
| 192 | // previous status of this pageear before starting configuration |
| 193 | $form['info']['previous_status'] = array( |
| 194 | '#type' => 'hidden', |
| 195 | '#value' => $pageear->status, |
| 196 | ); |
| 197 | |
| 198 | $form['info']['name'] = array( |
| 199 | '#type' => 'textfield', |
| 200 | '#title' => t('Pageear name'), |
| 201 | '#default_value' => $pageear->name, |
| 202 | '#required' => TRUE, |
| 203 | '#maxlength' => 64, |
| 204 | '#size' => 40, |
| 205 | ); |
| 206 | // End Info |
| 207 | |
| 208 | // Details |
| 209 | $form['details'] = array( |
| 210 | '#type' => 'fieldset', |
| 211 | '#title' => t('Pageear details'), |
| 212 | '#collapsible' => TRUE, |
| 213 | '#collapsed' => TRUE, |
| 214 | ); |
| 215 | |
| 216 | // Position settings. |
| 217 | $form['details']['position_settings'] = array( |
| 218 | '#type' => 'fieldset', |
| 219 | '#title' => t('Position Settings'), |
| 220 | '#collapsible' => TRUE, |
| 221 | '#collapsed' => TRUE, |
| 222 | ); |
| 223 | |
| 224 | // Set direction of pageear in left or right top browser corner ( topleft: left | topright: right ). |
| 225 | $form['details']['position_settings']['peelPosition'] = array( |
| 226 | '#type' => 'radios', |
| 227 | '#title' => t('Corner'), |
| 228 | '#description' => t('In what corner the ad will be displayed.'), |
| 229 | '#options' => pageear_get_options('peelPosition'), |
| 230 | '#default_value' => $pageear->peelPosition, |
| 231 | '#required' => TRUE, |
| 232 | ); |
| 233 | |
| 234 | // Set position model of peageear ( absolute | fixed ). |
| 235 | $form['details']['position_settings']['peelPositionModel'] = array( |
| 236 | '#type' => 'radios', |
| 237 | '#title' => t('Position Model'), |
| 238 | '#description' => t('The CSS Position model you would prefer to use.'), |
| 239 | '#options' => pageear_get_options('peelPositionModel'), |
| 240 | '#default_value' => $pageear->peelPositionModel, |
| 241 | '#required' => TRUE, |
| 242 | ); |
| 243 | // End Position settings. |
| 244 | |
| 245 | |
| 246 | // Wait settings. |
| 247 | $form['details']['wait_settings'] = array( |
| 248 | '#type' => 'fieldset', |
| 249 | '#title' => t('Wait Icon Settings'), |
| 250 | '#collapsible' => TRUE, |
| 251 | '#collapsed' => TRUE, |
| 252 | ); |
| 253 | |
| 254 | $form['details']['wait_settings']['waitEnable'] = array( |
| 255 | '#type' => 'checkbox', |
| 256 | '#title' => t('Enable wait icon'), |
| 257 | '#default_value' => $pageear->waitEnable, |
| 258 | '#description' => t('If this setting is enabled, a wait icon will be displayed while pageear is loading.'), |
| 259 | ); |
| 260 | |
| 261 | // Set wait icon width |
| 262 | $form['details']['wait_settings']['waitWidth'] = array( |
| 263 | '#type' => 'textfield', |
| 264 | '#title' => t('Wait Icon Width'), |
| 265 | '#required' => TRUE, |
| 266 | '#default_value' => $pageear->waitWidth, |
| 267 | '#maxlength' => 3, |
| 268 | '#size' => 8, |
| 269 | ); |
| 270 | |
| 271 | // Set wait icon height |
| 272 | $form['details']['wait_settings']['waitHeight'] = array( |
| 273 | '#type' => 'textfield', |
| 274 | '#title' => t('Wait Icon Height'), |
| 275 | '#required' => TRUE, |
| 276 | '#default_value' => $pageear->waitHeight, |
| 277 | '#maxlength' => 3, |
| 278 | '#size' => 8, |
| 279 | ); |
| 280 | |
| 281 | // URL to wait icon. |
| 282 | $form['details']['wait_settings']['waitURL'] = array( |
| 283 | '#type' => 'item', |
| 284 | '#title' => t('Wait icon'), |
| 285 | '#value' => $pageear->waitURL, |
| 286 | ); |
| 287 | |
| 288 | $form['details']['wait_settings']['waitURL_upload'] = array( |
| 289 | '#type' => 'file', |
| 290 | '#description' => t('Upload an image to show while pageear is loading (most common an animated GIF, Wait Icon Width x Wait Icon Height pixels).'), |
| 291 | '#tree' => FALSE, |
| 292 | '#size' => 40, |
| 293 | ); |
| 294 | // End wait settings. |
| 295 | |
| 296 | |
| 297 | // Style settings. |
| 298 | $form['details']['style_settings'] = array( |
| 299 | '#type' => 'fieldset', |
| 300 | '#title' => t('Style Settings'), |
| 301 | '#collapsible' => TRUE, |
| 302 | '#collapsed' => TRUE, |
| 303 | ); |
| 304 | |
| 305 | // Style of flag ('style1' | 'style2'). |
| 306 | $form['details']['style_settings']['flagStyle'] = array( |
| 307 | '#type' => 'select', |
| 308 | '#title' => t('Flag Style'), |
| 309 | '#options' => pageear_get_options('flagStyle'), |
| 310 | '#default_value' => $pageear->flagStyle, |
| 311 | '#required' => TRUE, |
| 312 | ); |
| 313 | |
| 314 | // Style of peel ('style1' | 'style2'). |
| 315 | $form['details']['style_settings']['peelStyle'] = array( |
| 316 | '#type' => 'select', |
| 317 | '#title' => t('Peel Style'), |
| 318 | '#options' => pageear_get_options('peelStyle'), |
| 319 | '#default_value' => $pageear->peelStyle, |
| 320 | '#required' => TRUE, |
| 321 | ); |
| 322 | // End Style settings. |
| 323 | |
| 324 | |
| 325 | // Size Settings. |
| 326 | $form['details']['size_settings'] = array( |
| 327 | '#type' => 'fieldset', |
| 328 | '#title' => t('Size Settings'), |
| 329 | '#collapsible' => TRUE, |
| 330 | '#collapsed' => TRUE, |
| 331 | '#description' => t('Design sizes are 100x100px and 500x500px for flag and peel respectively. If you decide to use a custom size try to use logical values. For example it makes not sense to use a larger size for the flag than for the peel. For a further explanation refer to !pageear_size_manual.', array('!pageear_size_manual' => l(t('howto on home page'), 'http://www.pageeargpl.co.cc/content/size-settings', array('attributes' => array('target' => '_blank'))))), |
| 332 | ); |
| 333 | |
| 334 | // Set flag width |
| 335 | $form['details']['size_settings']['flagWidth'] = array( |
| 336 | '#type' => 'textfield', |
| 337 | '#title' => t('Flag Width'), |
| 338 | '#required' => TRUE, |
| 339 | '#default_value' => $pageear->flagWidth, |
| 340 | '#maxlength' => 4, |
| 341 | '#size' => 8, |
| 342 | ); |
| 343 | |
| 344 | // Set flag height |
| 345 | $form['details']['size_settings']['flagHeight'] = array( |
| 346 | '#type' => 'textfield', |
| 347 | '#title' => t('Flag Height'), |
| 348 | '#required' => TRUE, |
| 349 | '#default_value' => $pageear->flagHeight, |
| 350 | '#maxlength' => 4, |
| 351 | '#size' => 8, |
| 352 | ); |
| 353 | |
| 354 | // Set peel width |
| 355 | $form['details']['size_settings']['peelWidth'] = array( |
| 356 | '#type' => 'textfield', |
| 357 | '#title' => t('Peel Width'), |
| 358 | '#required' => TRUE, |
| 359 | '#default_value' => $pageear->peelWidth, |
| 360 | '#maxlength' => 5, |
| 361 | '#size' => 8, |
| 362 | ); |
| 363 | |
| 364 | // Set peel height |
| 365 | $form['details']['size_settings']['peelHeight'] = array( |
| 366 | '#type' => 'textfield', |
| 367 | '#title' => t('Peel Height'), |
| 368 | '#required' => TRUE, |
| 369 | '#default_value' => $pageear->peelHeight, |
| 370 | '#maxlength' => 5, |
| 371 | '#size' => 8, |
| 372 | ); |
| 373 | // End Size settings. |
| 374 | |
| 375 | |
| 376 | // Image Settings. |
| 377 | $form['details']['image_settings'] = array( |
| 378 | '#type' => 'fieldset', |
| 379 | '#title' => t('Image Settings'), |
| 380 | '#collapsible' => TRUE, |
| 381 | '#collapsed' => TRUE, |
| 382 | ); |
| 383 | |
| 384 | // URL to small image. |
| 385 | $form['details']['image_settings']['smallURL'] = array( |
| 386 | '#type' => 'item', |
| 387 | '#title' => t('Unpeeled image'), |
| 388 | '#value' => $pageear->smallURL, |
| 389 | ); |
| 390 | |
| 391 | $form['details']['image_settings']['smallURL_upload'] = array( |
| 392 | '#type' => 'file', |
| 393 | '#description' => t('Upload an image or flash movie to show when the ad is not peeled (JPG, GIF, PNG or SWF, Flag Width x Flag Height pixels).'), |
| 394 | '#tree' => FALSE, |
| 395 | '#size' => 40, |
| 396 | ); |
| 397 | |
| 398 | // URL to big image. |
| 399 | $form['details']['image_settings']['bigURL'] = array( |
| 400 | '#type' => 'item', |
| 401 | '#title' => t('Peeled image'), |
| 402 | '#value' => $pageear->bigURL, |
| 403 | ); |
| 404 | |
| 405 | $form['details']['image_settings']['bigURL_upload'] = array( |
| 406 | '#type' => 'file', |
| 407 | '#description' => t('Upload an image or flash movie to show when the ad is peeled (JPG, GIF, PNG or SWF, Peel Width x Peel Height pixels).'), |
| 408 | '#tree' => FALSE, |
| 409 | '#size' => 40, |
| 410 | ); |
| 411 | |
| 412 | // Mirror image ( true | false ). |
| 413 | $form['details']['image_settings']['mirror'] = array( |
| 414 | '#type' => 'checkbox', |
| 415 | '#title' => t('Back mirror'), |
| 416 | '#default_value' => $pageear->mirror, |
| 417 | '#description' => t('Mirror the ad on the back of the peeled page.'), |
| 418 | ); |
| 419 | |
| 420 | // In Transition for pageear. |
| 421 | $form['details']['image_settings']['inTransition'] = array( |
| 422 | '#type' => 'select', |
| 423 | '#title' => t('In Transition'), |
| 424 | '#description' => t('In Transition for the pageear.'), |
| 425 | '#options' => pageear_get_options('inTransition'), |
| 426 | '#default_value' => $pageear->inTransition, |
| 427 | '#required' => TRUE, |
| 428 | ); |
| 429 | |
| 430 | // Duration of in transition (1-9). |
| 431 | $form['details']['image_settings']['transitionDuration'] = array( |
| 432 | '#type' => 'textfield', |
| 433 | '#title' => t('Transition Duration'), |
| 434 | '#description' => t('Duration of in transition. (1-9)'), |
| 435 | '#required' => TRUE, |
| 436 | '#default_value' => $pageear->transitionDuration, |
| 437 | '#maxlength' => 1, |
| 438 | '#size' => 8, |
| 439 | ); |
| 440 | |
| 441 | // Style of peel back color. |
| 442 | $form['details']['image_settings']['peelColorStyle'] = array( |
| 443 | '#type' => 'radios', |
| 444 | '#title' => t('Back color style'), |
| 445 | '#description' => t('Choose a flat or gradient color for the back of the peel.'), |
| 446 | '#options' => pageear_get_options('peelColorStyle'), |
| 447 | '#default_value' => $pageear->peelColorStyle, |
| 448 | '#required' => TRUE, |
| 449 | ); |
| 450 | |
| 451 | // Color of peel back. |
| 452 | $form['details']['image_settings']['peelColor'] = array( |
| 453 | '#type' => 'radios', |
| 454 | '#title' => t('Back color'), |
| 455 | '#description' => t('This color will be used on the back of peel.'), |
| 456 | '#options' => pageear_get_options('peelColor'), |
| 457 | '#default_value' => $pageear->peelColor, |
| 458 | '#required' => TRUE, |
| 459 | ); |
| 460 | |
| 461 | // Custom color. |
| 462 | $form['details']['image_settings']['custom_color'] = array( |
| 463 | '#type' => 'fieldset', |
| 464 | '#title' => t('Custom Color'), |
| 465 | '#collapsible' => TRUE, |
| 466 | ); |
| 467 | |
| 468 | // Custom Color on Peel. |
| 469 | $form['details']['image_settings']['custom_color'] = array( |
| 470 | '#type' => 'textfield', |
| 471 | '#title' => t('Custom Color'), |
| 472 | '#required' => TRUE, |
| 473 | '#prefix' => '<div id="pageear_customcolor_picker"></div>', |
| 474 | '#default_value' => rgb2hex($pageear->redValue, $pageear->greenValue, $pageear->blueValue), |
| 475 | '#maxlength' => 7, |
| 476 | '#size' => 8, |
| 477 | ); |
| 478 | |
| 479 | // Red Value for Custom Color Peel. |
| 480 | $form['details']['image_settings']['redValue'] = array( |
| 481 | '#type' => 'hidden', |
| 482 | '#value' => $pageear->redValue, |
| 483 | ); |
| 484 | |
| 485 | // Green Value for Custom Color Peel. |
| 486 | $form['details']['image_settings']['greenValue'] = array( |
| 487 | '#type' => 'hidden', |
| 488 | '#value' => $pageear->greenValue, |
| 489 | ); |
| 490 | |
| 491 | // Blue Value for Custom Color Peel. |
| 492 | $form['details']['image_settings']['blueValue'] = array( |
| 493 | '#type' => 'hidden', |
| 494 | '#value' => $pageear->blueValue, |
| 495 | ); |
| 496 | // End Image Settings. |
| 497 | |
| 498 | |
| 499 | // Sound Settings. |
| 500 | $form['details']['sound_settings'] = array( |
| 501 | '#type' => 'fieldset', |
| 502 | '#title' => t('Sound Settings'), |
| 503 | '#collapsible' => TRUE, |
| 504 | '#collapsed' => TRUE, |
| 505 | ); |
| 506 | |
| 507 | // URL to onload sound. |
| 508 | $form['details']['sound_settings']['loadSoundURL'] = array( |
| 509 | '#type' => 'item', |
| 510 | '#title' => t('Onload Sound'), |
| 511 | '#value' => $pageear->loadSoundURL, |
| 512 | ); |
| 513 | |
| 514 | $form['details']['sound_settings']['loadSoundURL_upload'] = array( |
| 515 | '#type' => 'file', |
| 516 | '#description' => t('Upload an mp3 file to play when the ad is loaded.'), |
| 517 | '#tree' => FALSE, |
| 518 | '#size' => 40, |
| 519 | ); |
| 520 | |
| 521 | if ($pageear->loadSoundURL != "") { |
| 522 | $form['details']['sound_settings']['loadSoundRemove'] = array( |
| 523 | '#type' => 'checkbox', |
| 524 | '#default_value' => 0, |
| 525 | '#description' => t('Check this box if you want to remove load sound.'), |
| 526 | ); |
| 527 | } |
| 528 | |
| 529 | // URL to open peel sound. |
| 530 | $form['details']['sound_settings']['openSoundURL'] = array( |
| 531 | '#type' => 'item', |
| 532 | '#title' => t('Open Peel Sound'), |
| 533 | '#value' => $pageear->openSoundURL, |
| 534 | ); |
| 535 | |
| 536 | $form['details']['sound_settings']['openSoundURL_upload'] = array( |
| 537 | '#type' => 'file', |
| 538 | '#description' => t('Upload an mp3 file to play when the peel is opened.'), |
| 539 | '#tree' => FALSE, |
| 540 | '#size' => 40, |
| 541 | ); |
| 542 | |
| 543 | if ($pageear->openSoundURL != "") { |
| 544 | $form['details']['sound_settings']['openSoundRemove'] = array( |
| 545 | '#type' => 'checkbox', |
| 546 | '#default_value' => 0, |
| 547 | '#description' => t('Check this box if you want to remove open sound.'), |
| 548 | ); |
| 549 | } |
| 550 | |
| 551 | // URL to close peel sound. |
| 552 | $form['details']['sound_settings']['closeSoundURL'] = array( |
| 553 | '#type' => 'item', |
| 554 | '#title' => t('Close Peel Sound'), |
| 555 | '#value' => $pageear->closeSoundURL, |
| 556 | ); |
| 557 | |
| 558 | $form['details']['sound_settings']['closeSoundURL_upload'] = array( |
| 559 | '#type' => 'file', |
| 560 | '#description' => t('Upload an mp3 file to play when the peel is closed.'), |
| 561 | '#tree' => FALSE, |
| 562 | '#size' => 40, |
| 563 | ); |
| 564 | |
| 565 | if ($pageear->closeSoundURL != "") { |
| 566 | $form['details']['sound_settings']['closeSoundRemove'] = array( |
| 567 | '#type' => 'checkbox', |
| 568 | '#default_value' => 0, |
| 569 | '#description' => t('Check this box if you want to remove close sound.'), |
| 570 | ); |
| 571 | } |
| 572 | // End Sound Settings. |
| 573 | |
| 574 | |
| 575 | // Linking Settings. |
| 576 | $form['details']['linking_settings'] = array( |
| 577 | '#type' => 'fieldset', |
| 578 | '#title' => t('URL Settings'), |
| 579 | '#collapsible' => TRUE, |
| 580 | '#collapsed' => TRUE, |
| 581 | ); |
| 582 | |
| 583 | // Link Enable ( true | false ). |
| 584 | $form['details']['linking_settings']['linkEnabled'] = array( |
| 585 | '#type' => 'checkbox', |
| 586 | '#title' => t('Enabled'), |
| 587 | '#default_value' => $pageear->linkEnabled, |
| 588 | '#description' => t('Enable or disable the link.'), |
| 589 | ); |
| 590 | |
| 591 | // URL to open on pageear click. |
| 592 | $form['details']['linking_settings']['link'] = array( |
| 593 | '#type' => 'textfield', |
| 594 | '#title' => t('URL'), |
| 595 | '#description' => t('URL to go when user click on the ad.'), |
| 596 | '#required' => TRUE, |
| 597 | '#default_value' => $pageear->link, |
| 598 | '#size' => 40, |
| 599 | ); |
| 600 | |
| 601 | // Browser target (new) or self (self). |
| 602 | $form['details']['linking_settings']['linkTarget'] = array( |
| 603 | '#type' => 'radios', |
| 604 | '#title' => t('URL target'), |
| 605 | '#description' => t('Where to open the URL.'), |
| 606 | '#options' => pageear_get_options('linkTarget'), |
| 607 | '#default_value' => $pageear->linkTarget, |
| 608 | '#required' => TRUE, |
| 609 | ); |
| 610 | //End Linking Settings. |
| 611 | |
| 612 | |
| 613 | // Motion Settings. |
| 614 | $form['details']['motion_settings'] = array( |
| 615 | '#type' => 'fieldset', |
| 616 | '#title' => t('Motion Settings'), |
| 617 | '#collapsible' => TRUE, |
| 618 | '#collapsed' => TRUE, |
| 619 | ); |
| 620 | |
| 621 | // Speed of flag movement (1-9). |
| 622 | $form['details']['motion_settings']['flagSpeed'] = array( |
| 623 | '#type' => 'textfield', |
| 624 | '#title' => t('Flag motion speed'), |
| 625 | '#description' => t('Speed for flag motion. (1-9)'), |
| 626 | '#required' => TRUE, |
| 627 | '#default_value' => $pageear->flagSpeed, |
| 628 | '#maxlength' => 1, |
| 629 | '#size' => 8, |
| 630 | ); |
| 631 | |
| 632 | // Speed of peel movement (1-9). |
| 633 | $form['details']['motion_settings']['peelSpeed'] = array( |
| 634 | '#type' => 'textfield', |
| 635 | '#title' => t('Peel motion speed'), |
| 636 | '#description' => t('Speed for peel motion. (1-9)'), |
| 637 | '#required' => TRUE, |
| 638 | '#default_value' => $pageear->peelSpeed, |
| 639 | '#maxlength' => 1, |
| 640 | '#size' => 8, |
| 641 | ); |
| 642 | |
| 643 | // Opens pageear automaticaly after configured seconds. |
| 644 | $form['details']['motion_settings']['automaticOpen'] = array( |
| 645 | '#type' => 'textfield', |
| 646 | '#title' => t('Automatically peel on load'), |
| 647 | '#description' => t('Unpeel automatically when the page loads after configured seconds. 0 means no automatically open.'), |
| 648 | '#required' => TRUE, |
| 649 | '#default_value' => $pageear->automaticOpen, |
| 650 | '#maxlength' => 3, |
| 651 | '#size' => 8, |
| 652 | ); |
| 653 | |
| 654 | // Seconds until pageear close after automatically open. |
| 655 | $form['details']['motion_settings']['automaticClose'] = array( |
| 656 | '#type' => 'textfield', |
| 657 | '#title' => t('Automatically unpeel'), |
| 658 | '#description' => t('Automatically close after unpeeling after configured seconds. 0 means no automatically unpeel.'), |
| 659 | '#required' => TRUE, |
| 660 | '#default_value' => $pageear->automaticClose, |
| 661 | '#maxlength' => 3, |
| 662 | '#size' => 8, |
| 663 | ); |
| 664 | // End Motion Settings. |
| 665 | |
| 666 | |
| 667 | // Close button settings. |
| 668 | $form['details']['closebutton_settings'] = array( |
| 669 | '#type' => 'fieldset', |
| 670 | '#title' => t('Close Button Settings'), |
| 671 | '#collapsible' => TRUE, |
| 672 | '#collapsed' => TRUE, |
| 673 | ); |
| 674 | |
| 675 | // Clickable button on open peel ( true | false ). |
| 676 | $form['details']['closebutton_settings']['close_button_enable'] = array( |
| 677 | '#type' => 'checkbox', |
| 678 | '#title' => t('Close Button'), |
| 679 | '#default_value' => $pageear->close_button_enable, |
| 680 | '#description' => t('Show a close button on open peel. If this is enabled the peel will not close on mouse out. Users must click button to close peel.'), |
| 681 | ); |
| 682 | |
| 683 | // Text on close button. |
| 684 | $form['details']['closebutton_settings']['text_on_close_button'] = array( |
| 685 | '#type' => 'textfield', |
| 686 | '#title' => t('Close Button Text'), |
| 687 | '#description' => t('Text on clickable close button.'), |
| 688 | '#required' => TRUE, |
| 689 | '#default_value' => $pageear->text_on_close_button, |
| 690 | '#size' => 40, |
| 691 | ); |
| 692 | |
| 693 | // Close Button Color. |
| 694 | $form['details']['closebutton_settings']['closebutton_color'] = array( |
| 695 | '#type' => 'textfield', |
| 696 | '#title' => t('Close Button Color'), |
| 697 | '#required' => TRUE, |
| 698 | '#prefix' => '<div id="pageear_closebuttoncolor_picker"></div>', |
| 699 | '#default_value' => rgb2hex($pageear->close_redValue, $pageear->close_greenValue, $pageear->close_blueValue), |
| 700 | '#maxlength' => 7, |
| 701 | '#size' => 8, |
| 702 | ); |
| 703 | |
| 704 | // Close Button Color Red Value. |
| 705 | $form['details']['closebutton_settings']['close_redValue'] = array( |
| 706 | '#type' => 'hidden', |
| 707 | '#value' => $pageear->close_redValue, |
| 708 | ); |
| 709 | |
| 710 | // Close Button Color Green Value. |
| 711 | $form['details']['closebutton_settings']['close_greenValue'] = array( |
| 712 | '#type' => 'hidden', |
| 713 | '#value' => $pageear->close_greenValue, |
| 714 | ); |
| 715 | |
| 716 | // Close Button Color Blue Value. |
| 717 | $form['details']['closebutton_settings']['close_blueValue'] = array( |
| 718 | '#type' => 'hidden', |
| 719 | '#value' => $pageear->close_blueValue, |
| 720 | ); |
| 721 | // End Close Button Settings. |
| 722 | |
| 723 | |
| 724 | // Visibility settings. |
| 725 | $form['visibility_settings'] = array( |
| 726 | '#type' => 'fieldset', |
| 727 | '#title' => t('Pageear visibility settings'), |
| 728 | '#collapsible' => TRUE, |
| 729 | '#collapsed' => TRUE, |
| 730 | ); |
| 731 | |
| 732 | // Language-based visibility settings - only visible if 'locale' module enabled |
| 733 | if (module_exists('locale')) { |
| 734 | $form['visibility_settings']['language_vis_settings'] = array( |
| 735 | '#type' => 'fieldset', |
| 736 | '#title' => t('Language specific visibility settings'), |
| 737 | '#collapsible' => TRUE, |
| 738 | '#collapsed' => TRUE, |
| 739 | ); |
| 740 | $language_options = locale_language_list('name'); |
| 741 | $form['visibility_settings']['language_vis_settings']['languages'] = array( |
| 742 | '#type' => 'checkboxes', |
| 743 | '#title' => t('Show pageear for specific languages'), |
| 744 | '#options' => $language_options, |
| 745 | '#default_value' => explode(',', $pageear->languages), |
| 746 | '#description' => t('Show the pageear only for the selected language(s). If you select no languages, the pageear will be visible for all languages.'), |
| 747 | ); |
| 748 | } |
| 749 | |
| 750 | // Role-based visibility settings (mostly borrowed from 'block.admin.inc') |
| 751 | $result = db_query('SELECT rid, name FROM {role} ORDER BY name'); |
| 752 | $role_options = array(); |
| 753 | while ($role = db_fetch_object($result)) { |
| 754 | $role_options[$role->rid] = $role->name; |
| 755 | } |
| 756 | $form['visibility_settings']['roles_vis_settings'] = array( |
| 757 | '#type' => 'fieldset', |
| 758 | '#title' => t('Role specific visibility settings'), |
| 759 | '#collapsible' => TRUE, |
| 760 | '#collapsed' => TRUE, |
| 761 | ); |
| 762 | $form['visibility_settings']['roles_vis_settings']['roles'] = array( |
| 763 | '#type' => 'checkboxes', |
| 764 | '#title' => t('Show pageear for specific roles'), |
| 765 | '#options' => $role_options, |
| 766 | '#default_value' => explode(',', $pageear->roles), |
| 767 | '#description' => t('Show the pageear only for the selected role(s). If you select no roles, the pageear will be visible to all users.'), |
| 768 | ); |
| 769 | |
| 770 | // Page visibility settings |
| 771 | $form['visibility_settings']['page_vis_settings'] = array( |
| 772 | '#type' => 'fieldset', |
| 773 | '#title' => t('Page specific visibility settings'), |
| 774 | '#collapsible' => TRUE, |
| 775 | '#collapsed' => TRUE, |
| 776 | ); |
| 777 | $access = user_access('use PHP for pageear visibility'); |
| 778 | |
| 779 | if ($pageear->visibility == 2 && !$access) { |
| 780 | $form['visibility_settings']['page_vis_settings'] = array(); |
| 781 | $form['visibility_settings']['page_vis_settings']['visibility'] = array( |
| 782 | '#type' => 'value', |
| 783 | '#value' => 2, |
| 784 | ); |
| 785 | $form['visibility_settings']['page_vis_settings']['pages'] = array( |
| 786 | '#type' => 'value', |
| 787 | '#value' => $pageear->pages, |
| 788 | ); |
| 789 | } |
| 790 | else { |
| 791 | $options = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')); |
| 792 | $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')); |
| 793 | |
| 794 | if ($access) { |
| 795 | $options[] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).'); |
| 796 | $description .= ' '. t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>')); |
| 797 | } |
| 798 | $form['visibility_settings']['page_vis_settings']['visibility'] = array( |
| 799 | '#type' => 'radios', |
| 800 | '#title' => t('Show pageear on specific pages'), |
| 801 | '#options' => $options, |
| 802 | '#default_value' => $pageear->visibility, |
| 803 | ); |
| 804 | $form['visibility_settings']['page_vis_settings']['pages'] = array( |
| 805 | '#type' => 'textarea', |
| 806 | '#title' => t('Pages'), |
| 807 | '#default_value' => $pageear->pages, |
| 808 | '#description' => $description, |
| 809 | ); |
| 810 | } |
| 811 | |
| 812 | |
| 813 | if ($op == 'edit') { |
| 814 | $form['submit'] = array( |
| 815 | '#type' => 'submit', |
| 816 | '#value' => t('Save'), |
| 817 | ); |
| 818 | $form['cancel'] = array( |
| 819 | '#type' => 'markup', |
| 820 | '#value' => l(t('Cancel'), referer_uri()), |
| 821 | ); |
| 822 | } |
| 823 | elseif ($op == 'add' || $op == 'clone') { |
| 824 | $form['submit'] = array( |
| 825 | '#type' => 'submit', |
| 826 | '#value' => t('Save'), |
| 827 | '#submit' => array('pageear_admin_add_submit'), |
| 828 | ); |
| 829 | $form['cancel'] = array( |
| 830 | '#type' => 'markup', |
| 831 | '#value' => l(t('Cancel'), referer_uri()), |
| 832 | ); |
| 833 | } |
| 834 | |
| 835 | return $form; |
| 836 | } |
| 837 | |
| 838 | /** |
| 839 | * hook_validate: validation function for the pageear configuration form. |
| 840 | */ |
| 841 | function pageear_admin_edit_validate($form, &$form_state) { |
| 842 | |
| 843 | $directory_path = file_directory_path() .'/'. PAGEEAR_PATH_IMAGES; |
| 844 | |
| 845 | // checks if directory exist and creates it if it don't |
| 846 | file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path'); |
| 847 | |
| 848 | if ($file = file_save_upload('waitURL_upload')) { //, array('file_validate_is_image' => array()))) { |
| 849 | |
| 850 | $parts = pathinfo($file->filename); |
| 851 | |
| 852 | if ($parts['extension'] != 'jpeg' && $parts['extension'] != 'jpg' && $parts['extension'] != 'gif' && $parts['extension'] != 'png') { |
| 853 | |
| 854 | file_delete($file->filepath); |
| 855 | form_set_error('waitURL_upload', t('Uploaded file must be an image. JPEG, PNG or GIF')); |
| 856 | |
| 857 | } |
| 858 | else { |
| 859 | |
| 860 | $dest_filename = $directory_path .'/waitURL_'. $form_state['values']['peid'] .'.'. $parts['extension']; |
| 861 | $source_path = $file->filepath; |
| 862 | |
| 863 | if (file_copy($source_path, $dest_filename)) { |
| 864 | file_delete($file->filepath); |
| 865 | form_set_value($form['details']['wait_settings']['waitURL'], $source_path, $form_state); |
| 866 | } |
| 867 | else{ |
| 868 | file_delete($file->filepath); |
| 869 | form_set_error('waitURL_upload', t('Wait icon upload failed. Please try again.')); |
| 870 | } |
| 871 | |
| 872 | } |
| 873 | } |
| 874 | else { |
| 875 | form_set_value($form['details']['wait_settings']['waitURL'], $form['details']['wait_settings']['waitURL']['#value'], $form_state); |
| 876 | } |
| 877 | |
| 878 | // uploads images from image upload fields |
| 879 | foreach (array('smallURL', 'bigURL') as $image) { |
| 880 | |
| 881 | if ($file = file_save_upload($image .'_upload')) { //, array('file_validate_is_image' => array()))) { |
| 882 | |
| 883 | $parts = pathinfo($file->filename); |
| 884 | |
| 885 | if ($parts['extension'] != 'jpeg' && $parts['extension'] != 'jpg' && $parts['extension'] != 'gif' && $parts['extension'] != 'png' && $parts['extension'] != 'swf') { |
| 886 | |
| 887 | file_delete($file->filepath); |
| 888 | form_set_error($image .'_upload', t('Uploaded file must be an image or flash movie. JPEG, PNG, GIF or SWF')); |
| 889 | |
| 890 | } |
| 891 | else { |
| 892 | |
| 893 | $dest_filename = $directory_path .'/'. $image .'_'. $form_state['values']['peid'] .'.'. $parts['extension']; |
| 894 | $source_path = $file->filepath; |
| 895 | |
| 896 | if (file_copy($source_path, $dest_filename)) { |
| 897 | file_delete($file->filepath); |
| 898 | form_set_value($form['details']['image_settings'][$image], $source_path, $form_state); |
| 899 | } |
| 900 | else{ |
| 901 | file_delete($file->filepath); |
| 902 | form_set_error($image .'_upload', t('Media uploaded failed. Please try again.')); |
| 903 | } |
| 904 | |
| 905 | } |
| 906 | } |
| 907 | else { |
| 908 | form_set_value($form['details']['image_settings'][$image], $form['details']['image_settings'][$image]['#value'], $form_state); |
| 909 | } |
| 910 | |
| 911 | } |
| 912 | |
| 913 | // uploads images from sound upload fields |
| 914 | foreach (array('loadSoundURL', 'openSoundURL', 'closeSoundURL') as $sound) { |
| 915 | |
| 916 | if ($file = file_save_upload($sound .'_upload')) { |
| 917 | |
| 918 | $parts = pathinfo($file->filename); |
| 919 | |
| 920 | if ($parts['extension'] != 'mp3') { |
| 921 | |
| 922 | file_delete($file->filepath); |
| 923 | form_set_error($sound .'_upload', t('Uploaded sound must be a MP3 file.')); |
| 924 | |
| 925 | } |
| 926 | else { |
| 927 | |
| 928 | $dest_filename = $directory_path .'/'. $sound .'_'. $form_state['values']['peid'] .'.'. $parts['extension']; |
| 929 | $source_path = $file->filepath; |
| 930 | |
| 931 | if (file_copy($source_path, $dest_filename)) { |
| 932 | file_delete($file->filepath); |
| 933 | form_set_value($form['details']['sound_settings'][$sound], $source_path, $form_state); |
| 934 | } |
| 935 | else { |
| 936 | file_delete($file->filepath); |
| 937 | form_set_error($sound .'_upload', t('Sound uploaded failed. Please try again.')); |
| 938 | } |
| 939 | |
| 940 | } |
| 941 | } |
| 942 | else { |
| 943 | form_set_value($form['details']['sound_settings'][$sound], $form['details']['sound_settings'][$sound]['#value'], $form_state); |
| 944 | } |
| 945 | |
| 946 | } |
| 947 | |
| 948 | // Remove sounds checked for removal |
| 949 | // TODO remove files too or wait till they are removed when the pageear is removed? |
| 950 | if ($form_state['values']['loadSoundRemove']) { |
| 951 | form_set_value($form['details']['sound_settings']['loadSoundURL'], '', $form_state); |
| 952 | } |
| 953 | if ($form_state['values']['openSoundRemove']) { |
| 954 | form_set_value($form['details']['sound_settings']['openSoundURL'], '', $form_state); |
| 955 | } |
| 956 | if ($form_state['values']['closeSoundRemove']) { |
| 957 | form_set_value($form['details']['sound_settings']['closeSoundURL'], '', $form_state); |
| 958 | } |
| 959 | |
| 960 | // Sizes validation |
| 961 | // TODO Review if I must restrict this more. For example test the ratio peel/flag. |
| 962 | if (!is_numeric($form_state['values']['waitWidth']) || $form_state['values']['waitWidth'] < 10) { |
| 963 | form_set_error('waitWidth', t('Wait Icon Width must be a number greater than 10')); |
| 964 | } |
| 965 | if (!is_numeric($form_state['values']['waitHeight']) || $form_state['values']['waitHeight'] < 10) { |
| 966 | form_set_error('waitHeight', t('Wait Icon Height must be a number greater than 10')); |
| 967 | } |
| 968 | if (!is_numeric($form_state['values']['flagWidth']) || $form_state['values']['flagWidth'] < 10) { |
| 969 | form_set_error('flagWidth', t('Flag Width must be a number greater than 10')); |
| 970 | } |
| 971 | if (!is_numeric($form_state['values']['flagHeight']) || $form_state['values']['flagHeight'] < 10) { |
| 972 | form_set_error('flagHeight', t('Flag Height must be a number greater than 10')); |
| 973 | } |
| 974 | if (!is_numeric($form_state['values']['peelWidth']) || $form_state['values']['peelWidth'] < 50) { |
| 975 | form_set_error('peelWidth', t('Peel Width must be a number greater than 50')); |
| 976 | } |
| 977 | if (!is_numeric($form_state['values']['peelHeight']) || $form_state['values']['peelHeight'] < 50) { |
| 978 | form_set_error('peelHeight', t('Peel Height must be a number greater than 50')); |
| 979 | } |
| 980 | |
| 981 | // Duration of transition validation |
| 982 | if (!is_numeric($form_state['values']['transitionDuration']) || $form_state['values']['transitionDuration'] == 0) { |
| 983 | form_set_error('transitionDuration', t('Transition duration must be a number between 1 and 9')); |
| 984 | } |
| 985 | |
| 986 | // Peel custom color validation. |
| 987 | // If user sets color manually with input textfield wrong hex values would be ignored by conversion function. |
| 988 | $custom_rgb_peel_color = hex2rgb($form_state['values']['custom_color']); |
| 989 | form_set_value($form['details']['image_settings']['redValue'], $custom_rgb_peel_color[0], $form_state); |
| 990 | form_set_value($form['details']['image_settings']['greenValue'], $custom_rgb_peel_color[1], $form_state); |
| 991 | form_set_value($form['details']['image_settings']['blueValue'], $custom_rgb_peel_color[2], $form_state); |
| 992 | |
| 993 | // Flag speed validation |
| 994 | if (!is_numeric($form_state['values']['flagSpeed']) || $form_state['values']['flagSpeed'] == 0) { |
| 995 | form_set_error('flagSpeed', t('Flag motion speed must be a number between 1 and 9')); |
| 996 | } |
| 997 | |
| 998 | // Peel speed validation |
| 999 | if (!is_numeric($form_state['values']['peelSpeed']) || $form_state['values']['peelSpeed'] == 0) { |
| 1000 | form_set_error('peelSpeed', t('Peel motion speed must be a number between 1 and 9')); |
| 1001 | } |
| 1002 | |
| 1003 | // AutomaticOpen validation |
| 1004 | if (!is_numeric($form_state['values']['automaticOpen']) || $form_state['values']['automaticOpen'] < 0) { |
| 1005 | form_set_error('automaticOpen', t('Automatically peel onload seconds must be a number between 0 and 999')); |
| 1006 | } |
| 1007 | |
| 1008 | // AutomaticClose validation |
| 1009 | if (!is_numeric($form_state['values']['automaticClose']) || $form_state['values']['automaticClose'] < 0) { |
| 1010 | form_set_error('automaticClose', t('Automatically peel onclose seconds must be a number between 0 and 999')); |
| 1011 | } |
| 1012 | |
| 1013 | // Close button color validation |
| 1014 | // If user sets color manually with input textfield wrong hex values would be ignored by conversion function. |
| 1015 | $custom_rgb_close_button_color = hex2rgb($form_state['values']['closebutton_color']); |
| 1016 | form_set_value($form['details']['closebutton_settings']['close_redValue'], $custom_rgb_close_button_color[0], $form_state); |
| 1017 | form_set_value($form['details']['closebutton_settings']['close_greenValue'], $custom_rgb_close_button_color[1], $form_state); |
| 1018 | form_set_value($form['details']['closebutton_settings']['close_blueValue'], $custom_rgb_close_button_color[2], $form_state); |
| 1019 | |
| 1020 | } |
| 1021 | |
| 1022 | /** |
| 1023 | * hook_submit: submit function for the pageear configuration form. |
| 1024 | */ |
| 1025 | function pageear_admin_edit_submit($form, &$form_state) { |
| 1026 | |
| 1027 | // Save the edited pageear |
| 1028 | if (!form_get_errors()) { |
| 1029 | |
| 1030 | if (module_exists('locale')) { |
| 1031 | $languages = implode(',', $form_state['values']['languages']); |
| 1032 | } |
| 1033 | else { |
| 1034 | $languages = ''; |
| 1035 | } |
| 1036 | |
| 1037 | $roles = implode(',', $form_state['values']['roles']); |
| 1038 | |
| 1039 | $new_pageear = new stdClass(); |
| 1040 | |
| 1041 | $new_pageear->peid = $form_state['values']['peid']; |
| 1042 | $new_pageear->status = $form_state['values']['status']; |
| 1043 | $new_pageear->name = $form_state['values']['name']; |
| 1044 | $new_pageear->peelPosition = $form_state['values']['peelPosition']; |
| 1045 | $new_pageear->peelPositionModel = $form_state['values']['peelPositionModel']; |
| 1046 | $new_pageear->waitEnable = $form_state['values']['waitEnable']; |
| 1047 | $new_pageear->waitWidth = $form_state['values']['waitWidth']; |
| 1048 | $new_pageear->waitHeight = $form_state['values']['waitHeight']; |
| 1049 | $new_pageear->waitURL = $form_state['values']['waitURL']; |
| 1050 | $new_pageear->flagStyle = $form_state['values']['flagStyle']; |
| 1051 | $new_pageear->peelStyle = $form_state['values']['peelStyle']; |
| 1052 | $new_pageear->flagWidth = $form_state['values']['flagWidth']; |
| 1053 | $new_pageear->flagHeight = $form_state['values']['flagHeight']; |
| 1054 | $new_pageear->peelWidth = $form_state['values']['peelWidth']; |
| 1055 | $new_pageear->peelHeight = $form_state['values']['peelHeight']; |
| 1056 | $new_pageear->smallURL = $form_state['values']['smallURL']; |
| 1057 | $new_pageear->bigURL = $form_state['values']['bigURL']; |
| 1058 | $new_pageear->mirror = $form_state['values']['mirror']; |
| 1059 | $new_pageear->inTransition = $form_state['values']['inTransition']; |
| 1060 | $new_pageear->transitionDuration = $form_state['values']['transitionDuration']; |
| 1061 | $new_pageear->peelColorStyle = $form_state['values']['peelColorStyle']; |
| 1062 | $new_pageear->peelColor = $form_state['values']['peelColor']; |
| 1063 | $new_pageear->redValue = $form_state['values']['redValue']; |
| 1064 | $new_pageear->greenValue = $form_state['values']['greenValue']; |
| 1065 | $new_pageear->blueValue = $form_state['values']['blueValue']; |
| 1066 | $new_pageear->linkEnabled = $form_state['values']['linkEnabled']; |
| 1067 | $new_pageear->linkTarget = $form_state['values']['linkTarget']; |
| 1068 | $new_pageear->link = $form_state['values']['link']; |
| 1069 | $new_pageear->loadSoundURL = $form_state['values']['loadSoundURL']; |
| 1070 | $new_pageear->openSoundURL = $form_state['values']['openSoundURL']; |
| 1071 | $new_pageear->closeSoundURL = $form_state['values']['closeSoundURL']; |
| 1072 | $new_pageear->flagSpeed = $form_state['values']['flagSpeed']; |
| 1073 | $new_pageear->peelSpeed = $form_state['values']['peelSpeed']; |
| 1074 | $new_pageear->automaticOpen = $form_state['values']['automaticOpen']; |
| 1075 | $new_pageear->automaticClose = $form_state['values']['automaticClose']; |
| 1076 | $new_pageear->close_button_enable = $form_state['values']['close_button_enable']; |
| 1077 | $new_pageear->text_on_close_button = $form_state['values']['text_on_close_button']; |
| 1078 | $new_pageear->close_redValue = $form_state['values']['close_redValue']; |
| 1079 | $new_pageear->close_greenValue = $form_state['values']['close_greenValue' |