diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index e1077b14..1788901d 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -5,8 +5,6 @@ class Issue extends Controller var $VIEW_ERROR = 'error'; var $VIEW_HOME = 'issue_home'; var $VIEW_SHOW = 'issue_show'; - var $VIEW_EDIT = 'issue_edit'; - var $VIEW_DELETE = 'issue_delete'; function Issue () { @@ -257,270 +255,6 @@ class Issue extends Controller } } -/* -DEPRECATED - function _edit_issue ($projectid, $hexid, $mode) - { - $this->load->helper ('form'); - $this->load->library ('form_validation'); - $this->load->model ('ProjectModel', 'projects'); - $this->load->model ('IssueModel', 'issues'); - - $login = $this->login->getUser (); - if ($login['id'] == '') - redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); - $data['login'] = $login; - - $id = $this->converter->HexToAscii ($hexid); - - $project = $this->projects->get ($projectid); - if ($project === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($project === NULL) - { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_PROJECT') . - " - {$projectid}"; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if (!$login['sysadmin?'] && $mode != 'create' && - $this->projects->projectHasMember($project->id, $login['id']) === FALSE) - { - $data['project'] = $project; - $data['message'] = sprintf ( - $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $this->form_validation->set_rules ( - 'issue_projectid', 'project ID', 'required|alpha_dash|max_length[32]'); - $this->form_validation->set_rules ( - 'issue_summary', 'summary', 'required|max_length[255]'); - $this->form_validation->set_rules ( - 'issue_description', 'description', 'required'); - $this->form_validation->set_rules ( - 'issue_type', 'type', 'required'); - $this->form_validation->set_rules ( - 'issue_type', 'status', 'required'); - $this->form_validation->set_rules ( - 'issue_type', 'priority', 'required'); - $this->form_validation->set_error_delimiters ( - '',''); - - $data['mode'] = $mode; - $data['message'] = ''; - $data['project'] = $project; - $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); - $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); - $data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang); - - if ($this->input->post('issue')) - { - $issue = new stdClass(); - $issue->projectid = $this->input->post('issue_projectid'); - $issue->id = $this->input->post('issue_id'); - $issue->summary = $this->input->post('issue_summary'); - $issue->description = $this->input->post('issue_description'); - $issue->type = $this->input->post('issue_type'); - $issue->status = $this->input->post('issue_status'); - $issue->priority = $this->input->post('issue_priority'); - $issue->owner = $this->input->post('issue_owner'); - - if ($this->form_validation->run()) - { - $id = ($mode == 'update')? - $this->issues->update_partial ($login['id'], $issue): - $this->issues->create ($login['id'], $issue); - if ($id === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - else - { - redirect ("issue/show/{$project->id}/" . - $this->converter->AsciiToHex((string)$id)); - } - } - else - { - $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - else - { - if ($mode == 'update') - { - $issue = $this->issues->get ($login['id'], $project, $id); - if ($issue === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($issue == NULL) - { - $data['message'] = sprintf ( - $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - else - { - $issue = new stdClass(); - $issue->projectid = $projectid; - $issue->id = $id; - $issue->summary = ''; - $issue->description = ''; - $issue->type = $this->issuehelper->TYPE_DEFECT; - $issue->status = $this->issuehelper->STATUS_NEW; - $issue->priority = $this->issuehelper->PRIORITY_OTHER; - if ($this->projects->projectHasMember($project->id, $login['id'])) - { - // let the current user be the issue owner if he/she is a - // project memeber. - $issue->owner = $login['id']; - } - else - { - // if not, assign the issue to the first member. - $issue->owner = (count($project->members) > 0)? $project->members[0]: ''; - } - - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - - } - } - - function create ($projectid = '') - { - return $this->_edit_issue ($projectid, '', 'create'); - } - - function update ($projectid = '', $hexid = '') - { - return $this->_edit_issue ($projectid, $hexid, 'update'); - } - - - function delete ($projectid = '', $hexid = '') - { - $this->load->helper ('form'); - $this->load->library ('form_validation'); - $this->load->model ('ProjectModel', 'projects'); - $this->load->model ('IssueModel', 'issues'); - - $login = $this->login->getUser (); - if ($login['id'] == '') - redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); - $data['login'] = $login; - - $id = $this->converter->HexToAscii ($hexid); - - $project = $this->projects->get ($projectid); - if ($project === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($project === NULL) - { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_PROJECT') . - " - {$projectid}"; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if (!$login['sysadmin?'] && - $this->projects->projectHasMember($project->id, $login['id']) === FALSE) - { - $data['project'] = $project; - $data['message'] = sprintf ( - $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['message'] = ''; - $data['project'] = $project; - - $this->form_validation->set_rules ('issue_confirm', 'confirm', 'alpha'); - $this->form_validation->set_error_delimiters('',''); - - if($this->input->post('issue')) - { - $issue = new stdClass(); - $issue->projectid = $this->input->post('issue_projectid'); - $issue->id = $this->input->post('issue_id'); - $data['issue_confirm'] = $this->input->post('issue_confirm'); - - if ($this->form_validation->run()) - { - if ($data['issue_confirm'] == 'yes') - { - $result = $this->issues->delete ($login['id'], $issue); - if ($result === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $data['issue'] = $issue; - $this->load->view ($this->VIEW_DELETE, $data); - } - else - { - redirect ("issue/home/{$project->id}"); - } - } - else - { - redirect ("issue/show/{$project->id}/{$hexid}"); - } - } - else - { - $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); - $data['issue'] = $issue; - $this->load->view ($this->VIEW_DELETE, $data); - } - } - else - { - $issue = $this->issues->get ($login['id'], $project, $id); - if ($issue === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($issue === NULL) - { - $data['message'] = sprintf ( - $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['issue_confirm'] = 'no'; - $data['issue'] = $issue; - $this->load->view ($this->VIEW_DELETE, $data); - } - } - - } - } -*/ - function xhr_create ($projectid = '') { $this->load->model ('ProjectModel', 'projects'); diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index 617304f2..17095ece 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -6,6 +6,7 @@ class Wiki extends Controller var $VIEW_HOME = 'wiki_home'; var $VIEW_SHOW = 'wiki_show'; var $VIEW_EDIT = 'wiki_edit'; + var $VIEW_EDITX = 'wiki_editx'; var $VIEW_DELETE = 'wiki_delete'; function Wiki () @@ -70,7 +71,7 @@ class Wiki extends Controller } } - function _show_wiki ($projectid, $name, $create) + private function _show_wiki ($projectid, $name, $create) { $this->load->model ('ProjectModel', 'projects'); $this->load->model ('WikiModel', 'wikis'); @@ -175,7 +176,7 @@ class Wiki extends Controller $this->_show_wiki ($projectid, $name, FALSE); } - function _edit_wiki ($projectid, $name, $mode) + private function _edit_wiki ($projectid, $name, $mode, $view_edit) { $this->load->helper ('form'); $this->load->library ('form_validation'); @@ -284,7 +285,7 @@ class Wiki extends Controller { $data['wiki'] = $wiki; $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } $wiki->attachments = $atts; @@ -295,7 +296,7 @@ class Wiki extends Controller { $data['message'] = $this->lang->line('WIKI_MSG_NAME_DISALLOWED_CHARS'); $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } @@ -307,7 +308,7 @@ class Wiki extends Controller $wiki->name ); $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } else { @@ -317,7 +318,7 @@ class Wiki extends Controller { $data['wiki'] = $wiki; $data['message'] = $extra; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } @@ -333,7 +334,7 @@ class Wiki extends Controller $data['message'] = 'DATABASE ERROR'; $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } else { @@ -366,7 +367,7 @@ class Wiki extends Controller { $data['wiki'] = $wiki; $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } $wiki->attachments = $atts; @@ -374,7 +375,7 @@ class Wiki extends Controller $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } } else @@ -397,7 +398,7 @@ class Wiki extends Controller else { $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } } else @@ -409,7 +410,7 @@ class Wiki extends Controller $wiki->columns = '1'; $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } } @@ -418,12 +419,22 @@ class Wiki extends Controller function create ($projectid = '', $name = '') { - return $this->_edit_wiki ($projectid, $name, 'create'); + return $this->_edit_wiki ($projectid, $name, 'create', $this->VIEW_EDIT); } function update ($projectid = '', $name = '') { - return $this->_edit_wiki ($projectid, $name, 'update'); + return $this->_edit_wiki ($projectid, $name, 'update', $this->VIEW_EDIT); + } + + function createx ($projectid = '', $name = '') + { + return $this->_edit_wiki ($projectid, $name, 'create', $this->VIEW_EDITX); + } + + function updatex ($projectid = '', $name = '') + { + return $this->_edit_wiki ($projectid, $name, 'update', $this->VIEW_EDITX); } function delete ($projectid = '', $name = '') diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index d95b0592..108e398f 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -15,8 +15,6 @@ www_DATA = \ footer.php \ graph_main.php \ index.html \ - issue_delete.php \ - issue_edit.php \ issue_home.php \ issue_show.php \ log.php \ @@ -36,6 +34,7 @@ www_DATA = \ user_settings.php \ wiki_delete.php \ wiki_edit.php \ + wiki_editx.php \ wiki_home.php \ wiki_show.php diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index 52b47303..9f2c1f46 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -160,8 +160,6 @@ www_DATA = \ footer.php \ graph_main.php \ index.html \ - issue_delete.php \ - issue_edit.php \ issue_home.php \ issue_show.php \ log.php \ @@ -181,6 +179,7 @@ www_DATA = \ user_settings.php \ wiki_delete.php \ wiki_edit.php \ + wiki_editx.php \ wiki_home.php \ wiki_show.php diff --git a/codepot/src/codepot/views/code_edit.php b/codepot/src/codepot/views/code_edit.php index 9870b2f1..ed59487d 100644 --- a/codepot/src/codepot/views/code_edit.php +++ b/codepot/src/codepot/views/code_edit.php @@ -40,7 +40,7 @@ var base_return_anchor = codepot_merge_path('', 'lang->line('Save')?>', autoOpen: false, modal: true, @@ -159,7 +159,7 @@ $(function () { 'lang->line('OK')?>': function () { if (saving_in_progress) return; - var save_message = $("#code_edit_mainarea_save_message").val(); + var save_message = $("#code_edit_save_message").val(); if (save_message == '') return false; editor.setReadOnly (true); @@ -173,8 +173,8 @@ $(function () { success: function(json, textStatus, jqXHR) { saving_in_progress = false; - $('#code_edit_mainarea_save_form').dialog('enable'); - $('#code_edit_mainarea_save_form').dialog('close'); + $('#code_edit_save_form').dialog('enable'); + $('#code_edit_save_form').dialog('close'); if (json.status == "ok") { set_editor_changed (false); @@ -194,15 +194,15 @@ $(function () { error: function(jqXHR, textStatus, errorThrown) { saving_in_progress = false; - $('#code_edit_mainarea_save_form').dialog('enable'); - $('#code_edit_mainarea_save_form').dialog('close'); + $('#code_edit_save_form').dialog('enable'); + $('#code_edit_save_form').dialog('close'); show_alert ('Not saved - ' + errorThrown, "lang->line('Error')?>"); editor.setReadOnly (false); save_button.button ("enable"); } }); - $('#code_edit_mainarea_save_form').dialog('disable'); + $('#code_edit_save_form').dialog('disable'); }, 'lang->line('Cancel')?>': function () { @@ -219,7 +219,7 @@ $(function () { save_button.click (function() { - if (editor_changed) $("#code_edit_mainarea_save_form").dialog('open'); + if (editor_changed) $("#code_edit_save_form").dialog('open'); return false; }); @@ -300,17 +300,17 @@ $this->load->view (
' . $this->lang->line('ID') . ' | '; print '' . $this->lang->line('Type') . ' | '; @@ -381,50 +381,50 @@ else print '
---|
+++description); ?>-
';
if ($new->comment != "")
{
- print " ";
- print "
-
+
type),
- 'id="issue_show_mainarea_edit_type" disabled="disabled"'
+ 'id="issue_show_edit_type" disabled="disabled"'
);
?>
- ' value='summary); ?>'/>
+ ' value='summary); ?>'/>
-
+
-
+
-
+
-
+
-
+
+
lang->line('MSG_SURE_TO_DELETE_THIS') . ' - ' . $issue->id . ': ' . htmlspecialchars($issue->summary); ?>
-
-
-
-
+
-
+
+
+
|