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
This commit is contained in:
		| @ -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 | ||||
|  | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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)); | ||||
|  | ||||
| @ -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; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| ?> | ||||
|  | ||||
| @ -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)'; | ||||
| ?> | ||||
|  | ||||
| @ -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개'; | ||||
| ?> | ||||
|  | ||||
| @ -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) return FALSE; | ||||
| 		return $query->result (); | ||||
| 		if ($this->db->trans_status() === FALSE)  | ||||
| 		{ | ||||
| 			$this->db->trans_rollback(); | ||||
| 			return FALSE; | ||||
| 		} | ||||
|  | ||||
| 		$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'); | ||||
| @ -127,16 +216,133 @@ class FileModel extends Model | ||||
| 			return 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; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| ?> | ||||
|  | ||||
| @ -261,7 +261,6 @@ class SubversionModel extends Model | ||||
| 		return $fileinfo; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	function storeFile ($projectid, $path, $committer, $commit_message, $text) | ||||
| 	{ | ||||
| 		$errmsg = ''; | ||||
|  | ||||
| @ -52,6 +52,8 @@ $(function () { | ||||
| 			$("#code_file_mainarea_metadata_button").button( | ||||
| 				"option", "label", "<?php print $this->lang->line('Hide metadata')?>"); | ||||
| 		} | ||||
|  | ||||
| 		return false; // prevent the default behavior | ||||
| 	}); | ||||
|  | ||||
| 	$("#code_file_mainarea_edit_button").button(); | ||||
|  | ||||
| @ -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 ("<?php print addslashes($this->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 ("<?php print addslashes($this->lang->line('CODE_FMT_RENAME_X_SELECTED_FILES')) ?>", xi) | ||||
| 		); | ||||
| 		$('#code_folder_mainarea_rename_form_div').dialog('open'); | ||||
|  | ||||
| 		return false; // prevent the default behavior | ||||
| 	}); | ||||
| <?php endif; ?> | ||||
|  | ||||
| @ -597,6 +602,8 @@ $(function () { | ||||
| 			$("#code_folder_mainarea_metadata_button").button( | ||||
| 				"option", "label", "<?php print $this->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 ( | ||||
|  | ||||
| </div> <!-- code_folder_mainarea_result --> | ||||
|  | ||||
|  | ||||
|  | ||||
| <?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
|  | ||||
| <div id="code_folder_mainarea_new_form_div"> | ||||
|  | ||||
| @ -33,6 +33,7 @@ $(function() { | ||||
| 			$('#code_search_string_icon').addClass ('fa-cog fa-spin'); | ||||
| 			$('#code_search_form').submit (); | ||||
| 		} | ||||
| 		return false; // prevent the default behavior | ||||
| 	}); | ||||
|  | ||||
| 	/* | ||||
|  | ||||
| @ -106,17 +106,6 @@ $this->load->view ( | ||||
| 		<?php print form_error('file_tag');?> | ||||
| 	</div> | ||||
|  | ||||
| 	<div class='form_input_label'> | ||||
| 		<?php print form_label($this->lang->line('Summary').': ', 'file_summary')?> | ||||
| 		<?php print form_error('file_summary');?> | ||||
| 	</div> | ||||
| 	<div class='form_input_field'> | ||||
| 		<?php  | ||||
| 			$extra = 'maxlength="255" size="80"'; | ||||
| 		?> | ||||
| 		<?php print form_input('file_summary', set_value('file_summary', $file->summary), $extra)?> | ||||
| 	</div> | ||||
| 	 | ||||
| 	<div class='form_input_label'> | ||||
| 		<?php print form_label($this->lang->line('Description').': ', 'file_description')?> | ||||
| 		<a href='#' id='file_edit_mainarea_description_preview_button'><?php print $this->lang->line('Preview')?></a> | ||||
|  | ||||
| @ -10,10 +10,220 @@ | ||||
| <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/file.css')?>" /> | ||||
| <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" /> | ||||
|  | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/creole.js')?>"></script> | ||||
|  | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/prettify/prettify.js')?>"></script> | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/prettify/lang-css.js')?>"></script> | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/prettify/lang-lisp.js')?>"></script> | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/prettify/lang-lua.js')?>"></script> | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/prettify/lang-sql.js')?>"></script> | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/prettify/lang-vb.js')?>"></script> | ||||
|  | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script> | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script> | ||||
| <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" /> | ||||
|  | ||||
| <script type="text/javascript"> | ||||
|  | ||||
| function show_alert (outputMsg, titleMsg)  | ||||
| { | ||||
| 	$('#file_home_mainarea_alert').html(outputMsg).dialog({ | ||||
| 		title: titleMsg, | ||||
| 		resizable: true, | ||||
| 		modal: true, | ||||
| 		width: 'auto', | ||||
| 		height: 'auto', | ||||
| 		buttons: { | ||||
| 			"OK": function () { | ||||
| 				$(this).dialog("close"); | ||||
| 			} | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| function render_wiki(input_text) | ||||
| { | ||||
| 	creole_render_wiki_with_input_text ( | ||||
| 		input_text, | ||||
| 		"file_home_mainarea_new_description_preview",  | ||||
| 		"<?php print site_url()?>/wiki/show/<?php print $project->id?>/", | ||||
| 		"<?php print site_url()?>/wiki/attachment0/<?php print $project->id?>/" | ||||
| 	); | ||||
|  | ||||
| 	prettyPrint (); | ||||
| } | ||||
|  | ||||
| var new_item_no = 0; | ||||
| var import_in_progress = false; | ||||
| var populated_file_obj = []; | ||||
| var populated_file_max = 0; | ||||
|  | ||||
| function populate_selected_files () | ||||
| { | ||||
| 	var file_desc = {}; | ||||
| 	for (var n = 0; n < populated_file_max; n++) | ||||
| 	{ | ||||
| 		var f = populated_file_obj[n]; | ||||
| 		if (f != null) | ||||
| 		{ | ||||
| 			var d = $('#file_home_mainarea_new_file_desc_' + n); | ||||
| 			if (d != null) file_desc[f.name] = d.val(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	$('#file_home_mainarea_new_file_table').empty(); | ||||
| 	populated_file_obj = []; | ||||
|  | ||||
| 	var f = $('#file_home_mainarea_new_files').get(0); | ||||
| 	var f_no = 0; | ||||
| 	for (var n = 0; n < f.files.length; n++) | ||||
| 	{ | ||||
| 		if (f.files[n] != null)  | ||||
| 		{ | ||||
| 			var desc = file_desc[f.files[n].name]; | ||||
| 			if (desc == null) desc = ''; | ||||
|  | ||||
| 			$('#file_home_mainarea_new_file_table').append ( | ||||
| 				codepot_sprintf ( | ||||
| 					'<tr id="file_home_mainarea_new_file_row_%d"><td><a href="#" id="file_home_mainarea_new_file_cancel_%d" onClick="cancel_out_new_file(%d); return false;"><i class="fa fa-trash"></i></a></td><td>%s</td><td><input type="text" id="file_home_mainarea_new_file_desc_%d" size="40" value="%s" /></td></tr>',  | ||||
| 					f_no, f_no, f_no, codepot_htmlspecialchars(f.files[n].name), f_no, codepot_addslashes(desc) | ||||
| 				) | ||||
| 			); | ||||
|  | ||||
| 			populated_file_obj[f_no] = f.files[n]; | ||||
| 			f_no++; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	populated_file_max = f_no; | ||||
| } | ||||
|  | ||||
| function cancel_out_new_file (no) | ||||
| { | ||||
| 	$('#file_home_mainarea_new_file_row_' + no).remove (); | ||||
| 	populated_file_obj[no] = null; | ||||
| } | ||||
|  | ||||
| $(function () {  | ||||
|  | ||||
| <?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
|  | ||||
| 	new_item_no = 0; | ||||
|  | ||||
| 	$('#file_home_mainarea_new_files').change (function () { | ||||
| 		populate_selected_files (); | ||||
| 	}); | ||||
|  | ||||
| 	$("#file_home_mainarea_new_description_tabs").tabs (); | ||||
| 	$("#file_home_mainarea_new_description_tabs").bind ('tabsshow', function (event, ui) { | ||||
| 		if (ui.index == 2) render_wiki ($("#file_home_mainarea_new_description").val()); | ||||
| 	}); | ||||
|  | ||||
| 	$('#file_home_mainarea_new_form_div').dialog ( | ||||
| 		{ | ||||
| 			title: '<?php print $this->lang->line('New');?>', | ||||
| 			resizable: true, | ||||
| 			autoOpen: false, | ||||
| 			width: 'auto', | ||||
| 			height: 'auto', | ||||
| 			modal: true, | ||||
| 			buttons: { | ||||
|  | ||||
| 				'<?php print $this->lang->line('OK')?>': function () { | ||||
| 					if (import_in_progress) return; | ||||
|  | ||||
| 					if (!!window.FormData) | ||||
| 					{ | ||||
| 						// FormData is supported | ||||
| 						import_in_progress = true; | ||||
|  | ||||
| 						var form_data = new FormData(); | ||||
|  | ||||
| 						var f_no = 0; | ||||
| 						for (var i = 0; i <= populated_file_max; i++) | ||||
| 						{ | ||||
|  | ||||
| 							var f = populated_file_obj[i]; | ||||
| 							if (f != null) | ||||
| 							{ | ||||
| 								form_data.append ('file_new_file_' + f_no, f); | ||||
|  | ||||
| 								var d = $('#file_home_mainarea_new_file_desc_' + i); | ||||
| 								if (d != null) form_data.append('file_new_file_desc_' + f_no, d.val()); | ||||
|  | ||||
| 								f_no++; | ||||
| 							} | ||||
| 						} | ||||
|  | ||||
| 						form_data.append ('file_new_file_count', f_no); | ||||
| 						form_data.append ('file_new_tag', $('#file_home_mainarea_new_tag').val()); | ||||
| 						form_data.append ('file_new_name', $('#file_home_mainarea_new_name').val()); | ||||
| 						form_data.append ('file_new_description', $('#file_home_mainarea_new_description').val()); | ||||
|  | ||||
| 						$('#file_home_mainarea_new_form_div').dialog('disable'); | ||||
| 						$.ajax({ | ||||
| 							url: codepot_merge_path('<?php print site_url() ?>', '<?php print "/file/xhr_import/{$project->id}"; ?>'), | ||||
| 							type: 'POST', | ||||
| 							data: form_data, | ||||
| 							mimeType: 'multipart/form-data', | ||||
| 							contentType: false, | ||||
| 							processData: false, | ||||
| 							cache: false, | ||||
|  | ||||
| 							success: function (data, textStatus, jqXHR) {  | ||||
| 								import_in_progress = false; | ||||
| 								$('#file_home_mainarea_new_form_div').dialog('enable'); | ||||
| 								$('#file_home_mainarea_new_form_div').dialog('close'); | ||||
| 								if (data == 'ok')  | ||||
| 								{ | ||||
| 									// refresh the page to the head revision | ||||
| 									$(location).attr ('href', codepot_merge_path('<?php print site_url(); ?>', '<?php print "/file/home/{$project->id}"; ?>')); | ||||
| 								} | ||||
| 								else | ||||
| 								{ | ||||
| 									show_alert ('<pre>' + codepot_htmlspecialchars(data) + '</pre>', "<?php print $this->lang->line('Error')?>"); | ||||
| 								} | ||||
| 							}, | ||||
|  | ||||
| 							error: function (jqXHR, textStatus, errorThrown) {  | ||||
| 								import_in_progress = false; | ||||
| 								$('#file_home_mainarea_new_form_div').dialog('enable'); | ||||
| 								$('#file_home_mainarea_new_form_div').dialog('close'); | ||||
| 								show_alert ('Failed - ' + errorThrown, "<?php print $this->lang->line('Error')?>"); | ||||
| 							} | ||||
| 						}); | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						show_alert ('<pre>NOT SUPPORTED</pre>', "<?php print $this->lang->line('Error')?>"); | ||||
| 					} | ||||
| 				}, | ||||
| 				'<?php print $this->lang->line('Cancel')?>': function () { | ||||
| 					if (import_in_progress) return; | ||||
| 					$('#file_home_mainarea_new_form_div').dialog('close'); | ||||
| 				} | ||||
| 			}, | ||||
|  | ||||
| 			beforeClose: function() {  | ||||
| 				// if importing is in progress, prevent dialog closing | ||||
| 				return !import_in_progress; | ||||
| 			} | ||||
| 		} | ||||
| 	); | ||||
|  | ||||
| 	$("#file_home_mainarea_new_button").button().click ( | ||||
| 		function () {  | ||||
| 			$('#file_home_mainarea_new_form_div').dialog('open');  | ||||
| 			return false; // prevent the default behavior | ||||
| 		} | ||||
| 	); | ||||
| <?php endif; ?> | ||||
|  | ||||
| }); | ||||
|  | ||||
| </script> | ||||
|  | ||||
|  | ||||
| <title><?php print htmlspecialchars($project->name)?></title> | ||||
| </head> | ||||
|  | ||||
| @ -39,9 +249,7 @@ $this->load->view ( | ||||
| 			'project' => $project, | ||||
| 		), | ||||
|  | ||||
| 		'ctxmenuitems' => array ( | ||||
| 			array ("file/create/{$project->id}", '<i class="fa fa-plus"></i> ' . $this->lang->line('New'))  | ||||
| 		) | ||||
| 		'ctxmenuitems' => array () | ||||
| 	) | ||||
| ); | ||||
| ?> | ||||
| @ -51,6 +259,16 @@ $this->load->view ( | ||||
| <div class="mainarea" id="file_home_mainarea"> | ||||
| <div class="title"><?php print $this->lang->line('Files')?></div> | ||||
|  | ||||
| <div class="infostrip"> | ||||
| 	<?php printf ($this->lang->line('FILE_FMT_TOTAL_X_FILES'), count($files)); ?>  | ||||
|  | ||||
| 	<?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
| 	|  | ||||
| 	<a id="file_home_mainarea_new_button" href='#'><?php print $this->lang->line('New')?></a> | ||||
| 	<?php endif; ?> | ||||
|  | ||||
| </div> | ||||
|  | ||||
| <div class="result" id="file_home_mainarea_result"> | ||||
| <?php | ||||
| if (empty($files)) | ||||
| @ -99,16 +317,13 @@ else | ||||
|  | ||||
| 	usort ($files, 'comp_files'); | ||||
|  | ||||
| 	//$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download'); | ||||
| 	$download_anchor_text = '<i class="fa fa-download"></i>'; | ||||
|  | ||||
| 	print '<table id="file_home_mainarea_result_table" class="fit-width-result-table">'; | ||||
| 	print '<tr class="heading">'; | ||||
| 	print '<th>' . $this->lang->line('Tag') . '</th>'; | ||||
| 	print '<th colspan=2>' . $this->lang->line('Name') . '</th>'; | ||||
| 	print '<th>' . $this->lang->line('Name') . '</th>'; | ||||
| 	print '<th>' . $this->lang->line('File') . '</th>'; | ||||
| 	print '<th>' . $this->lang->line('Summary') . '</th>'; | ||||
| 	print '<th>' . $this->lang->line('MD5') . '</th>'; | ||||
| 	//print '<th>' . $this->lang->line('Download') . '</th>'; | ||||
| 	print '</tr>'; | ||||
| 	 | ||||
| 	$oldtag = ''; | ||||
| @ -118,32 +333,80 @@ else | ||||
| 	{ | ||||
| 		$hexname = $this->converter->AsciiToHex ($file->name); | ||||
| 		$rowclass = $rowclasses[$rownum++ % 2]; | ||||
|  | ||||
| 		$file_list_count = count($file->file_list); | ||||
|  | ||||
| 		for ($i = 0; $i < $file_list_count; $i++) | ||||
| 		{ | ||||
| 			print "<tr class='{$rowclass}'>"; | ||||
|  | ||||
| 			$f = $file->file_list[$i]; | ||||
| 			$xname = $this->converter->AsciiToHex ($f->filename); | ||||
|  | ||||
| 			print '<td>'; | ||||
| 		if ($file->tag != $oldtag) | ||||
| 			if ($i == 0 && $file->tag != $oldtag) | ||||
| 			{ | ||||
| 				print htmlspecialchars($file->tag); | ||||
| 				$oldtag = $file->tag; | ||||
| 			} | ||||
| 			print '</td>'; | ||||
|  | ||||
| 			print '<td>'; | ||||
| 		print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); | ||||
| 			if ($i == 0) print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); | ||||
| 			print '</td>'; | ||||
|  | ||||
| 			print '<td>'; | ||||
| 		print anchor ("file/get/{$project->id}/{$hexname}", $download_anchor_text); | ||||
| 			print anchor ("file/get/{$project->id}/{$xname}", $f->filename); | ||||
| 			print '</td>'; | ||||
|  | ||||
| 			print '<td>'; | ||||
| 		print htmlspecialchars($file->summary); | ||||
| 			print htmlspecialchars($f->description); | ||||
| 			print '</td>'; | ||||
|  | ||||
| 			print '<td><tt>'; | ||||
| 		print $file->md5sum; | ||||
| 			print $f->md5sum; | ||||
| 			print '</tt></td>'; | ||||
|  | ||||
| 			print '</tr>'; | ||||
| 		} | ||||
| 	} | ||||
| 	print '</table>'; | ||||
| } | ||||
| ?> | ||||
|  | ||||
| </div> <!-- file_home_mainarea_result --> | ||||
|  | ||||
| <?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
|  | ||||
| <div id='file_home_mainarea_new_form_div'> | ||||
| 	<div style='line-height: 2em;'><?php print $this->lang->line('Tag'); ?>: <input type='text' id='file_home_mainarea_new_tag' name='file_home_new_tag' /></div> | ||||
| 	<div style='line-height: 2em;'><?php print $this->lang->line('Name'); ?>: <input type='text' id='file_home_mainarea_new_name' name='file_home_new_name' size='50'/></div> | ||||
|  | ||||
| 	<div id='file_home_mainarea_new_description_tabs' style='width:100%;'> | ||||
| 		<ul> | ||||
| 			<li><a href='#file_home_mainarea_new_file_input'><?php print $this->lang->line('Files'); ?></a></li> | ||||
| 			<li><a href='#file_home_mainarea_new_description_input'><?php print $this->lang->line('Description'); ?></a></li> | ||||
| 			<li><a href='#file_home_mainarea_new_description_preview'><?php print $this->lang->line('Preview'); ?></a></li> | ||||
| 		</ul> | ||||
|  | ||||
| 		<div id='file_home_mainarea_new_file_input'> | ||||
| 			<input type='file' id='file_home_mainarea_new_files' name='file_home_new_files' multiple='' autocomplete='off' style='color: transparent;' /> | ||||
| 			<table id='file_home_mainarea_new_file_table'></table> | ||||
| 		</div> | ||||
| 		<div id='file_home_mainarea_new_description_input'> | ||||
| 			<textarea type='textarea' id='file_home_mainarea_new_description' name='file_home_new_description' rows=10 cols=80 style='width:100%;'></textarea> | ||||
| 		</div> | ||||
| 		<div id='file_home_mainarea_new_description_preview' class='form_input_preview'> | ||||
| 		</div> | ||||
|  | ||||
| 	</div> | ||||
|  | ||||
| </div> | ||||
|  | ||||
| <?php endif; ?> | ||||
|  | ||||
| <div id='file_home_mainarea_alert'></div> | ||||
|  | ||||
| </div> <!-- file_home_mainarea --> | ||||
|  | ||||
| <div class='footer-pusher'></div> <!-- for sticky footer --> | ||||
|  | ||||
| @ -89,7 +89,7 @@ $this->load->view ( | ||||
| 		), | ||||
|  | ||||
| 		'ctxmenuitems' => array ( | ||||
| 			array ("file/create/{$project->id}", '<i class="fa fa-plus"></i> ' . $this->lang->line('New')), | ||||
| 			//array ("file/create/{$project->id}", '<i class="fa fa-plus"></i> ' . $this->lang->line('New')), | ||||
| 			array ("file/update/{$project->id}/{$hexname}", '<i class="fa fa-edit"></i> ' . $this->lang->line('Edit')), | ||||
| 			array ("file/delete/{$project->id}/{$hexname}", '<i class="fa fa-trash"></i> ' . $this->lang->line('Delete')) | ||||
| 		) | ||||
| @ -104,11 +104,7 @@ $this->load->view ( | ||||
| <div class="title"><?php print htmlspecialchars($file->name)?></div> | ||||
|  | ||||
| <div class="infostrip" id="wiki_show_mainarea_infostrip"> | ||||
| 	<?php  | ||||
| 		$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download'); | ||||
| 		print  anchor ("file/get/{$project->id}/". $this->converter->AsciiToHex($file->name), $download_anchor_text); | ||||
| 	?> | ||||
| 	| <a id="file_show_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a> | ||||
| 	<a id="file_show_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a> | ||||
| </div> | ||||
|  | ||||
| <div id="file_show_mainarea_result"> | ||||
| @ -131,9 +127,18 @@ $this->load->view ( | ||||
| 	<li><?php print $this->lang->line('Last updated by')?> <?php print  $file->updatedby ?></li> | ||||
| 	</ul> | ||||
|  | ||||
| 	<div class="title"><?php print $this->lang->line('MD5')?></div> | ||||
| 	<div class="title"><?php print $this->lang->line('Files')?></div> | ||||
| 	<ul> | ||||
| 	<li><?php print  $file->md5sum ?></li> | ||||
| 	<?php | ||||
| 	foreach ($file->file_list as $f) | ||||
| 	{ | ||||
| 		$xname = $this->converter->AsciiToHex($f->filename); | ||||
| 		print '<li>';  | ||||
| 		print anchor ("file/get/{$project->id}/{$xname}", $f->filename); | ||||
| 		print " <tt>{$f->md5sum}</tt>"; | ||||
| 		print '</li>'; | ||||
| 	} | ||||
| 	?> | ||||
| 	</ul> | ||||
|  | ||||
| </div> <!-- file_show_mainarea_result_info --> | ||||
|  | ||||
| @ -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 | ||||
| 		} | ||||
| 	); | ||||
| }); | ||||
|  | ||||
| @ -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 { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user