added a way to create multiple front pages.
not implemented the front page selector yet.
This commit is contained in:
		| @ -1,3 +1,8 @@ | |||||||
|  | ;------------------------------------------------------------------------------ | ||||||
|  | ; default site ID | ||||||
|  | ;------------------------------------------------------------------------------ | ||||||
|  | default_siteid = "default"; | ||||||
|  |  | ||||||
| ;------------------------------------------------------------------------------ | ;------------------------------------------------------------------------------ | ||||||
| ; banner to display when no project id is available | ; banner to display when no project id is available | ||||||
| ;------------------------------------------------------------------------------ | ;------------------------------------------------------------------------------ | ||||||
|  | |||||||
| @ -1,6 +1,17 @@ | |||||||
|  |  | ||||||
| USE codepot; | USE codepot; | ||||||
|  |  | ||||||
|  | CREATE TABLE site ( | ||||||
|  | 	id          VARCHAR(32)  PRIMARY KEY, | ||||||
|  | 	name        VARCHAR(128) NOT NULL, | ||||||
|  | 	text        TEXT         NOT NULL, | ||||||
|  |  | ||||||
|  | 	createdon   DATETIME, | ||||||
|  | 	updatedon   DATETIME, | ||||||
|  | 	createdby   VARCHAR(32), | ||||||
|  | 	updatedby   VARCHAR(32) | ||||||
|  | ) charset=utf8 engine=InnoDB; | ||||||
|  |  | ||||||
| CREATE TABLE project ( | CREATE TABLE project ( | ||||||
| 	id          VARCHAR(32)  PRIMARY KEY, | 	id          VARCHAR(32)  PRIMARY KEY, | ||||||
| 	name        VARCHAR(255) UNIQUE NOT NULL, | 	name        VARCHAR(255) UNIQUE NOT NULL, | ||||||
| @ -62,4 +73,3 @@ CREATE TABLE file ( | |||||||
| 		ON DELETE RESTRICT ON UPDATE CASCADE | 		ON DELETE RESTRICT ON UPDATE CASCADE | ||||||
| ) charset=utf8 engine=InnoDB;	 | ) charset=utf8 engine=InnoDB;	 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ www_DATA =  \ | |||||||
| 	index.html \ | 	index.html \ | ||||||
| 	main.php \ | 	main.php \ | ||||||
| 	project.php \ | 	project.php \ | ||||||
|  | 	site.php \ | ||||||
| 	source.php \ | 	source.php \ | ||||||
| 	user.php \ | 	user.php \ | ||||||
| 	wiki.php | 	wiki.php | ||||||
|  | |||||||
| @ -168,6 +168,7 @@ www_DATA = \ | |||||||
| 	index.html \ | 	index.html \ | ||||||
| 	main.php \ | 	main.php \ | ||||||
| 	project.php \ | 	project.php \ | ||||||
|  | 	site.php \ | ||||||
| 	source.php \ | 	source.php \ | ||||||
| 	user.php \ | 	user.php \ | ||||||
| 	wiki.php | 	wiki.php | ||||||
|  | |||||||
							
								
								
									
										243
									
								
								codepot/src/codepot/controllers/site.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										243
									
								
								codepot/src/codepot/controllers/site.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,243 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | class Site extends Controller  | ||||||
|  | { | ||||||
|  | 	var $VIEW_ERROR = 'error'; | ||||||
|  | 	var $VIEW_EDIT = 'site_edit'; | ||||||
|  | 	var $VIEW_DELETE = 'site_delete'; | ||||||
|  |  | ||||||
|  | 	function Site () | ||||||
|  | 	{ | ||||||
|  | 		parent::Controller (); | ||||||
|  |  | ||||||
|  | 		$this->load->helper ('url'); | ||||||
|  | 		$this->load->helper ('form'); | ||||||
|  | 		$this->load->library ('Converter', 'converter'); | ||||||
|  | 		$this->load->model (CODEPOT_LOGIN_MODEL, 'login'); | ||||||
|  |  | ||||||
|  | 		$this->load->library ('Language', 'lang'); | ||||||
|  | 		$this->lang->load ('common', CODEPOT_LANG); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function _edit_site ($site, $mode, $login) | ||||||
|  | 	{ | ||||||
|  | 		$this->load->helper ('form'); | ||||||
|  | 		$this->load->library ('form_validation'); | ||||||
|  |  | ||||||
|  | 		$data['login'] = $login; | ||||||
|  |  | ||||||
|  |                 // SET VALIDATION RULES | ||||||
|  | 		$this->form_validation->set_rules ( | ||||||
|  | 			'site_id', 'ID', 'required|alpha_dash|max_length[32]'); | ||||||
|  | 		$this->form_validation->set_rules ( | ||||||
|  | 			'site_name', 'name', 'required|max_length[128]'); | ||||||
|  | 		$this->form_validation->set_rules ( | ||||||
|  | 			'site_text', 'text', 'required'); | ||||||
|  | 		$this->form_validation->set_error_delimiters( | ||||||
|  | 			'<span class="form_field_error">','</span>'); | ||||||
|  |  | ||||||
|  | 		$data['message'] = ''; | ||||||
|  | 		$data['mode'] = $mode; | ||||||
|  |  | ||||||
|  | 		if($this->input->post('site')) | ||||||
|  | 		{ | ||||||
|  | 			$tmpid = ($mode == 'update')?  | ||||||
|  | 				$site->id: $this->input->post('site_id'); | ||||||
|  |  | ||||||
|  | 			// recompose the site information from POST data. | ||||||
|  | 			unset ($site); | ||||||
|  | 			$site->id = $tmpid; | ||||||
|  | 			$site->name = $this->input->post('site_name'); | ||||||
|  | 			$site->text = $this->input->post('site_text'); | ||||||
|  |  | ||||||
|  | 			// validate the form | ||||||
|  | 			if ($this->form_validation->run()) | ||||||
|  | 			{ | ||||||
|  | 				// if ok, take action | ||||||
|  | 				$result = ($mode == 'update')? | ||||||
|  | 					$this->sites->update ($login['id'], $site): | ||||||
|  | 					$this->sites->create ($login['id'], $site); | ||||||
|  | 				if ($result === FALSE) | ||||||
|  | 				{ | ||||||
|  | 					$data['message'] = 'DATABASE ERROR'; | ||||||
|  | 					$data['site'] = $site; | ||||||
|  | 					$this->load->view ($this->VIEW_EDIT, $data); | ||||||
|  | 				} | ||||||
|  | 				else | ||||||
|  | 				{ | ||||||
|  | 					//redirect ('user/home/' . $site->id); | ||||||
|  | 					redirect ('user/home'); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				// if not, reload the edit view with an error message | ||||||
|  | 				$data['message'] = 'Your input is not complete, Bro.'; | ||||||
|  | 				$data['site'] = $site; | ||||||
|  | 				$this->load->view ($this->VIEW_EDIT, $data); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			if ($mode == 'update') | ||||||
|  | 			{ | ||||||
|  | 				$data['site'] = $site; | ||||||
|  | 				$this->load->view ($this->VIEW_EDIT, $data); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				$data['site'] = $site; | ||||||
|  | 				$this->load->view ($this->VIEW_EDIT, $data); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function create ($siteid = "") | ||||||
|  | 	{ | ||||||
|  | 		$this->load->model ('SiteModel', 'sites'); | ||||||
|  |  | ||||||
|  | 		$login = $this->login->getUser (); | ||||||
|  | 		if ($login['id'] == '') redirect ('main/signin'); | ||||||
|  |  | ||||||
|  | 		if (!$login['sysadmin?']) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = "NO PERMISSION"; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			$site->id = $siteid; | ||||||
|  | 			$site->name = ''; | ||||||
|  | 			$site->text = ''; | ||||||
|  |  | ||||||
|  | 			$this->_edit_site ($site, 'create', $login); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function update ($siteid) | ||||||
|  | 	{ | ||||||
|  | 		$this->load->model ('SiteModel', 'sites'); | ||||||
|  |  | ||||||
|  | 		$login = $this->login->getUser (); | ||||||
|  | 		if ($login['id'] == '') redirect ('main/signin'); | ||||||
|  |  | ||||||
|  | 		$site = $this->sites->get ($siteid); | ||||||
|  | 		if ($site === FALSE) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = 'DATABASE ERROR'; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else if ($site === NULL) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = "NO SUCH PROJECT - $siteid"; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else if (!$login['sysadmin?']) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = "NO PERMISSION - $siteid"; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			$this->_edit_site ($site, 'update', $login); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function _delete_site ($site, $login) | ||||||
|  | 	{ | ||||||
|  | 		$this->load->helper ('form'); | ||||||
|  | 		$this->load->library ('form_validation'); | ||||||
|  |  | ||||||
|  | 		$data['login'] = $login; | ||||||
|  | 		$data['message'] = ''; | ||||||
|  |  | ||||||
|  | 		$this->form_validation->set_rules ('site_confirm', 'confirm', 'alpha'); | ||||||
|  | 		$this->form_validation->set_error_delimiters('<span class="form_field_error">','</span>'); | ||||||
|  |  | ||||||
|  | 		if($this->input->post('site')) | ||||||
|  | 		{ | ||||||
|  | 			/* the site form has been posted */ | ||||||
|  | 			$data['site_confirm'] = $this->input->post('site_confirm'); | ||||||
|  |  | ||||||
|  | 			if ($this->form_validation->run()) | ||||||
|  | 			{ | ||||||
|  | 				if ($data['site_confirm'] == 'yes') | ||||||
|  | 				{ | ||||||
|  | 					$result = $this->sites->delete ($login['id'], $site); | ||||||
|  | 					if ($result === FALSE) | ||||||
|  | 					{ | ||||||
|  | 						$data['message'] = 'DATABASE ERROR'; | ||||||
|  | 						$data['site'] = $site; | ||||||
|  | 						$this->load->view ($this->VIEW_DELETE, $data); | ||||||
|  | 					} | ||||||
|  | 					else  | ||||||
|  | 					{ | ||||||
|  | 						// the site has been deleted successfully. | ||||||
|  | 						// go back to the user home.	 | ||||||
|  | 						redirect ('user/home'); | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 				else  | ||||||
|  | 				{ | ||||||
|  | 					// the confirm checkbox is not checked. | ||||||
|  | 					// go back to the site home page. | ||||||
|  | 					//redirect ('user/home/' . $site->id); | ||||||
|  | 					redirect ('user/home'); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				// the form validation failed. | ||||||
|  | 				// reload the form with an error message. | ||||||
|  | 				$data['message'] = "Your input is not complete, Bro."; | ||||||
|  | 				$data['site'] = $site; | ||||||
|  | 				$this->load->view ($this->VIEW_DELETE, $data); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			/* no site posting is found. this is the fresh load */ | ||||||
|  | 			$data['site_confirm'] = 'no'; | ||||||
|  | 			$data['site'] = $site; | ||||||
|  | 			$this->load->view ($this->VIEW_DELETE, $data); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function delete ($siteid) | ||||||
|  | 	{ | ||||||
|  | 		$this->load->model ('SiteModel', 'sites'); | ||||||
|  |  | ||||||
|  | 		$login = $this->login->getUser (); | ||||||
|  | 		if ($login['id'] == '') redirect ('main/signin'); | ||||||
|  |  | ||||||
|  | 		$site = $this->sites->get ($siteid); | ||||||
|  | 		if ($site === FALSE) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = 'DATABASE ERROR'; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else if ($site === NULL) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = "NO SUCH PROJECT - $siteid"; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else if (!$login['sysadmin?']) | ||||||
|  | 		{ | ||||||
|  | 			$data['login'] = $login; | ||||||
|  | 			$data['message'] = "NO PERMISSION - $siteid"; | ||||||
|  | 			$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			$this->_delete_site ($site, $login); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ?> | ||||||
| @ -31,9 +31,10 @@ class User extends Controller | |||||||
| 			redirect ('main/signin'); | 			redirect ('main/signin'); | ||||||
|  |  | ||||||
| 		$this->load->model ('ProjectModel', 'projects'); | 		$this->load->model ('ProjectModel', 'projects'); | ||||||
|  | 		$this->load->model ('SiteModel', 'sites'); | ||||||
|  |  | ||||||
| 		$latest_projects = $this->projects->getLatestProjects ($login['id'], CODEPOT_MAX_LATEST_PROJECTS); |                 $site = $this->sites->get (CODEPOT_DEFAULT_SITEID); | ||||||
| 		if ($latest_projects === FALSE) | 		if ($site === FALSE) | ||||||
| 		{ | 		{ | ||||||
| 			$data['login'] = $login; | 			$data['login'] = $login; | ||||||
| 			$data['message'] = 'DATABASE ERROR'; | 			$data['message'] = 'DATABASE ERROR'; | ||||||
| @ -41,11 +42,24 @@ class User extends Controller | |||||||
| 		} | 		} | ||||||
| 		else  | 		else  | ||||||
| 		{ | 		{ | ||||||
| 			$data['login'] = $login; | 			$latest_projects = $this->projects->getLatestProjects ($login['id'], CODEPOT_MAX_LATEST_PROJECTS); | ||||||
| 			$data['latest_projects'] = $latest_projects; | 			if ($latest_projects === FALSE) | ||||||
| 			$data['user_name'] = ''; | 			{ | ||||||
| 			$data['user_pass'] = ''; | 				$data['login'] = $login; | ||||||
| 			$this->load->view ($this->VIEW_HOME, $data); | 				$data['message'] = 'DATABASE ERROR'; | ||||||
|  | 				$this->load->view ($this->VIEW_ERROR, $data); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				if ($site === NULL) $site = $this->sites->getDefault (); | ||||||
|  |  | ||||||
|  | 				$data['login'] = $login; | ||||||
|  | 				$data['latest_projects'] = $latest_projects; | ||||||
|  | 				$data['site'] = $site; | ||||||
|  | 				//$data['user_name'] = ''; | ||||||
|  | 				//$data['user_pass'] = ''; | ||||||
|  | 				$this->load->view ($this->VIEW_HOME, $data); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ $lang['Delete'] = 'Hapus'; | |||||||
| $lang['Description'] = 'Penjelasan'; | $lang['Description'] = 'Penjelasan'; | ||||||
| $lang['Details'] = 'Detail'; | $lang['Details'] = 'Detail'; | ||||||
| $lang['Difference'] = 'Beda'; | $lang['Difference'] = 'Beda'; | ||||||
| ng['Directory'] = 'Direktori'; | $lang['Directory'] = 'Direktori'; | ||||||
| $lang['Download'] = 'Download'; | $lang['Download'] = 'Download'; | ||||||
| $lang['Edit'] = 'Rubah'; | $lang['Edit'] = 'Rubah'; | ||||||
| $lang['Head revision'] = 'Kepala Revisi'; | $lang['Head revision'] = 'Kepala Revisi'; | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ www_DATA =  \ | |||||||
| 	ldaploginmodel.php \ | 	ldaploginmodel.php \ | ||||||
| 	loginmodel.php \ | 	loginmodel.php \ | ||||||
| 	projectmodel.php \ | 	projectmodel.php \ | ||||||
|  | 	sitemodel.php \ | ||||||
| 	subversionmodel.php \ | 	subversionmodel.php \ | ||||||
| 	wikimodel.php | 	wikimodel.php | ||||||
|  |  | ||||||
|  | |||||||
| @ -168,6 +168,7 @@ www_DATA = \ | |||||||
| 	ldaploginmodel.php \ | 	ldaploginmodel.php \ | ||||||
| 	loginmodel.php \ | 	loginmodel.php \ | ||||||
| 	projectmodel.php \ | 	projectmodel.php \ | ||||||
|  | 	sitemodel.php \ | ||||||
| 	subversionmodel.php \ | 	subversionmodel.php \ | ||||||
| 	wikimodel.php | 	wikimodel.php | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										112
									
								
								codepot/src/codepot/models/sitemodel.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								codepot/src/codepot/models/sitemodel.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,112 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | class SiteModel extends Model | ||||||
|  | { | ||||||
|  | 	function SiteModel () | ||||||
|  | 	{ | ||||||
|  | 		parent::Model (); | ||||||
|  | 		$this->load->database (); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function getDefault () | ||||||
|  | 	{ | ||||||
|  | 		$site->id = CODEPOT_DEFAULT_SITEID; | ||||||
|  | 		$site->name = CODEPOT_DEFAULT_BANNER; | ||||||
|  | 		$site->text = ''; | ||||||
|  | 		$site->updatedby = ''; | ||||||
|  | 		$site->createdby = ''; | ||||||
|  | 		$site->updatedon = 0; | ||||||
|  | 		$site->createdon = 0; | ||||||
|  | 		return $site; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function get ($id) | ||||||
|  | 	{ | ||||||
|  | 		$this->db->trans_start (); | ||||||
|  |  | ||||||
|  | 		$this->db->where ('id', (string)$id); | ||||||
|  | 		$query = $this->db->get ('site'); | ||||||
|  |  | ||||||
|  | 		$result = $query->result (); | ||||||
|  | 		if (empty($result)) | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_complete (); | ||||||
|  | 			if ($this->db->trans_status() === FALSE) return FALSE; | ||||||
|  | 			return NULL; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		$this->db->trans_complete (); | ||||||
|  | 		if ($this->db->trans_status() === FALSE) return FALSE; | ||||||
|  |  | ||||||
|  | 		return $result[0]; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function create ($userid, $site) | ||||||
|  | 	{ | ||||||
|  | 		$this->db->trans_begin (); | ||||||
|  |  | ||||||
|  | 		$this->db->set ('id', $site->id); | ||||||
|  | 		$this->db->set ('name', $site->name); | ||||||
|  | 		$this->db->set ('text', $site->text); | ||||||
|  | 		$this->db->set ('createdon', date('Y-m-d H:i:s')); | ||||||
|  | 		$this->db->set ('createdby', $userid); | ||||||
|  | 		$this->db->set ('updatedon', date('Y-m-d H:i:s')); | ||||||
|  | 		$this->db->set ('updatedby', $userid); | ||||||
|  | 		$this->db->insert ('site'); | ||||||
|  |  | ||||||
|  | 		if ($this->db->trans_status() === FALSE) | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_rollback (); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_commit (); | ||||||
|  | 			return TRUE; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function update ($userid, $site) | ||||||
|  | 	{ | ||||||
|  | 		$this->db->trans_begin (); | ||||||
|  |  | ||||||
|  | 		$this->db->where ('id', $site->id); | ||||||
|  | 		$this->db->set ('name', $site->name); | ||||||
|  | 		$this->db->set ('text', $site->text); | ||||||
|  | 		$this->db->set ('updatedon', date('Y-m-d H:i:s')); | ||||||
|  | 		$this->db->set ('updatedby', $userid); | ||||||
|  | 		$this->db->update ('site'); | ||||||
|  |  | ||||||
|  | 		if ($this->db->trans_status() === FALSE) | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_rollback (); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_commit (); | ||||||
|  | 			return TRUE; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function delete ($userid, $site) | ||||||
|  | 	{ | ||||||
|  | 		$this->db->trans_begin (); | ||||||
|  |  | ||||||
|  | 		$this->db->where ('id', $site->id); | ||||||
|  | 		$this->db->delete ('site'); | ||||||
|  |  | ||||||
|  | 		if ($this->db->trans_status() === FALSE) | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_rollback (); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_commit (); | ||||||
|  | 			return TRUE; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ?> | ||||||
| @ -13,6 +13,8 @@ www_DATA =  \ | |||||||
| 	project_home.php \ | 	project_home.php \ | ||||||
| 	project_list.php \ | 	project_list.php \ | ||||||
| 	projectbar.php \ | 	projectbar.php \ | ||||||
|  | 	site_edit.php \ | ||||||
|  | 	site_delete.php \ | ||||||
| 	source_blame.php \ | 	source_blame.php \ | ||||||
| 	source_diff.php \ | 	source_diff.php \ | ||||||
| 	source_file.php \ | 	source_file.php \ | ||||||
|  | |||||||
| @ -176,6 +176,8 @@ www_DATA = \ | |||||||
| 	project_home.php \ | 	project_home.php \ | ||||||
| 	project_list.php \ | 	project_list.php \ | ||||||
| 	projectbar.php \ | 	projectbar.php \ | ||||||
|  | 	site_edit.php \ | ||||||
|  | 	site_delete.php \ | ||||||
| 	source_blame.php \ | 	source_blame.php \ | ||||||
| 	source_diff.php \ | 	source_diff.php \ | ||||||
| 	source_file.php \ | 	source_file.php \ | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
|         'projectbar', |         'projectbar', | ||||||
|         array ( |         array ( | ||||||
|  |                 'site' => NULL, | ||||||
|                 'project' => NULL, |                 'project' => NULL, | ||||||
|                 'pageid' => '', |                 'pageid' => '', | ||||||
|                 'ctxmenuitems' => array () |                 'ctxmenuitems' => array () | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'file', | 		'pageid' => 'file', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'file', | 		'pageid' => 'file', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'file', | 		'pageid' => 'file', | ||||||
| 		'ctxmenuitems' => array ( | 		'ctxmenuitems' => array ( | ||||||
| 			array ("file/create/{$project->id}", $this->lang->line('New'))  | 			array ("file/create/{$project->id}", $this->lang->line('New'))  | ||||||
|  | |||||||
| @ -35,6 +35,7 @@ $hexname = $this->converter->AsciiToHex ($file->name); | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'file', | 		'pageid' => 'file', | ||||||
| 		'ctxmenuitems' => array ( | 		'ctxmenuitems' => array ( | ||||||
| 			array ("file/create/{$project->id}", $this->lang->line('New')), | 			array ("file/create/{$project->id}", $this->lang->line('New')), | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'project' => NULL, | 		'project' => NULL, | ||||||
| 		'pageid' => '', | 		'pageid' => '', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'project', | 		'pageid' => 'project', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
|         ) |         ) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'project' => (($mode != 'create')? $project: NULL), | 		'project' => (($mode != 'create')? $project: NULL), | ||||||
| 		'pageid' => 'project', | 		'pageid' => 'project', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
|  | |||||||
| @ -35,6 +35,7 @@ function render_wiki() | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar',  | 	'projectbar',  | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'project', | 		'pageid' => 'project', | ||||||
| 		'ctxmenuitems' => array ( | 		'ctxmenuitems' => array ( | ||||||
| 			array ("project/update/{$project->id}", $this->lang->line('Edit')), | 			array ("project/update/{$project->id}", $this->lang->line('Edit')), | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
|         'projectbar', |         'projectbar', | ||||||
|         array ( |         array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'project' => NULL, | 		'project' => NULL, | ||||||
| 		'pageid' => '', | 		'pageid' => '', | ||||||
|                 'ctxmenuitems' => array ( |                 'ctxmenuitems' => array ( | ||||||
|  | |||||||
| @ -1,10 +1,14 @@ | |||||||
| <div class="projectbar"> | <div class="projectbar"> | ||||||
|  |  | ||||||
| <?php | <?php | ||||||
| function show_projectbar ($con, $project, $pageid, $ctxmenuitems) | function show_projectbar ($con, $site, $project, $pageid, $ctxmenuitems) | ||||||
| { | { | ||||||
| 	print "<div class='title'>"; | 	print "<div class='title'>"; | ||||||
| 	print isset($project)? $project->id: CODEPOT_DEFAULT_BANNER; |  | ||||||
|  | 	if (isset($project)) print $project->id; | ||||||
|  | 	else if (isset($site) && $site->name != '') print htmlspecialchars($site->name); | ||||||
|  | 	else print htmlspecialchars(CODEPOT_DEFAULT_BANNER); | ||||||
|  |  | ||||||
| 	print "</div>"; | 	print "</div>"; | ||||||
|  |  | ||||||
| 	print '<div class="ctxmenu">'; | 	print '<div class="ctxmenu">'; | ||||||
| @ -57,7 +61,7 @@ function show_projectbar ($con, $project, $pageid, $ctxmenuitems) | |||||||
| 	print '</div>'; | 	print '</div>'; | ||||||
| } | } | ||||||
|  |  | ||||||
| show_projectbar ($this, $project, $pageid, $ctxmenuitems); | show_projectbar ($this, $site, $project, $pageid, $ctxmenuitems); | ||||||
| ?> | ?> | ||||||
|  |  | ||||||
| </div> | </div> | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'source', | 		'pageid' => 'source', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'source', | 		'pageid' => 'source', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'source', | 		'pageid' => 'source', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'source', | 		'pageid' => 'source', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'source', | 		'pageid' => 'source', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'source', | 		'pageid' => 'source', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -4,6 +4,18 @@ | |||||||
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||||
| <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" /> | <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" /> | ||||||
| <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" /> | <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" /> | ||||||
|  | <script type="text/javascript" src="<?=base_url()?>/js/creole.js"></script> | ||||||
|  | <script type="text/javascript"> | ||||||
|  | function render_wiki() | ||||||
|  | { | ||||||
|  | 	creole_render_wiki ( | ||||||
|  | 		"user_home_mainarea_textpre", | ||||||
|  | 		"user_home_mainarea_text", | ||||||
|  | 		"" | ||||||
|  | 	); | ||||||
|  | } | ||||||
|  | </script> | ||||||
|  |  | ||||||
| <?php | <?php | ||||||
| 	$caption = $this->lang->line('Home'); | 	$caption = $this->lang->line('Home'); | ||||||
| 	if ($login['id'] != '') $caption .= "({$login['id']})"; | 	if ($login['id'] != '') $caption .= "({$login['id']})"; | ||||||
| @ -11,7 +23,7 @@ | |||||||
| <title><?=htmlspecialchars($caption)?></title> | <title><?=htmlspecialchars($caption)?></title> | ||||||
| </head> | </head> | ||||||
|  |  | ||||||
| <body> | <body  onLoad="render_wiki()"> | ||||||
|  |  | ||||||
| <div class="content" id="user_home_content"> | <div class="content" id="user_home_content"> | ||||||
|  |  | ||||||
| @ -22,12 +34,24 @@ | |||||||
| <!----------------------------------------------------------------------------> | <!----------------------------------------------------------------------------> | ||||||
|  |  | ||||||
| <?php | <?php | ||||||
|  |  | ||||||
|  | if ($login['sysadmin?']) | ||||||
|  | { | ||||||
|  | 	$ctxmenuitems = array ( | ||||||
|  | 		array ("site/create", $this->lang->line('Create')), | ||||||
|  | 		array ("site/update/{$site->id}", $this->lang->line('Edit')), | ||||||
|  | 		array ("site/delete/{$site->id}", $this->lang->line('Delete')) | ||||||
|  | 	); | ||||||
|  | } | ||||||
|  | else $ctxmenuitems = array (); | ||||||
|  |  | ||||||
| $this->load->view ( | $this->load->view ( | ||||||
|         'projectbar', |         'projectbar', | ||||||
|         array ( |         array ( | ||||||
| 		'project' => NULL, | 		'project' => NULL, | ||||||
| 		'pageid' => '', | 		'site' => $site, | ||||||
|                 'ctxmenuitems' => array () | 		'pageid' => 'site', | ||||||
|  |                 'ctxmenuitems' => $ctxmenuitems | ||||||
|         ) |         ) | ||||||
| ); | ); | ||||||
| ?> | ?> | ||||||
| @ -36,7 +60,7 @@ $this->load->view ( | |||||||
|  |  | ||||||
| <div class="mainarea" id="user_home_mainarea"> | <div class="mainarea" id="user_home_mainarea"> | ||||||
|  |  | ||||||
| <div class="sidebar"> | <div class="sidebar" id="user_home_mainarea_sidebar"> | ||||||
|  |  | ||||||
| <div class="box"> | <div class="box"> | ||||||
| <div class="boxtitle"><?=$this->lang->line('Latest projects')?></div> | <div class="boxtitle"><?=$this->lang->line('Latest projects')?></div> | ||||||
| @ -54,7 +78,13 @@ foreach ($latest_projects as $project) | |||||||
| ?> | ?> | ||||||
| </ul> | </ul> | ||||||
| </div> | </div> | ||||||
| </div> | </div> <!-- user_home_mainarea_sidebar --> | ||||||
|  |  | ||||||
|  | <div id="user_home_mainarea_text"> | ||||||
|  | <pre id="user_home_mainarea_textpre" style="visibility: hidden"> | ||||||
|  | <?php print htmlspecialchars($site->text); ?> | ||||||
|  | </pre> | ||||||
|  | </div> <!-- user_home_mainarea_text --> | ||||||
|  |  | ||||||
| <!-----------------------------------------------------------> | <!-----------------------------------------------------------> | ||||||
|  |  | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
|         'projectbar', |         'projectbar', | ||||||
|         array ( |         array ( | ||||||
|  | 		'site' => NULL, | ||||||
|                 'pageid' => 'wiki', |                 'pageid' => 'wiki', | ||||||
|                 'ctxmenuitems' => array () |                 'ctxmenuitems' => array () | ||||||
|         ) |         ) | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ $hexname = $this->converter->AsciiToHex ($wiki->name); | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'wiki', | 		'pageid' => 'wiki', | ||||||
| 		'ctxmenuitems' => array () | 		'ctxmenuitems' => array () | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar',  | 	'projectbar',  | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'wiki', | 		'pageid' => 'wiki', | ||||||
| 		'ctxmenuitems' => array ( | 		'ctxmenuitems' => array ( | ||||||
| 			array ("wiki/create/{$project->id}", $this->lang->line('New'))  | 			array ("wiki/create/{$project->id}", $this->lang->line('New'))  | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ $hexname = $this->converter->AsciiToHex ($wiki->name); | |||||||
| $this->load->view ( | $this->load->view ( | ||||||
| 	'projectbar', | 	'projectbar', | ||||||
| 	array ( | 	array ( | ||||||
|  | 		'site' => NULL, | ||||||
| 		'pageid' => 'wiki', | 		'pageid' => 'wiki', | ||||||
| 		'ctxmenuitems' => array ( | 		'ctxmenuitems' => array ( | ||||||
| 			array ("wiki/create/{$project->id}", $this->lang->line('New')), | 			array ("wiki/create/{$project->id}", $this->lang->line('New')), | ||||||
|  | |||||||
| @ -13,8 +13,8 @@ function load_ini ($file) | |||||||
| 	if (/*$cfg === FALSE*/ $cfg == FALSE) die ("ERROR: cannot parse $file"); | 	if (/*$cfg === FALSE*/ $cfg == FALSE) die ("ERROR: cannot parse $file"); | ||||||
|  |  | ||||||
| 	$xcfgs = array ( | 	$xcfgs = array ( | ||||||
|  |  | ||||||
| 		array ('default_banner',               'string',     '@PACKAGE@'), | 		array ('default_banner',               'string',     '@PACKAGE@'), | ||||||
|  | 		array ('default_siteid',               'string',     'default'), | ||||||
| 		array ('lang',                         'string',     'english'), | 		array ('lang',                         'string',     'english'), | ||||||
| 		array ('always_require_signin',        'boolean',    FALSE), | 		array ('always_require_signin',        'boolean',    FALSE), | ||||||
| 		array ('enable_websvn',                'boolean',    FALSE), | 		array ('enable_websvn',                'boolean',    FALSE), | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user