From c671cafa5dd032698261678f7e61501d02044106 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 6 Sep 2015 15:02:46 +0000 Subject: [PATCH] enhanced the file home view to upload multiple files and deprecated the file creation view added the file_list table. dropped the md5sum and summary columns from the file table --- codepot/README | 4 + codepot/etc/codepot.mysql | 16 + codepot/src/codepot/controllers/code.php | 6 +- codepot/src/codepot/controllers/file.php | 120 ++++++- .../codepot/language/english/file_lang.php | 2 + .../src/codepot/language/korean/file_lang.php | 2 + codepot/src/codepot/models/filemodel.php | 230 ++++++++++++- .../src/codepot/models/subversionmodel.php | 1 - codepot/src/codepot/views/code_file.php | 2 + codepot/src/codepot/views/code_folder.php | 11 +- codepot/src/codepot/views/code_search.php | 1 + codepot/src/codepot/views/file_edit.php | 13 +- codepot/src/codepot/views/file_home.php | 317 ++++++++++++++++-- codepot/src/codepot/views/file_show.php | 21 +- codepot/src/codepot/views/issue_home.php | 1 + codepot/src/css/common.css | 94 +++--- 16 files changed, 720 insertions(+), 121 deletions(-) diff --git a/codepot/README b/codepot/README index bbbc180e..e3bef2cd 100644 --- a/codepot/README +++ b/codepot/README @@ -15,6 +15,10 @@ UPGRADING FROM 0.2.0 mysql> ALTER TABLE user_settings CHANGE code_hide_details code_hide_metadata CHAR(1) NOT NULL; mysql> ALTER TABLE site ADD COLUMN(summary VARCHAR(255) NOT NULL); mysql> RENAME TABLE user TO user_account; + mysql> ALTER TABLE file DROP INDEX encname; + mysql> INSERT INTO file_list (projectid, name, filename, encname, md5sum, description) SELECT projectid, name, name, encname, md5sum, summary FROM file WHERE md5sum != ''; + mysql> ALTER TABLE file DROP COLUMN summary; + mysql> ALTER TABLE file DROP COLUMN md5sum; INSTALLATION ON CENTOS diff --git a/codepot/etc/codepot.mysql b/codepot/etc/codepot.mysql index 5c04914d..55201ef0 100644 --- a/codepot/etc/codepot.mysql +++ b/codepot/etc/codepot.mysql @@ -179,6 +179,22 @@ CREATE TABLE file ( ON DELETE RESTRICT ON UPDATE CASCADE ) charset=utf8 engine=InnoDB; +CREATE TABLE file_list ( + projectid VARCHAR(32) NOT NULL, + name VARCHAR(255) NOT NULL, + filename VARCHAR(255) NOT NULL, + encname VARCHAR(255) NOT NULL, + md5sum CHAR(32) NOT NULL, + description VARCHAR(255) NOT NULL, + + INDEX file_list_id (projectid, name), + UNIQUE KEY file_list_fileid (projectid, filename), + UNIQUE KEY (encname), + + CONSTRAINT file_list_projectid FOREIGN KEY (projectid,name) REFERENCES file(projectid,name) + ON DELETE RESTRICT ON UPDATE CASCADE +) charset=utf8 engine=InnoDB; + CREATE TABLE code_review ( projectid VARCHAR(32) NOT NULL, rev BIGINT NOT NULL, diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index f9cc8b3a..8633fe91 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -378,19 +378,19 @@ class Code extends Controller $import_files = array (); for ($i = 0; $i < $post_max_item_no; $i++) { - $d = $this->input->post("code_new_item_dir_$i"); + $d = $this->input->post("code_new_item_dir_{$i}"); if (strlen($d) > 0) { array_push ($import_files, array ('type' => 'dir', 'name' => $d)); } - $d = $this->input->post("code_new_item_empfile_$i"); + $d = $this->input->post("code_new_item_empfile_{$i}"); if (strlen($d) > 0) { array_push ($import_files, array ('type' => 'empfile', 'name' => $d)); } - $fid = "code_new_item_file_$i"; + $fid = "code_new_item_file_{$i}"; if (array_key_exists($fid, $_FILES) && $_FILES[$fid]['name'] != '') { array_push ($import_files, array ('type' => 'file', 'name' => $_FILES[$fid]['name'], 'fid' => $fid, 'unzip' => $post_unzip)); diff --git a/codepot/src/codepot/controllers/file.php b/codepot/src/codepot/controllers/file.php index a8d789d9..07dc58eb 100644 --- a/codepot/src/codepot/controllers/file.php +++ b/codepot/src/codepot/controllers/file.php @@ -157,7 +157,7 @@ class File extends Controller redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); } - $file = $this->files->get ($login['id'], $project, $name); + $file = $this->files->fetch_file ($login['id'], $project, $name); if ($file === FALSE) { $data['project'] = $project; @@ -166,8 +166,11 @@ class File extends Controller } else if ($file === NULL) { - redirect ("file/create/{$projectid}/" . - $this->converter->AsciiToHex($name)); + /*redirect ("file/create/{$projectid}/" . + $this->converter->AsciiToHex($name));*/ + $data['project'] = $project; + $data['message'] = "CANNOT FIND FILE - {$name}"; + $this->load->view ($this->VIEW_ERROR, $data); } else { @@ -276,8 +279,6 @@ class File extends Controller 'file_projectid', 'project ID', 'required|alpha_dash|max_length[32]'); $this->form_validation->set_rules ( 'file_tag', 'tag', 'required|max_length[50]'); - $this->form_validation->set_rules ( - 'file_summary', 'summary', 'required|max_length[255]'); $this->form_validation->set_rules ( 'file_description', 'description', 'required'); $this->form_validation->set_error_delimiters ( @@ -293,7 +294,6 @@ class File extends Controller $file->name = ''; $file->encname = ''; $file->tag = $this->input->post('file_tag'); - $file->summary = $this->input->post('file_summary'); $file->description = $this->input->post('file_description'); if ($this->form_validation->run()) @@ -316,6 +316,10 @@ class File extends Controller } else { + $data['message'] = 'NOT SUPPORTED ANYMORE'; + $data['file'] = $file; + $this->load->view ($this->VIEW_EDIT, $data); + /* $fname = $_FILES['file_name']['name']; if (strpos ($fname, ':') !== FALSE) @@ -357,7 +361,7 @@ class File extends Controller $file->name = $_FILES['file_name']['name']; $file->encname = $upload['file_name']; - $md5sum = md5_file ($upload['full_path']); + $md5sum = @md5_file ($upload['full_path']); if ($md5sum === FALSE) { @unlink ($upload['full_path']); @@ -382,11 +386,13 @@ class File extends Controller $this->converter->AsciiToHex($file->name)); } } - } + } */ } } else { + if ($mode == 'update') $file->name = $name; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['file'] = $file; $this->load->view ($this->VIEW_EDIT, $data); @@ -431,10 +437,11 @@ class File extends Controller } } + /* function create ($projectid = '', $name = '') { return $this->_edit_file ($projectid, $name, "create"); - } + }*/ function update ($projectid = '', $name = '') { @@ -543,6 +550,101 @@ class File extends Controller } } + + function xhr_import ($projectid = '') + { + $this->load->model ('ProjectModel', 'projects'); + $this->load->model ('FileModel', 'files'); + $this->load->library ('upload'); + + $login = $this->login->getUser (); + $revision_saved = -1; + + if ($login['id'] == '') + { + $status = 'signin'; + } + else + { + $project = $this->projects->get ($projectid); + if ($project === FALSE) + { + $status = "dberr - failed to get the project {$projectid}"; + } + else if ($project === NULL) + { + $status = "noent - no such project {$projectid}"; + } + else + { + $post_new_tag = $this->input->post('file_new_tag'); + $post_new_name = $this->input->post('file_new_name'); + $post_new_description = $this->input->post('file_new_description'); + $post_new_file_count = $this->input->post('file_new_file_count'); + + if ($post_new_tag === FALSE || ($post_new_tag = trim($post_new_tag)) == '') + { + $status = 'error - no tag'; + } + else if ($post_new_name === FALSE || ($post_new_name = trim($post_new_name)) == '') + { + $status = 'error - no name'; + } + else if ($post_new_description === FALSE || ($post_new_description = $post_new_description) == '') + { + $status = 'error - no description'; + } + else + { + if ($post_new_file_count === FALSE || $post_new_file_count <= 0) $post_new_file_count = 0; + + $status = ''; + $import_files = array (); + for ($i = 0; $i < $post_new_file_count; $i++) + { + $fid = "file_new_file_{$i}"; + if (array_key_exists($fid, $_FILES) && $_FILES[$fid]['name'] != '') + { + $d = $this->input->post("file_new_file_desc_{$i}"); + if ($d === FALSE || ($d = trim($d)) == '') + { + $status = "error - no short description for {$_FILES[$fid]['name']}"; + break; + } + + if (strpos($_FILES[$fid]['name'], ':') !== FALSE) + { + /* for wiki */ + $status = "error - colon not allowed - {$_FILES[$fid]['name']}"; + break; + } + + array_push ($import_files, array ('fid' => $fid, 'name' => $_FILES[$fid]['name'], 'desc' => $d)); + } + } + + if ($status == '') + { + if (count($import_files) <= 0) + { + $status = 'error - no files uploaded'; + } + else if ($this->files->import ($login['id'], $projectid, $post_new_tag, $post_new_name, $post_new_description, $import_files, $this->upload) === FALSE) + { + $status = 'error - ' . $this->files->getErrorMessage(); + } + else + { + $status = 'ok'; + } + } + } + } + + print $status; + } + } + } ?> diff --git a/codepot/src/codepot/language/english/file_lang.php b/codepot/src/codepot/language/english/file_lang.php index 5d79a664..aa68dbe1 100644 --- a/codepot/src/codepot/language/english/file_lang.php +++ b/codepot/src/codepot/language/english/file_lang.php @@ -2,4 +2,6 @@ $lang['FILE_MSG_NAME_NO_COLON'] = 'File name containing a colon'; $lang['FILE_MSG_NO_SUCH_FILE'] = 'No such file - %s'; $lang['FILE_MSG_NO_FILES_AVAILABLE'] = 'No files available'; + +$lang['FILE_FMT_TOTAL_X_FILES'] = 'Total %d file(s)'; ?> diff --git a/codepot/src/codepot/language/korean/file_lang.php b/codepot/src/codepot/language/korean/file_lang.php index 90c5381f..44641c26 100644 --- a/codepot/src/codepot/language/korean/file_lang.php +++ b/codepot/src/codepot/language/korean/file_lang.php @@ -2,4 +2,6 @@ $lang['FILE_MSG_NAME_NO_COLON'] = '파일이름에 콜론기호를 포함할 수 없습니다'; $lang['FILE_MSG_NO_SUCH_FILE'] = '파일이 없습니다 - %s'; $lang['FILE_MSG_NO_FILES_AVAILABLE'] = '사용할 수 있는 파일이 없습니다'; + +$lang['FILE_FMT_TOTAL_X_FILES'] = '전체 파일 %5개'; ?> diff --git a/codepot/src/codepot/models/filemodel.php b/codepot/src/codepot/models/filemodel.php index bcda008d..e3b6ad22 100644 --- a/codepot/src/codepot/models/filemodel.php +++ b/codepot/src/codepot/models/filemodel.php @@ -2,6 +2,18 @@ class FileModel extends Model { + protected $errmsg = ''; + + function capture_error ($errno, $errmsg) + { + $this->errmsg = $errmsg; + } + + function getErrorMessage () + { + return $this->errmsg; + } + function FileModel () { parent::Model (); @@ -10,10 +22,46 @@ class FileModel extends Model function get ($userid, $project, $name) { - $this->db->trans_start (); + $this->db->trans_begin (); $this->db->where ('projectid', $project->id); $this->db->where ('name', $name); $query = $this->db->get ('file'); + + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + return FALSE; + } + + $result = $query->result (); + if (empty($result)) $file = NULL; + else + { + $file = $result[0]; + + $this->db->where ('projectid', $project->id); + $this->db->where ('name', $file->name); + $this->db->select ('filename,encname,md5sum,description'); + $query = $this->db->get('file_list'); + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + return FALSE; + } + + $file->file_list = $query->result(); + } + + $this->db->trans_commit(); + return $file; + } + + function fetch_file ($userid, $project, $name) + { + $this->db->trans_start (); + $this->db->where ('projectid', $project->id); + $this->db->where ('filename', $name); + $query = $this->db->get ('file_list'); $this->db->trans_complete (); if ($this->db->trans_status() === FALSE) return FALSE; @@ -24,17 +72,41 @@ class FileModel extends Model function getAll ($userid, $project) { - $this->db->trans_start (); + $this->db->trans_begin (); $this->db->where ('projectid', $project->id); $this->db->order_by ('tag', 'desc'); $this->db->order_by ('name', 'asc'); $query = $this->db->get ('file'); - $this->db->trans_complete (); + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + return FALSE; + } - if ($this->db->trans_status() === FALSE) return FALSE; - return $query->result (); + $files = $query->result (); + + $subfiles = array (); + foreach ($files as &$f) + { + $this->db->where ('projectid', $project->id); + $this->db->where ('name', $f->name); + $this->db->select ('filename,encname,md5sum,description'); + $query = $this->db->get('file_list'); + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + return FALSE; + } + + $f->file_list = $query->result(); + } + + $this->db->trans_commit (); + + return $files; } + /* function create ($userid, $file) { $this->db->trans_start (); @@ -42,7 +114,6 @@ class FileModel extends Model $this->db->set ('name', $file->name); $this->db->set ('encname', $file->encname); $this->db->set ('tag', $file->tag); - $this->db->set ('summary', $file->summary); $this->db->set ('md5sum', $file->md5sum); $this->db->set ('description', $file->description); $this->db->set ('createdon', date('Y-m-d H:i:s')); @@ -62,6 +133,7 @@ class FileModel extends Model $this->db->trans_complete (); return $this->db->trans_status(); } + */ function update ($userid, $file) { @@ -69,7 +141,6 @@ class FileModel extends Model $this->db->where ('projectid', $file->projectid); $this->db->where ('name', $file->name); $this->db->set ('tag', $file->tag); - $this->db->set ('summary', $file->summary); $this->db->set ('description', $file->description); $this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedby', $userid); @@ -93,7 +164,7 @@ class FileModel extends Model $this->db->where ('projectid', $file->projectid); $this->db->where ('name', $file->name); - $query = $this->db->get ('file'); + $query = $this->db->get ('file_list'); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback (); @@ -107,11 +178,29 @@ class FileModel extends Model return FALSE; } - $encname = $result[0]->encname; + $file_names = array (); + foreach ($result as $f) + { + array_push ($file_names, $f->encname); + } + + $this->db->where ('projectid', $file->projectid); + $this->db->where ('name', $file->name); + $this->db->delete ('file_list'); + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback (); + return FALSE; + } $this->db->where ('projectid', $file->projectid); $this->db->where ('name', $file->name); $this->db->delete ('file'); + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback (); + return FALSE; + } $this->db->set ('createdon', date('Y-m-d H:i:s')); $this->db->set ('type', 'file'); @@ -120,23 +209,140 @@ class FileModel extends Model $this->db->set ('userid', $userid); $this->db->set ('message', $file->name); $this->db->insert ('log'); - + if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback (); return FALSE; } - $path = CODEPOT_FILE_DIR . '/' . $encname; - if (@unlink ($path) === FALSE) + $file_name_count = count($file_names); + for ($i = 0; $i < $file_name_count; $i++) { + $encname = $file_names[$i]; + $path = CODEPOT_FILE_DIR . '/' . $encname; + if (@unlink ($path) === FALSE) + { + if ($i == 0) + { + $this->db->trans_rollback (); + return FALSE; + } + else + { + // there is no good way to recover from the error. + // carry on. some files will get orphaned. + } + } + } + + $this->db->trans_commit (); + return TRUE; + } + + private function delete_all_files ($files) + { + foreach ($files as $f) @unlink ($f); + } + + private function _import ($userid, $projectid, $tag, $name, $description, $import_files, $uploader) + { + $this->db->trans_begin (); // manual transaction. not using trans_start(). + + $this->db->set ('projectid', $projectid); + $this->db->set ('name', $name); + $this->db->set ('encname', ''); + $this->db->set ('tag', $tag); + $this->db->set ('description', $description); + $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 ('file'); + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); $this->db->trans_rollback (); return FALSE; } + $config['allowed_types'] = '*'; + $config['upload_path'] = CODEPOT_FILE_DIR; + $config['max_size'] = CODEPOT_MAX_UPLOAD_SIZE; + $config['encrypt_name'] = TRUE; + $config['overwrite'] = FALSE; + $config['remove_spaces'] = FALSE; + $uploader->initialize ($config); + + $ok_files = array(); + $file_count = count($import_files); + for ($i = 0; $i < $file_count; $i++) + { + $f = $import_files[$i]; + if (!$uploader->do_upload($f['fid'])) + { + $this->errmsg = "Failed to upload {$f['name']}"; + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + + $ud = $uploader->data(); + array_push ($ok_files, $ud['full_path']); + + $md5sum = @md5_file ($ud['full_path']); + if ($md5sum === FALSE) + { + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + + $this->db->set ('projectid', $projectid); + $this->db->set ('name', $name); + $this->db->set ('filename', $f['name']); + $this->db->set ('encname', $ud['file_name']); + + $this->db->set ('md5sum', $md5sum); + $this->db->set ('description', $f['desc']); + $this->db->insert ('file_list'); + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + } + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'file'); + $this->db->set ('action', 'create'); + $this->db->set ('projectid', $projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $name); + $this->db->insert ('log'); + + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + $this->db->trans_commit (); return TRUE; } + + function import ($userid, $projectid, $tag, $name, $description, $import_files, $uploader) + { + set_error_handler (array ($this, 'capture_error')); + $errmsg = ''; + $x = $this->_import ($userid, $projectid, $tag, $name, $description, $import_files, $uploader); + restore_error_handler (); + return $x; + } } ?> diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index ab26a37b..a2ada4e4 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -261,7 +261,6 @@ class SubversionModel extends Model return $fileinfo; } - function storeFile ($projectid, $path, $committer, $commit_message, $text) { $errmsg = ''; diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index 47154384..89d79ecb 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -52,6 +52,8 @@ $(function () { $("#code_file_mainarea_metadata_button").button( "option", "label", "lang->line('Hide metadata')?>"); } + + return false; // prevent the default behavior }); $("#code_file_mainarea_edit_button").button(); diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php index 974cada6..b5523f6d 100644 --- a/codepot/src/codepot/views/code_folder.php +++ b/codepot/src/codepot/views/code_folder.php @@ -532,6 +532,7 @@ $(function () { $('#code_folder_mainarea_new_button').button().click (function() { $('#code_folder_mainarea_new_form_div').dialog('open'); + return false; // prevent the default behavior }); $('#code_folder_mainarea_delete_button').button().click (function() { @@ -545,6 +546,8 @@ $(function () { codepot_sprintf ("lang->line('CODE_FMT_DELETE_X_SELECTED_FILES')) ?>", xi) ); $('#code_folder_mainarea_delete_form_div').dialog('open'); + + return false; // prevent the default behavior }); $('#code_folder_mainarea_rename_button').button().click (function() { @@ -570,6 +573,8 @@ $(function () { codepot_sprintf ("lang->line('CODE_FMT_RENAME_X_SELECTED_FILES')) ?>", xi) ); $('#code_folder_mainarea_rename_form_div').dialog('open'); + + return false; // prevent the default behavior }); @@ -597,6 +602,8 @@ $(function () { $("#code_folder_mainarea_metadata_button").button( "option", "label", "lang->line('Hide metadata')?>"); } + + return false; }); btn = $("#code_folder_mainarea_result_info_loc_by_lang_button").button().click (function () { @@ -638,6 +645,8 @@ $(function () { $('#code_search_string_icon').addClass("fa-cog fa-spin"); $('#code_search_form').submit (); } + + return false; // prevent the default behavior }); $('#code_search_invertedly').button(); @@ -1090,8 +1099,6 @@ $this->load->view ( - -
diff --git a/codepot/src/codepot/views/code_search.php b/codepot/src/codepot/views/code_search.php index 99a3162c..0b1bdc97 100644 --- a/codepot/src/codepot/views/code_search.php +++ b/codepot/src/codepot/views/code_search.php @@ -33,6 +33,7 @@ $(function() { $('#code_search_string_icon').addClass ('fa-cog fa-spin'); $('#code_search_form').submit (); } + return false; // prevent the default behavior }); /* diff --git a/codepot/src/codepot/views/file_edit.php b/codepot/src/codepot/views/file_edit.php index 0d136408..7cfcc977 100644 --- a/codepot/src/codepot/views/file_edit.php +++ b/codepot/src/codepot/views/file_edit.php @@ -105,18 +105,7 @@ $this->load->view ( tag), $extra)?>
- -
- lang->line('Summary').': ', 'file_summary')?> - -
-
- - summary), $extra)?> -
- +
lang->line('Description').': ', 'file_description')?> lang->line('Preview')?> diff --git a/codepot/src/codepot/views/file_home.php b/codepot/src/codepot/views/file_home.php index e517fa67..26a6025b 100644 --- a/codepot/src/codepot/views/file_home.php +++ b/codepot/src/codepot/views/file_home.php @@ -10,10 +10,220 @@ + + + + + + + + + + + + <?php print htmlspecialchars($project->name)?> @@ -39,9 +249,7 @@ $this->load->view ( 'project' => $project, ), - 'ctxmenuitems' => array ( - array ("file/create/{$project->id}", ' ' . $this->lang->line('New')) - ) + 'ctxmenuitems' => array () ) ); ?> @@ -51,6 +259,16 @@ $this->load->view (
lang->line('Files')?>
+
+ lang->line('FILE_FMT_TOTAL_X_FILES'), count($files)); ?> + + + | + lang->line('New')?> + + +
+
' . $this->lang->line('Download'); - $download_anchor_text = ''; - print ''; print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; - //print ''; print ''; $oldtag = ''; @@ -118,32 +333,80 @@ else { $hexname = $this->converter->AsciiToHex ($file->name); $rowclass = $rowclasses[$rownum++ % 2]; - print ""; - print '"; + + $f = $file->file_list[$i]; + $xname = $this->converter->AsciiToHex ($f->filename); + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; } print '
' . $this->lang->line('Tag') . '' . $this->lang->line('Name') . '' . $this->lang->line('Name') . '' . $this->lang->line('File') . '' . $this->lang->line('Summary') . '' . $this->lang->line('MD5') . '' . $this->lang->line('Download') . '
'; - if ($file->tag != $oldtag) + + $file_list_count = count($file->file_list); + + for ($i = 0; $i < $file_list_count; $i++) { - print htmlspecialchars($file->tag); - $oldtag = $file->tag; + print "
'; + if ($i == 0 && $file->tag != $oldtag) + { + print htmlspecialchars($file->tag); + $oldtag = $file->tag; + } + print ''; + if ($i == 0) print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); + print ''; + print anchor ("file/get/{$project->id}/{$xname}", $f->filename); + print ''; + print htmlspecialchars($f->description); + print ''; + print $f->md5sum; + print '
'; - print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); - print ''; - print anchor ("file/get/{$project->id}/{$hexname}", $download_anchor_text); - print ''; - print htmlspecialchars($file->summary); - print ''; - print $file->md5sum; - print '
'; } ?> + +
+ + + +
+
lang->line('Tag'); ?>:
+
lang->line('Name'); ?>:
+ + +
+ + + +
+
diff --git a/codepot/src/codepot/views/file_show.php b/codepot/src/codepot/views/file_show.php index d58071f6..047a6513 100644 --- a/codepot/src/codepot/views/file_show.php +++ b/codepot/src/codepot/views/file_show.php @@ -89,7 +89,7 @@ $this->load->view ( ), 'ctxmenuitems' => array ( - array ("file/create/{$project->id}", ' ' . $this->lang->line('New')), + //array ("file/create/{$project->id}", ' ' . $this->lang->line('New')), array ("file/update/{$project->id}/{$hexname}", ' ' . $this->lang->line('Edit')), array ("file/delete/{$project->id}/{$hexname}", ' ' . $this->lang->line('Delete')) ) @@ -104,11 +104,7 @@ $this->load->view (
name)?>
- ' . $this->lang->line('Download'); - print anchor ("file/get/{$project->id}/". $this->converter->AsciiToHex($file->name), $download_anchor_text); - ?> - | lang->line('Metadata')?> + lang->line('Metadata')?>
@@ -131,9 +127,18 @@ $this->load->view (
  • lang->line('Last updated by')?> updatedby ?>
  • -
    lang->line('MD5')?>
    +
    lang->line('Files')?>
      -
    • md5sum ?>
    • + file_list as $f) + { + $xname = $this->converter->AsciiToHex($f->filename); + print '
    • '; + print anchor ("file/get/{$project->id}/{$xname}", $f->filename); + print " {$f->md5sum}"; + print '
    • '; + } + ?>
    diff --git a/codepot/src/codepot/views/issue_home.php b/codepot/src/codepot/views/issue_home.php index d802872e..a11732ed 100644 --- a/codepot/src/codepot/views/issue_home.php +++ b/codepot/src/codepot/views/issue_home.php @@ -53,6 +53,7 @@ $(function () { $("#issue_home_mainarea_search_button").button().click ( function () { $('#issue_home_mainarea_search_form').dialog('open'); + return false; // prevent the default behavior } ); }); diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index 1c728fdf..b7cfe59e 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -594,7 +594,7 @@ body { } .content .mainarea pre.line-numbered code.line-numbered-code { - /* this should override some properties of .content .mainarea .prettyprint */ + /* this should override some properties of .prettyprint */ color:black; display:block; @@ -616,12 +616,12 @@ body { clear:both; } -.content .mainarea .prettyprint ol { +.prettyprint ol { /* this is used for line numbering when numbering is sequential. */ white-space: pre-wrap; } -.content .mainarea .prettyprint { +.prettyprint { /* anything that make prettyprint area different from other pres? */ /*background-color: #FFFFFF;*/ /*border: 1px solid #ccc;*/ @@ -640,24 +640,24 @@ body { } -.content .prettyprint .pln { color: #222222; } -.content .prettyprint .str { color: #AA1111; } -.content .prettyprint .kwd { color: #2222ff; } -.content .prettyprint .com { color: #888a88; font-style: italic; } -.content .prettyprint .typ { color: #4271ae; } -.content .prettyprint .lit { color: #f5871f; } -.content .prettyprint .pun { color: #4d4d4c; } -.content .prettyprint .opn { color: #4d4d4c; } -.content .prettyprint .clo { color: #4d4d4c; } -.content .prettyprint .tag { color: #c82829; } -.content .prettyprint .atn { color: #f5871f; } -.content .prettyprint .atv { color: #3e999f; } -.content .prettyprint .dec { color: #f5871f; } -.content .prettyprint .var { color: #c82829; } -.content .prettyprint .fun { color: #4271ae; } +.prettyprint .pln { color: #222222; } +.prettyprint .str { color: #AA1111; } +.prettyprint .kwd { color: #2222ff; } +.prettyprint .com { color: #888a88; font-style: italic; } +.prettyprint .typ { color: #4271ae; } +.prettyprint .lit { color: #f5871f; } +.prettyprint .pun { color: #4d4d4c; } +.prettyprint .opn { color: #4d4d4c; } +.prettyprint .clo { color: #4d4d4c; } +.prettyprint .tag { color: #c82829; } +.prettyprint .atn { color: #f5871f; } +.prettyprint .atv { color: #3e999f; } +.prettyprint .dec { color: #f5871f; } +.prettyprint .var { color: #c82829; } +.prettyprint .fun { color: #4271ae; } /* Specify class=linenums on a pre to get line numbering */ -.content .prettyprint ol.linenums { +.prettyprint ol.linenums { margin-top: 0; margin-bottom: 0; margin-left: 1em; @@ -666,40 +666,40 @@ body { } /* IE indents via margin-left */ /* -.content .prettyprint li.L0, -.content .prettyprint li.L1, -.content .prettyprint li.L2, -.content .prettyprint li.L3, -.content .prettyprint li.L5, -.content .prettyprint li.L6, -.content .prettyprint li.L7, -.content .prettyprint li.L8 { list-style-type: none } +.prettyprint li.L0, +.prettyprint li.L1, +.prettyprint li.L2, +.prettyprint li.L3, +.prettyprint li.L5, +.prettyprint li.L6, +.prettyprint li.L7, +.prettyprint li.L8 { list-style-type: none } */ /* Alternate shading for lines */ /* -.content .prettyprint li.L1, -.content .prettyprint li.L3, -.content .prettyprint li.L5, -.content .prettyprint li.L7, -.content .prettyprint li.L9 { background: #eee } +.prettyprint li.L1, +.prettyprint li.L3, +.prettyprint li.L5, +.prettyprint li.L7, +.prettyprint li.L9 { background: #eee } */ @media print { - .content .prettyprint .pln { color: #222222; } - .content .prettyprint .str { color: #AA1111; } - .content .prettyprint .kwd { color: #2222ff; font-weight: bold; } - .content .prettyprint .com { color: #888a88; font-style: italic; } - .content .prettyprint .typ { color: #4271ae; font-weight: bold; } - .content .prettyprint .lit { color: #f5871f; } - .content .prettyprint .pun { color: #4d4d4c; } - .content .prettyprint .opn { color: #4d4d4c; } - .content .prettyprint .clo { color: #4d4d4c; } - .content .prettyprint .tag { color: #c82829; font-weight: bold; } - .content .prettyprint .atn { color: #f5871f; } - .content .prettyprint .atv { color: #3e999f; } - .content .prettyprint .dec { color: #f5871f; } - .content .prettyprint .var { color: #c82829; } - .content .prettyprint .fun { color: #4271ae; } + .prettyprint .pln { color: #222222; } + .prettyprint .str { color: #AA1111; } + .prettyprint .kwd { color: #2222ff; font-weight: bold; } + .prettyprint .com { color: #888a88; font-style: italic; } + .prettyprint .typ { color: #4271ae; font-weight: bold; } + .prettyprint .lit { color: #f5871f; } + .prettyprint .pun { color: #4d4d4c; } + .prettyprint .opn { color: #4d4d4c; } + .prettyprint .clo { color: #4d4d4c; } + .prettyprint .tag { color: #c82829; font-weight: bold; } + .prettyprint .atn { color: #f5871f; } + .prettyprint .atv { color: #3e999f; } + .prettyprint .dec { color: #f5871f; } + .prettyprint .var { color: #c82829; } + .prettyprint .fun { color: #4271ae; } } .content .infostrip {