Пример #1
0
             $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&amp;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()) {
Пример #2
0
             $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 &laquo;%s&raquo; has been added to container &laquo;%s&raquo;.'), $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'), $edited_ComponentWidget->get_name()), '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':
     // 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: