/[drupal]/contributions/modules/bookmarks/bookmarks.module
ViewVC logotype

Diff of /contributions/modules/bookmarks/bookmarks.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.47.2.6 by darthclue, Sun Jan 25 04:06:05 2009 UTC revision 1.47.2.7 by darthclue, Tue Mar 17 12:27:52 2009 UTC
# Line 265  function bookmarks_block($op = 'list', $ Line 265  function bookmarks_block($op = 'list', $
265          //Purge from navigation menu.  We don't want these to show under Site Building / Bookmarks.          //Purge from navigation menu.  We don't want these to show under Site Building / Bookmarks.
266          db_query("DELETE FROM {menu_links} WHERE link_title = '%s'", 'bookmarks-'. $user->uid);          db_query("DELETE FROM {menu_links} WHERE link_title = '%s'", 'bookmarks-'. $user->uid);
267          //Insert default bookmarks          //Insert default bookmarks
268          $result = db_query("SELECT m.mlid FROM {menu_links} m WHERE m.menu_name='defaults'");          $result = db_query("SELECT m.mlid FROM {menu_links} m WHERE m.menu_name='bookmarks-defaults'");
269          $mobjs = array();          $mobjs = array();
270          while ($mlid = db_fetch_object($result)) {          while ($mlid = db_fetch_object($result)) {
271            $mlid = menu_link_load($mlid->mlid);            $mlid = menu_link_load($mlid->mlid);
# Line 289  function bookmarks_block($op = 'list', $ Line 289  function bookmarks_block($op = 'list', $
289        }        }
290      }      }
291      // Add admin options to bottom of block.      // Add admin options to bottom of block.
292      $block['content'] .= '<ul class="menu no-dhtml">';      $block['content'] .= '<div style="text-align:center;">';
     $block['content'] .= '<li class="expanded active-trail no-dhtml">Options';  
     $block['content'] .= '<ul class="menu no-dhtml">';  
293      $path = drupal_urlencode(drupal_get_normal_path(drupal_get_path_alias($_GET['q'])));      $path = drupal_urlencode(drupal_get_normal_path(drupal_get_path_alias($_GET['q'])));
294      if (!empty($path)) {      if (!empty($path)) {
295        $block['content'] .= '<li class="leaf first no-dhtml">'. l('Add this page', 'bookmarks/item/addpage/'. $path) .'</li>';        $block['content'] .= l(t('Add this page'), 'bookmarks/item/addpage/'. $path);
296        $block['content'] .= '<li class="leaf last no-dhtml">'. l('Customize', 'bookmarks/mine') .'</li>';        $block['content'] .= '&nbsp;|&nbsp;'. l(t('Customize'), 'bookmarks/mine');
297      }      }
298      else {      else {
299        $block['content'] .= '<li class="leaf no-dhtml">'. l('Customize', 'bookmarks/mine') .'</li>';        $block['content'] .= l(t('Customize'), 'bookmarks/mine');
300      }      }
301      $block['content'] .= '</ul>';      $block['content'] .= '</div>';
     $block['content'] .= '</li></ul>';  
302    
303      return $block;      return $block;
304    }    }
# Line 353  function bookmarks_get_menus($CUSER = FA Line 350  function bookmarks_get_menus($CUSER = FA
350    }    }
351    return $rows;    return $rows;
352  }  }
353    
354    /**
355     * Alter menu item editing form so that we can update bookmarks if menu items are changed.
356     */
357    function bookmarks_form_alter(&$form, $form_state, $form_id) {
358      if ($form_id=='menu_edit_item' && isset($form['menu']['#item'])) {
359        $form['#submit'][] = 'bookmarks_menu_edit_item_submit';
360      }
361    }
362    
363    /**
364     * Update bookmarks when menu items get changed
365     */
366    function bookmarks_menu_edit_item_submit($form_id, $form_values) {
367      // $form_values['values']['menu']['link_path']
368      // $form_values['values']['menu']['original_item']['link_path']
369      // select * from menu_links where menu_name like 'bookmarks-%' and link_path='';
370      $sql = "UPDATE {menu_links} set link_path = '%s' where menu_name like 'bookmarks-%' and link_path = '%s'";
371      $result = db_query($sql, $form_values['values']['menu']['link_path'], $form_values['values']['menu']['original_item']['link_path']);
372    }

Legend:
Removed from v.1.47.2.6  
changed lines
  Added in v.1.47.2.7

  ViewVC Help
Powered by ViewVC 1.1.3