$edited_ComponentWidget = new ComponentWidget(NULL, 'plugin', $code); break; default: debug_die('Unhandled widget type'); } $edited_ComponentWidget->set('coll_ID', $Blog->ID); $edited_ComponentWidget->set('sco_name', $container); $edited_ComponentWidget->set('enabled', 1); // INSERT INTO DB: $edited_ComponentWidget->dbinsert(); $Messages->add(sprintf(T_('Widget «%s» has been added to container «%s».'), $edited_ComponentWidget->get_name(), T_($container)), 'success'); switch ($display_mode) { case 'js': // this is a js call, lets return the settings page -- fp> what do you mean "settings page" ? // fp> wthis will visually live insert the new widget into the container; it probably SHOULD open the edit properties right away send_javascript_message(array('addNewWidgetCallback' => array($edited_ComponentWidget->ID, $container, $edited_ComponentWidget->get('order'), '<a href="' . regenerate_url('blog', 'action=edit&wi_ID=' . $edited_ComponentWidget->ID) . '" class="widget_name">' . $edited_ComponentWidget->get_desc_for_list() . '</a> ' . $edited_ComponentWidget->get_help_link(), $edited_ComponentWidget->get_cache_status(true)), 'editWidget' => array('wi_ID_' . $edited_ComponentWidget->ID))); break; case 'normal': default: // take usual action header_redirect('?ctrl=widgets&action=edit&wi_ID=' . $edited_ComponentWidget->ID); break; } break; case 'update': case 'update_edit': // Update Settings // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('widget'); $edited_ComponentWidget->load_from_Request(); if (!param_errors_detected()) {
} break; case 'update': // Update Settings // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('widget'); $edited_ComponentWidget->load_from_Request(); if (!param_errors_detected()) { // Update settings: $edited_ComponentWidget->dbupdate(); $Messages->add(T_('Widget settings have been updated'), 'success'); switch ($display_mode) { case 'js': // js reply $edited_ComponentWidget->init_display(array()); send_javascript_message(array('widgetSettingsCallback' => array($edited_ComponentWidget->ID, $edited_ComponentWidget->get_desc_for_list()), 'closeWidgetSettings' => array()), true); break; } $action = 'list'; $Session->set('fadeout_id', $edited_ComponentWidget->ID); header_redirect('?ctrl=widgets&blog=' . $Blog->ID, 303); } elseif ($display_mode == 'js') { // send errors back as js send_javascript_message(array(), true); } break; case 'move_up': // Move the widget up: // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('widget'); $order = $edited_ComponentWidget->order;