Project

General

Profile

« Previous | Next » 

Revision 530

Added by doc over 16 years ago

introduced smart URL detection for the 'View' menu in the WB backend (if page_id is set, redirect to this page instead of the root)

View differences:

class.admin.php
108 108
													'BACKEND_MODULE_JS'  => $this->register_backend_modfiles('js')		// adds backend.js
109 109
													)
110 110
											);
111

  
112
		// work out the URL for the 'View menu' link in the WB backend
113
		// if the page_id is set, show this page otherwise show the root directory of WB
114
		$view_url = WB_URL;
115
		if(isset($_GET['page_id'])) {
116
			// extract page link from the database
117
			$result = @$database->query("SELECT link FROM " .TABLE_PREFIX ."pages WHERE page_id = '" .(int) $_GET['page_id'] ."'");
118
			$row = @$result->fetchRow();
119
			if($row) $view_url .= PAGES_DIRECTORY .$row['link'] .PAGE_EXTENSION;
120
		}
121

  
111 122
		// Create the menu
112 123
		$menu = array(
113 124
					array(ADMIN_URL.'/start/index.php', '', $MENU['START'], 'start', 0),
......
118 129
					array(ADMIN_URL.'/settings/index.php', '', $MENU['SETTINGS'], 'settings', 1),
119 130
					array(ADMIN_URL.'/access/index.php', '', $MENU['ACCESS'], 'access', 1),
120 131
					array('http://www.websitebaker.org/help/'.WB_VERSION, '_blank', $MENU['HELP'], 'help', 0),
121
					array(WB_URL.'/', '_blank', $MENU['VIEW'], 'view', 0),
132
					array($view_url, '_blank', $MENU['VIEW'], 'view', 0),
122 133
					array(ADMIN_URL.'/logout/index.php', '', $MENU['LOGOUT'], 'logout', 0)
123 134
					);
124 135
		$header_template->set_block('header_block', 'linkBlock', 'link');

Also available in: Unified diff