comparison modules/book/book.pages.inc @ 9:acef7ccb09b5 6.4

Drupal 6.4
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:32:08 +0100
parents c1f4ac30525a
children
comparison
equal deleted inserted replaced
8:85cbd6048071 9:acef7ccb09b5
1 <?php 1 <?php
2 // $Id: book.pages.inc,v 1.5 2007/12/22 23:24:24 goba Exp $ 2 // $Id: book.pages.inc,v 1.5.2.1 2008/08/13 23:59:13 drumm Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * User page callbacks for the book module. 6 * User page callbacks for the book module.
7 */ 7 */
229 * A bid from from among those in the form's book select. 229 * A bid from from among those in the form's book select.
230 * @return 230 * @return
231 * Prints the replacement HTML in JSON format. 231 * Prints the replacement HTML in JSON format.
232 */ 232 */
233 function book_form_update() { 233 function book_form_update() {
234 $cid = 'form_'. $_POST['form_build_id'];
235 $bid = $_POST['book']['bid']; 234 $bid = $_POST['book']['bid'];
236 $cache = cache_get($cid, 'cache_form'); 235 if ($form = form_get_cache($_POST['form_build_id'], $form_state)) {
237 if ($cache) {
238 $form = $cache->data;
239 236
240 // Validate the bid. 237 // Validate the bid.
241 if (isset($form['book']['bid']['#options'][$bid])) { 238 if (isset($form['book']['bid']['#options'][$bid])) {
242 $book_link = $form['#node']->book; 239 $book_link = $form['#node']->book;
243 $book_link['bid'] = $bid; 240 $book_link['bid'] = $bid;
244 // Get the new options and update the cache. 241 // Get the new options and update the cache.
245 $form['book']['plid'] = _book_parent_select($book_link); 242 $form['book']['plid'] = _book_parent_select($book_link);
246 cache_set($cid, $form, 'cache_form', $cache->expire); 243 form_set_cache($_POST['form_build_id'], $form, $form_state);
247 244
248 // Build and render the new select element, then return it in JSON format. 245 // Build and render the new select element, then return it in JSON format.
249 $form_state = array(); 246 $form_state = array();
250 $form['#post'] = array(); 247 $form['#post'] = array();
251 $form = form_builder($form['form_id']['#value'] , $form, $form_state); 248 $form = form_builder($form['form_id']['#value'] , $form, $form_state);