From 4c40bfe770a8846ce1fce0a0296d89d6cb0fe966 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 19 Feb 2010 09:27:33 +0000 Subject: [PATCH] added a way to create multiple front pages. not implemented the front page selector yet. --- codepot/etc/codepot.ini.in | 5 + codepot/etc/codepot.sql | 12 +- codepot/src/codepot/controllers/Makefile.am | 1 + codepot/src/codepot/controllers/Makefile.in | 1 + codepot/src/codepot/controllers/site.php | 243 ++++++++++++++++++ codepot/src/codepot/controllers/user.php | 30 ++- .../language/indonesian/common_lang.php | 2 +- codepot/src/codepot/models/Makefile.am | 1 + codepot/src/codepot/models/Makefile.in | 1 + codepot/src/codepot/models/sitemodel.php | 112 ++++++++ codepot/src/codepot/views/Makefile.am | 2 + codepot/src/codepot/views/Makefile.in | 2 + codepot/src/codepot/views/error.php | 1 + codepot/src/codepot/views/file_delete.php | 1 + codepot/src/codepot/views/file_edit.php | 1 + codepot/src/codepot/views/file_home.php | 1 + codepot/src/codepot/views/file_show.php | 1 + codepot/src/codepot/views/login.php | 1 + codepot/src/codepot/views/project_delete.php | 1 + codepot/src/codepot/views/project_edit.php | 1 + codepot/src/codepot/views/project_home.php | 1 + codepot/src/codepot/views/project_list.php | 1 + codepot/src/codepot/views/projectbar.php | 10 +- codepot/src/codepot/views/source_blame.php | 1 + codepot/src/codepot/views/source_diff.php | 1 + codepot/src/codepot/views/source_file.php | 1 + codepot/src/codepot/views/source_folder.php | 1 + codepot/src/codepot/views/source_history.php | 1 + codepot/src/codepot/views/source_revision.php | 1 + codepot/src/codepot/views/user_home.php | 40 ++- codepot/src/codepot/views/wiki_delete.php | 1 + codepot/src/codepot/views/wiki_edit.php | 1 + codepot/src/codepot/views/wiki_home.php | 1 + codepot/src/codepot/views/wiki_show.php | 1 + codepot/src/config.php.in | 2 +- 35 files changed, 465 insertions(+), 19 deletions(-) create mode 100644 codepot/src/codepot/controllers/site.php create mode 100644 codepot/src/codepot/models/sitemodel.php diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index d33df830..30da4f07 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -1,3 +1,8 @@ +;------------------------------------------------------------------------------ +; default site ID +;------------------------------------------------------------------------------ +default_siteid = "default"; + ;------------------------------------------------------------------------------ ; banner to display when no project id is available ;------------------------------------------------------------------------------ diff --git a/codepot/etc/codepot.sql b/codepot/etc/codepot.sql index 78c140fe..7c8b5c22 100644 --- a/codepot/etc/codepot.sql +++ b/codepot/etc/codepot.sql @@ -1,6 +1,17 @@ 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 ( id VARCHAR(32) PRIMARY KEY, name VARCHAR(255) UNIQUE NOT NULL, @@ -62,4 +73,3 @@ CREATE TABLE file ( ON DELETE RESTRICT ON UPDATE CASCADE ) charset=utf8 engine=InnoDB; - diff --git a/codepot/src/codepot/controllers/Makefile.am b/codepot/src/codepot/controllers/Makefile.am index 8fec43a1..68b7b876 100644 --- a/codepot/src/codepot/controllers/Makefile.am +++ b/codepot/src/codepot/controllers/Makefile.am @@ -5,6 +5,7 @@ www_DATA = \ index.html \ main.php \ project.php \ + site.php \ source.php \ user.php \ wiki.php diff --git a/codepot/src/codepot/controllers/Makefile.in b/codepot/src/codepot/controllers/Makefile.in index dfa264bb..3b7d6c9e 100644 --- a/codepot/src/codepot/controllers/Makefile.in +++ b/codepot/src/codepot/controllers/Makefile.in @@ -168,6 +168,7 @@ www_DATA = \ index.html \ main.php \ project.php \ + site.php \ source.php \ user.php \ wiki.php diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php new file mode 100644 index 00000000..c5700d6d --- /dev/null +++ b/codepot/src/codepot/controllers/site.php @@ -0,0 +1,243 @@ +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( + '',''); + + $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('',''); + + 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); + } + } +} + +?> diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index 6ecc7368..0a8919d9 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -31,21 +31,35 @@ class User extends Controller redirect ('main/signin'); $this->load->model ('ProjectModel', 'projects'); + $this->load->model ('SiteModel', 'sites'); - $latest_projects = $this->projects->getLatestProjects ($login['id'], CODEPOT_MAX_LATEST_PROJECTS); - if ($latest_projects === FALSE) + $site = $this->sites->get (CODEPOT_DEFAULT_SITEID); + if ($site === FALSE) { $data['login'] = $login; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); } - else + else { - $data['login'] = $login; - $data['latest_projects'] = $latest_projects; - $data['user_name'] = ''; - $data['user_pass'] = ''; - $this->load->view ($this->VIEW_HOME, $data); + $latest_projects = $this->projects->getLatestProjects ($login['id'], CODEPOT_MAX_LATEST_PROJECTS); + if ($latest_projects === FALSE) + { + $data['login'] = $login; + $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); + } } } diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 9821f711..737d5a03 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -9,7 +9,7 @@ $lang['Delete'] = 'Hapus'; $lang['Description'] = 'Penjelasan'; $lang['Details'] = 'Detail'; $lang['Difference'] = 'Beda'; -ng['Directory'] = 'Direktori'; +$lang['Directory'] = 'Direktori'; $lang['Download'] = 'Download'; $lang['Edit'] = 'Rubah'; $lang['Head revision'] = 'Kepala Revisi'; diff --git a/codepot/src/codepot/models/Makefile.am b/codepot/src/codepot/models/Makefile.am index b0661b7f..13197164 100644 --- a/codepot/src/codepot/models/Makefile.am +++ b/codepot/src/codepot/models/Makefile.am @@ -5,6 +5,7 @@ www_DATA = \ ldaploginmodel.php \ loginmodel.php \ projectmodel.php \ + sitemodel.php \ subversionmodel.php \ wikimodel.php diff --git a/codepot/src/codepot/models/Makefile.in b/codepot/src/codepot/models/Makefile.in index a7102d9d..c48c275a 100644 --- a/codepot/src/codepot/models/Makefile.in +++ b/codepot/src/codepot/models/Makefile.in @@ -168,6 +168,7 @@ www_DATA = \ ldaploginmodel.php \ loginmodel.php \ projectmodel.php \ + sitemodel.php \ subversionmodel.php \ wikimodel.php diff --git a/codepot/src/codepot/models/sitemodel.php b/codepot/src/codepot/models/sitemodel.php new file mode 100644 index 00000000..37fe06d7 --- /dev/null +++ b/codepot/src/codepot/models/sitemodel.php @@ -0,0 +1,112 @@ +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; + } + } +} + +?> diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index 1b6efb40..a2824961 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -13,6 +13,8 @@ www_DATA = \ project_home.php \ project_list.php \ projectbar.php \ + site_edit.php \ + site_delete.php \ source_blame.php \ source_diff.php \ source_file.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index ae9e5725..d7ca1d05 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -176,6 +176,8 @@ www_DATA = \ project_home.php \ project_list.php \ projectbar.php \ + site_edit.php \ + site_delete.php \ source_blame.php \ source_diff.php \ source_file.php \ diff --git a/codepot/src/codepot/views/error.php b/codepot/src/codepot/views/error.php index 40af9479..e3879064 100644 --- a/codepot/src/codepot/views/error.php +++ b/codepot/src/codepot/views/error.php @@ -23,6 +23,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array () diff --git a/codepot/src/codepot/views/file_delete.php b/codepot/src/codepot/views/file_delete.php index 4543df24..c407e045 100644 --- a/codepot/src/codepot/views/file_delete.php +++ b/codepot/src/codepot/views/file_delete.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'file', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/file_edit.php b/codepot/src/codepot/views/file_edit.php index a87be281..c31d3e5e 100644 --- a/codepot/src/codepot/views/file_edit.php +++ b/codepot/src/codepot/views/file_edit.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'file', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/file_home.php b/codepot/src/codepot/views/file_home.php index a254f15f..6d5a77e4 100644 --- a/codepot/src/codepot/views/file_home.php +++ b/codepot/src/codepot/views/file_home.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'file', 'ctxmenuitems' => array ( array ("file/create/{$project->id}", $this->lang->line('New')) diff --git a/codepot/src/codepot/views/file_show.php b/codepot/src/codepot/views/file_show.php index ca260266..de8a48a5 100644 --- a/codepot/src/codepot/views/file_show.php +++ b/codepot/src/codepot/views/file_show.php @@ -35,6 +35,7 @@ $hexname = $this->converter->AsciiToHex ($file->name); $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'file', 'ctxmenuitems' => array ( array ("file/create/{$project->id}", $this->lang->line('New')), diff --git a/codepot/src/codepot/views/login.php b/codepot/src/codepot/views/login.php index 0ac444f5..c8f92cf9 100644 --- a/codepot/src/codepot/views/login.php +++ b/codepot/src/codepot/views/login.php @@ -28,6 +28,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array () diff --git a/codepot/src/codepot/views/project_delete.php b/codepot/src/codepot/views/project_delete.php index 1bfe8adf..d1ad22f4 100644 --- a/codepot/src/codepot/views/project_delete.php +++ b/codepot/src/codepot/views/project_delete.php @@ -20,6 +20,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'project', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/project_edit.php b/codepot/src/codepot/views/project_edit.php index 089123a4..919181ff 100644 --- a/codepot/src/codepot/views/project_edit.php +++ b/codepot/src/codepot/views/project_edit.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'project' => (($mode != 'create')? $project: NULL), 'pageid' => 'project', 'ctxmenuitems' => array () diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index b04fe15d..abecf434 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -35,6 +35,7 @@ function render_wiki() $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'project', 'ctxmenuitems' => array ( array ("project/update/{$project->id}", $this->lang->line('Edit')), diff --git a/codepot/src/codepot/views/project_list.php b/codepot/src/codepot/views/project_list.php index ab6652b3..94997360 100644 --- a/codepot/src/codepot/views/project_list.php +++ b/codepot/src/codepot/views/project_list.php @@ -25,6 +25,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array ( diff --git a/codepot/src/codepot/views/projectbar.php b/codepot/src/codepot/views/projectbar.php index dcf5c9f2..1b66becb 100644 --- a/codepot/src/codepot/views/projectbar.php +++ b/codepot/src/codepot/views/projectbar.php @@ -1,10 +1,14 @@
"; - 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 "
"; print '
'; @@ -57,7 +61,7 @@ function show_projectbar ($con, $project, $pageid, $ctxmenuitems) print '
'; } -show_projectbar ($this, $project, $pageid, $ctxmenuitems); +show_projectbar ($this, $site, $project, $pageid, $ctxmenuitems); ?> diff --git a/codepot/src/codepot/views/source_blame.php b/codepot/src/codepot/views/source_blame.php index d874181b..2157f106 100644 --- a/codepot/src/codepot/views/source_blame.php +++ b/codepot/src/codepot/views/source_blame.php @@ -27,6 +27,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'source', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/source_diff.php b/codepot/src/codepot/views/source_diff.php index 17203f26..86c79aa2 100644 --- a/codepot/src/codepot/views/source_diff.php +++ b/codepot/src/codepot/views/source_diff.php @@ -27,6 +27,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'source', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/source_file.php b/codepot/src/codepot/views/source_file.php index e1048e4c..02a5eaf4 100644 --- a/codepot/src/codepot/views/source_file.php +++ b/codepot/src/codepot/views/source_file.php @@ -27,6 +27,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'source', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/source_folder.php b/codepot/src/codepot/views/source_folder.php index 1142cd6f..0a975d8e 100644 --- a/codepot/src/codepot/views/source_folder.php +++ b/codepot/src/codepot/views/source_folder.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'source', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/source_history.php b/codepot/src/codepot/views/source_history.php index 47f18e2a..d919017f 100644 --- a/codepot/src/codepot/views/source_history.php +++ b/codepot/src/codepot/views/source_history.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'source', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/source_revision.php b/codepot/src/codepot/views/source_revision.php index 50fba4dd..89a5c6d0 100644 --- a/codepot/src/codepot/views/source_revision.php +++ b/codepot/src/codepot/views/source_revision.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'source', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/user_home.php b/codepot/src/codepot/views/user_home.php index 7eb27de8..08447190 100644 --- a/codepot/src/codepot/views/user_home.php +++ b/codepot/src/codepot/views/user_home.php @@ -4,6 +4,18 @@ + + + lang->line('Home'); if ($login['id'] != '') $caption .= "({$login['id']})"; @@ -11,7 +23,7 @@ <?=htmlspecialchars($caption)?> - +
@@ -22,12 +34,24 @@ 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 ( 'projectbar', array ( 'project' => NULL, - 'pageid' => '', - 'ctxmenuitems' => array () + 'site' => $site, + 'pageid' => 'site', + 'ctxmenuitems' => $ctxmenuitems ) ); ?> @@ -36,7 +60,7 @@ $this->load->view (
- + +
+ +
diff --git a/codepot/src/codepot/views/wiki_delete.php b/codepot/src/codepot/views/wiki_delete.php index 89d03d03..2eeda85b 100644 --- a/codepot/src/codepot/views/wiki_delete.php +++ b/codepot/src/codepot/views/wiki_delete.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'wiki', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/wiki_edit.php b/codepot/src/codepot/views/wiki_edit.php index 7200d390..d23b93d4 100644 --- a/codepot/src/codepot/views/wiki_edit.php +++ b/codepot/src/codepot/views/wiki_edit.php @@ -22,6 +22,7 @@ $hexname = $this->converter->AsciiToHex ($wiki->name); $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'wiki', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/wiki_home.php b/codepot/src/codepot/views/wiki_home.php index 674b538e..6d9ebaa5 100644 --- a/codepot/src/codepot/views/wiki_home.php +++ b/codepot/src/codepot/views/wiki_home.php @@ -21,6 +21,7 @@ $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'wiki', 'ctxmenuitems' => array ( array ("wiki/create/{$project->id}", $this->lang->line('New')) diff --git a/codepot/src/codepot/views/wiki_show.php b/codepot/src/codepot/views/wiki_show.php index b7a0d56d..c15f5b53 100644 --- a/codepot/src/codepot/views/wiki_show.php +++ b/codepot/src/codepot/views/wiki_show.php @@ -23,6 +23,7 @@ $hexname = $this->converter->AsciiToHex ($wiki->name); $this->load->view ( 'projectbar', array ( + 'site' => NULL, 'pageid' => 'wiki', 'ctxmenuitems' => array ( array ("wiki/create/{$project->id}", $this->lang->line('New')), diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index 4cc85a12..0747e4f0 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -13,8 +13,8 @@ function load_ini ($file) if (/*$cfg === FALSE*/ $cfg == FALSE) die ("ERROR: cannot parse $file"); $xcfgs = array ( - array ('default_banner', 'string', '@PACKAGE@'), + array ('default_siteid', 'string', 'default'), array ('lang', 'string', 'english'), array ('always_require_signin', 'boolean', FALSE), array ('enable_websvn', 'boolean', FALSE),