-
+name} ({$site->id})";
+ $anc = anchor ("site/show/{$site->id}", htmlspecialchars($cap));
+ print "
- {$anc} "; +} +?> +
diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index b10ed431..5cc2d70e 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -1,12 +1,12 @@ ;------------------------------------------------------------------------------ -; default site ID +; default site language ;------------------------------------------------------------------------------ -default_siteid = "default"; +default_site_language = "english"; ;------------------------------------------------------------------------------ -; banner to display when no project id is available +; default site name ;------------------------------------------------------------------------------ -default_banner = "@PACKAGE@" +default_site_name = "@PACKAGE@" ;------------------------------------------------------------------------------ ; database settings diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index 6a4d3dd9..f3c82d21 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -298,7 +298,7 @@ class Issue extends Controller " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$login['sysadmin?'] && + else if (!$login['sysadmin?'] && $mode != 'create' && $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['project'] = $project; @@ -307,6 +307,8 @@ class Issue extends Controller } else { + { + } $this->form_validation->set_rules ( 'issue_projectid', 'project ID', 'required|alpha_dash|max_length[32]'); $this->form_validation->set_rules ( diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index 7b4e50e4..0b791223 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -3,11 +3,13 @@ class Site extends Controller { var $VIEW_ERROR = 'error'; + var $VIEW_SHOW = 'site_show'; var $VIEW_HOME = 'site_home'; var $VIEW_EDIT = 'site_edit'; var $VIEW_DELETE = 'site_delete'; var $VIEW_LOG = 'log'; var $VIEW_PROJECT_LIST = 'project_list'; + var $VIEW_SITE_ADMINHOME = 'site_adminhome'; function Site () { @@ -37,7 +39,7 @@ class Site extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('LogModel', 'logs'); - $site = $this->sites->get (CODEPOT_DEFAULT_SITEID); + $site = $this->sites->get ($this->config->config['language']); if ($site === FALSE) { $data['login'] = $login; @@ -45,6 +47,17 @@ class Site extends Controller $this->load->view ($this->VIEW_ERROR, $data); return; } + if ($site === NULL && CODEPOT_DEFAULT_SITE_LANGUAGE != '') + { + $site = $this->sites->get (CODEPOT_DEFAULT_SITE_LANGUAGE); + if ($site === FALSE) + { + $data['login'] = $login; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + return; + } + } if ($site === NULL) $site = $this->sites->getDefault (); $latest_projects = $this->projects->getLatestProjects ($login['id'], CODEPOT_MAX_LATEST_PROJECTS); @@ -74,6 +87,60 @@ class Site extends Controller $this->load->view ($this->VIEW_HOME, $data); } + function adminhome () + { + $login = $this->login->getUser (); + if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') + redirect ('main/signin'); + + $this->load->model ('SiteModel', 'sites'); + + $sites = $this->sites->getAll ($login['id']); + + if ($sites === FALSE) + { + $data['login'] = $login; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + } + else + { + $data['login'] = $login; + $data['sites'] = $sites; + $this->load->view ($this->VIEW_SITE_ADMINHOME, $data); + } + } + + function show ($siteid) + { + $login = $this->login->getUser (); + if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') + redirect ('main/signin'); + + $this->load->model ('SiteModel', 'sites'); + + $data['login'] = $login; + + $site = $this->sites->get ($siteid); + if ($site === FALSE) + { + $data['login'] = $login; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + return; + } + + if ($site === NULL) + { + $data['message'] = "NO SUCH SITE - {$siteid}"; + $this->load->view ($this->VIEW_ERROR, $data); + return; + } + + $data['site'] = $site; + $this->load->view ($this->VIEW_SHOW, $data); + } + function _edit_site ($site, $mode, $login) { $this->load->helper ('form'); @@ -120,8 +187,7 @@ class Site extends Controller } else { - //redirect ('site/home/' . $site->id); - redirect ('site/home'); + redirect ("site/show/{$site->id}"); } } else @@ -232,16 +298,15 @@ class Site extends Controller else { // the site has been deleted successfully. - // go back to the site home. - redirect ('site/home'); + // go back to the site admin home. + redirect ('site/adminhome'); } } else { // the confirm checkbox is not checked. - // go back to the site home page. - //redirect ('site/home/' . $site->id); - redirect ('site/home'); + // go back to the site adminhome page. + redirect ('site/adminhome'); } } else diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 6a3c8e1f..62aa8743 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -1,4 +1,5 @@ id = CODEPOT_DEFAULT_SITEID; - $site->name = CODEPOT_DEFAULT_BANNER; + $site->id = CODEPOT_DEFAULT_SITE_LANGUAGE; + $site->name = CODEPOT_DEFAULT_SITE_NAME; $site->text = ''; $site->updatedby = ''; $site->createdby = ''; @@ -48,6 +48,15 @@ class SiteModel extends Model return $result[0]; } + function getAll ($userid) + { + $this->db->trans_start (); + $query = $this->db->get ('site'); + $this->db->trans_complete (); + if ($this->db->trans_status() === FALSE) return FALSE; + return $query->result (); + } + function create ($userid, $site) { $this->db->trans_begin (); diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index a18b003f..0925e720 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -24,9 +24,11 @@ www_DATA = \ project_home.php \ project_list.php \ projectbar.php \ + site_adminhome.php \ site_edit.php \ site_delete.php \ site_home.php \ + site_show.php \ taskbar.php \ wiki_delete.php \ wiki_edit.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index ed66e5da..02a09de3 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -187,9 +187,11 @@ www_DATA = \ project_home.php \ project_list.php \ projectbar.php \ + site_adminhome.php \ site_edit.php \ site_delete.php \ site_home.php \ + site_show.php \ taskbar.php \ wiki_delete.php \ wiki_edit.php \ diff --git a/codepot/src/codepot/views/projectbar.php b/codepot/src/codepot/views/projectbar.php index ddb04f5d..d386ad26 100644 --- a/codepot/src/codepot/views/projectbar.php +++ b/codepot/src/codepot/views/projectbar.php @@ -16,7 +16,7 @@ function show_projectbar ($con, $site, $project, $pageid, $ctxmenuitems) } else if (isset($site) && $site->name != '') print htmlspecialchars($site->name); - else print htmlspecialchars(CODEPOT_DEFAULT_BANNER); + else print htmlspecialchars(CODEPOT_DEFAULT_SITE_NAME); print ""; diff --git a/codepot/src/codepot/views/site_adminhome.php b/codepot/src/codepot/views/site_adminhome.php new file mode 100644 index 00000000..1b3073fb --- /dev/null +++ b/codepot/src/codepot/views/site_adminhome.php @@ -0,0 +1,79 @@ + + +
+ + + + + + + + + + + ++text); ?> ++