diff --git a/codepot/etc/codepot.mysql b/codepot/etc/codepot.mysql index 4de94d55..0c4fb671 100644 --- a/codepot/etc/codepot.mysql +++ b/codepot/etc/codepot.mysql @@ -44,7 +44,7 @@ CREATE TABLE wiki ( projectid VARCHAR(32) NOT NULL, name VARCHAR(255) NOT NULL, text TEXT NOT NULL, - type CHAR(1) NOT NULL DEFAULT 'C', + doctype CHAR(1) NOT NULL DEFAULT 'C', columns INT NOT NULL DEFAULT 1, createdon DATETIME NOT NULL, diff --git a/codepot/etc/codepot.oracle b/codepot/etc/codepot.oracle index c5da429f..4ff81379 100644 --- a/codepot/etc/codepot.oracle +++ b/codepot/etc/codepot.oracle @@ -62,7 +62,7 @@ CREATE TABLE "cpot_wiki" ( "projectid" VARCHAR(32) NOT NULL, "name" VARCHAR(255) NOT NULL, "text" CLOB NOT NULL, - "type" CHAR(1) DEFAULT 'C' NOT NULL, + "doctype" CHAR(1) DEFAULT 'C' NOT NULL, "columns" INT DEFAULT 1 NOT NULL, "createdon" TIMESTAMP NOT NULL, "updatedon" TIMESTAMP NOT NULL, diff --git a/codepot/etc/codepot.pgsql b/codepot/etc/codepot.pgsql index 3b308bf5..73470943 100644 --- a/codepot/etc/codepot.pgsql +++ b/codepot/etc/codepot.pgsql @@ -60,7 +60,7 @@ CREATE TABLE wiki ( projectid VARCHAR(32) NOT NULL, name VARCHAR(255) NOT NULL, text TEXT NOT NULL, - type CHAR(1) NOT NULL DEFAULT 'C', + doctype CHAR(1) NOT NULL DEFAULT 'C', columns INT NOT NULL DEFAULT 1, createdon TIMESTAMP NOT NULL, diff --git a/codepot/src/codepot/controllers/file.php b/codepot/src/codepot/controllers/file.php index f1e45efc..9fc998b5 100644 --- a/codepot/src/codepot/controllers/file.php +++ b/codepot/src/codepot/controllers/file.php @@ -5,7 +5,6 @@ class File extends Controller var $VIEW_ERROR = 'error'; var $VIEW_HOME = 'file_home'; var $VIEW_SHOW = 'file_show'; - var $VIEW_EDIT = 'file_edit'; function File () { @@ -219,7 +218,7 @@ class File extends Controller codepot_readfile ($path, $name); /* - $this->load->helper('download'); + $this->load->helper('download'); $path = CODEPOT_FILE_DIR . '/' . $file->encname; $data = @file_get_contents ($path); if ($data === FALSE) @@ -237,108 +236,6 @@ class File extends Controller } } -/* -// DEPRECATED - function update ($projectid = '', $name = '') - { - $this->load->helper ('form'); - $this->load->library ('form_validation'); - $this->load->model ('ProjectModel', 'projects'); - $this->load->model ('FileModel', 'files'); - - $login = $this->login->getUser (); - if ($login['id'] == '') - redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); - $data['login'] = $login; - - $name = $this->converter->HexToAscii ($name); - - $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 - { - $this->form_validation->set_rules ( - 'file_name', 'name', 'required|max_length[255]'); - $this->form_validation->set_rules ( - 'file_tag', 'tag', 'required|max_length[50]'); - $this->form_validation->set_rules ( - 'file_description', 'description', 'required'); - $this->form_validation->set_error_delimiters ( - '',''); - - $data['message'] = ''; - $data['project'] = $project; - - if ($this->input->post('file')) - { - $file = new stdClass(); - $file->name = $this->input->post('file_name'); - $file->tag = $this->input->post('file_tag'); - $file->description = $this->input->post('file_description'); - - if ($this->form_validation->run()) - { - if ($this->files->update ($login['id'], $projectid, $name, $file) === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $data['file'] = $file; - $this->load->view ($this->VIEW_EDIT, $data); - } - else - { - redirect ("file/show/{$project->id}/" . $this->converter->AsciiToHex($file->name)); - } - } - else - { - $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); - $data['file'] = $file; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - else - { - $file = $this->files->get ($login['id'], $project, $name); - if ($file === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($file == NULL) - { - $data['message'] = sprintf - ($this->lang->line('FILE_MSG_NO_SUCH_FILE'), $name); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['file'] = $file; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - } - } -*/ - function xhr_import ($projectid = '') { $this->load->model ('ProjectModel', 'projects'); diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index eeaeddc1..783554ad 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -408,6 +408,7 @@ class Wiki extends Controller $wiki->name = $name; $wiki->text = ''; $wiki->columns = '1'; + $wiki->attachments = array(); $data['wiki'] = $wiki; $this->load->view ($view_edit, $data); @@ -907,10 +908,11 @@ class Wiki extends Controller $wiki->projectid = $projectid; $wiki->name = $this->input->post('wiki_name'); $wiki->text = $this->input->post('wiki_text'); - $wiki->type = $this->input->post('wiki_type'); + $wiki->doctype = $this->input->post('wiki_doctype'); $wiki->original_name = $this->input->post('wiki_original_name'); $wiki_file_count = $this->input->post('wiki_file_count'); + $wiki_kill_file_count = $this->input->post('wiki_kill_file_count'); if ($wiki->name === FALSE || ($wiki->name = trim($wiki->name)) == '') { @@ -927,6 +929,7 @@ class Wiki extends Controller else { if ($wiki_file_count === FALSE || $wiki_file_count <= 0) $wiki_file_count = 0; + if ($wiki_kill_file_count === FALSE || $wiki_kill_file_count <= 0) $wiki_kill_file_count = 0; if ($wiki->original_name === FALSE) $wiki->original_name = ''; else $wiki->original_name = trim($wiki->original_name); @@ -952,7 +955,17 @@ class Wiki extends Controller if ($status == '') { - if ($this->wikis->editWithFiles ($login['id'], $wiki, $attached_files, $this->upload) === FALSE) + $kill_files = array(); + for ($i = 0; $i < $wiki_kill_file_count; $i++) + { + $n = $this->input->post("wiki_kill_file_name_{$i}"); + if ($n != '') array_push ($kill_files, $n); + } + } + + if ($status == '') + { + if ($this->wikis->editWithFiles ($login['id'], $wiki, $attached_files, $kill_files, $this->upload) === FALSE) { $status = 'error - ' . $this->wikis->getErrorMessage(); } diff --git a/codepot/src/codepot/models/filemodel.php b/codepot/src/codepot/models/filemodel.php index 7e76945b..028c5e92 100644 --- a/codepot/src/codepot/models/filemodel.php +++ b/codepot/src/codepot/models/filemodel.php @@ -29,6 +29,7 @@ class FileModel extends Model if ($this->db->trans_status() === FALSE) { + $this->errmsg = $this->db->_error_message(); $this->db->trans_rollback(); return FALSE; } @@ -45,6 +46,7 @@ class FileModel extends Model $query = $this->db->get('file_list'); if ($this->db->trans_status() === FALSE) { + $this->errmsg = $this->db->_error_message(); $this->db->trans_rollback(); return FALSE; } @@ -79,6 +81,7 @@ class FileModel extends Model $query = $this->db->get ('file'); if ($this->db->trans_status() === FALSE) { + $this->errmsg = $this->db->_error_message(); $this->db->trans_rollback(); return FALSE; } @@ -94,6 +97,7 @@ class FileModel extends Model $query = $this->db->get('file_list'); if ($this->db->trans_status() === FALSE) { + $this->errmsg = $this->db->_error_message(); $this->db->trans_rollback(); return FALSE; } diff --git a/codepot/src/codepot/models/wikimodel.php b/codepot/src/codepot/models/wikimodel.php index 83f775f0..85ca9f00 100644 --- a/codepot/src/codepot/models/wikimodel.php +++ b/codepot/src/codepot/models/wikimodel.php @@ -297,6 +297,20 @@ class WikiModel extends Model // TODO: check if userid can do this.. $this->db->trans_begin (); + + $this->db->where ('projectid', $wiki->projectid);; + $this->db->where ('wikiname', $wiki->name); + $this->db->select ('encname'); + $query = $this->db->get ('wiki_attachment'); + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + $file_result = $query->result (); + $this->db->where ('projectid', $wiki->projectid); $this->db->where ('wikiname', $wiki->name); $this->db->delete ('wiki_attachment'); @@ -331,6 +345,11 @@ class WikiModel extends Model return FALSE; } + foreach ($file_result as $r) + { + @unlink (CODEPOT_ATTACHMENT_DIR . '/' . $r->encname); + } + $this->db->trans_commit (); return TRUE; } @@ -344,8 +363,12 @@ class WikiModel extends Model return $x; } /////////////////////////////////////////////////////////////////// + private function delete_all_files ($files) + { + foreach ($files as $f) @unlink ($f); + } - private function _edit_wiki ($userid, $wiki, $attached_files, $uploader) + private function _edit_wiki ($userid, $wiki, $attached_files, $kill_files, $uploader) { $this->db->trans_begin (); // manual transaction. not using trans_start(). @@ -357,7 +380,7 @@ class WikiModel extends Model $this->db->set ('projectid', $wiki->projectid);; $this->db->set ('name', $wiki->name); $this->db->set ('text', $wiki->text); - $this->db->set ('type', $wiki->type); + $this->db->set ('doctype', $wiki->doctype); $this->db->set ('createdon', $now); $this->db->set ('updatedon', $now); $this->db->set ('createdby', $userid); @@ -370,7 +393,7 @@ class WikiModel extends Model $this->db->where ('name', $wiki->original_name); $this->db->set ('name', $wiki->name); $this->db->set ('text', $wiki->text); - $this->db->set ('type', $wiki->type); + $this->db->set ('doctype', $wiki->doctype); $this->db->set ('updatedon', $now); $this->db->set ('updatedby', $userid); $this->db->update ('wiki'); @@ -447,15 +470,51 @@ class WikiModel extends Model return FALSE; } + if (!empty($kill_files)) + { + $this->db->where ('projectid', $wiki->projectid);; + $this->db->where ('wikiname', $wiki->name); + $this->db->where_in ('name', $kill_files); + $this->db->select ('encname'); + + $query = $this->db->get ('wiki_attachment'); + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + + $result = $query->result (); + + $this->db->where ('projectid', $wiki->projectid);; + $this->db->where ('wikiname', $wiki->name); + $this->db->where_in ('name', $kill_files); + $this->db->delete ('wiki_attachment'); + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); + $this->db->trans_rollback (); + $this->delete_all_files ($ok_files); + return FALSE; + } + + foreach ($result as $r) + { + @unlink (CODEPOT_ATTACHMENT_DIR . '/' . $r->encname); + } + } + $this->db->trans_commit (); - return $newid; + return TRUE; } - function editWithFiles ($userid, $wiki, $attached_files, $uploader) + function editWithFiles ($userid, $wiki, $attached_files, $kill_files, $uploader) { set_error_handler (array ($this, 'capture_error')); $errmsg = ''; - $x = $this->_edit_wiki ($userid, $wiki, $attached_files, $uploader); + $x = $this->_edit_wiki ($userid, $wiki, $attached_files, $kill_files, $uploader); restore_error_handler (); return $x; } diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index 108e398f..aec2ac1c 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -9,7 +9,6 @@ www_DATA = \ code_history.php \ code_revision.php \ code_search.php \ - file_edit.php \ file_home.php \ file_show.php \ footer.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index 9f2c1f46..4ad3c45d 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -154,7 +154,6 @@ www_DATA = \ code_history.php \ code_revision.php \ code_search.php \ - file_edit.php \ file_home.php \ file_show.php \ footer.php \ diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index 36fb3c69..3ab2adfd 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -281,33 +281,33 @@ $this->load->view (
-code_hide_line_num == 'Y') $prettyprint_linenums = ''; -?> + $prettyprint_linenums = 'linenums'; + if ($login['settings'] != NULL && + $login['settings']->code_hide_line_num == 'Y') $prettyprint_linenums = ''; + ?> -
-  block requires \n after every line.
-// while the  block to contain revision numbers and authors
-// doesn't require \n. It is because the css file sets the line-number span
-// to display: block.
-//
-// If you have new lines between  and , there will
-// be some positioning problems as thouse new lines are rendered at the top
-// of the actual code.
-//
+	
+	  block requires \n after every line.
+	// while the  block to contain revision numbers and authors
+	// doesn't require \n. It is because the css file sets the line-number span
+	// to display: block.
+	//
+	// If you have new lines between  and , there will
+	// be some positioning problems as thouse new lines are rendered at the top
+	// of the actual code.
+	//
 	$content = &$file['content'];
 	$len = count($content);
 
@@ -400,17 +400,17 @@ if ($login['settings'] != NULL &&
 	}
 
 	print '';
-?>
-
+ ?> +
-
-
LOC
- +
LOC
+ id}/{$hex_headpath}{$revreq}"); print ""; - ?> -
+ ?> +
diff --git a/codepot/src/codepot/views/code_diff.php b/codepot/src/codepot/views/code_diff.php index dec9e105..8da9cb3c 100644 --- a/codepot/src/codepot/views/code_diff.php +++ b/codepot/src/codepot/views/code_diff.php @@ -215,7 +215,6 @@ $this->load->view (
-
load->view ( if ($fileext == "") $fileext = "html" ?> -
+
load->view (
-
+
- + -
0) - { - foreach ($file['properties'] as $pn => $pv) +
0) { - if ($pn == 'svn:mime-type' && $pv == 'application/octet-stream') + foreach ($file['properties'] as $pn => $pv) { - $is_octet_stream = TRUE; - break; + if ($pn == 'svn:mime-type' && $pv == 'application/octet-stream') + { + $is_octet_stream = TRUE; + break; + } } } - } - $is_image_stream = FALSE; - if ($is_octet_stream || - in_array (strtolower($fileext), array ('png', 'jpg', 'gif', 'tif', 'bmp', 'ico'))) - { - $img = @imagecreatefromstring ($file['content']); - if ($img !== FALSE) + $is_image_stream = FALSE; + if ($is_octet_stream || + in_array (strtolower($fileext), array ('png', 'jpg', 'gif', 'tif', 'bmp', 'ico'))) { - @imagedestroy ($img); - print ('[image]'); - $is_image_stream = TRUE; + $img = @imagecreatefromstring ($file['content']); + if ($img !== FALSE) + { + @imagedestroy ($img); + print ('[image]'); + $is_image_stream = TRUE; + } } - } - if (!$is_image_stream)*/ print htmlspecialchars($file['content']); -?>
+ if (!$is_image_stream)*/ print htmlspecialchars($file['content']); + ?>
diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php index 7ced06d2..7e15e351 100644 --- a/codepot/src/codepot/views/code_folder.php +++ b/codepot/src/codepot/views/code_folder.php @@ -985,7 +985,7 @@ $this->load->view ( ?>
-
+
load->view (
-
+
converter->AsciiToHex (($fullpath == '')? '.': $fullpath); @@ -102,108 +102,107 @@ $this->load->view ( $graph_url = codepot_merge_path (site_url(), "/code/graph/commit-share-by-users/{$project->id}/{$xfullpath}{$revreq}"); print ""; ?> -
- -
+
- - - - - - - '; ?> - - 0; ) - { - $h = $history[--$i]; - - $rowclass = $rowclasses[($history_count - $i) % 2]; - print ""; - - print '
lang->line('Revision')?>lang->line('Committer')?>lang->line('Date')?>lang->line('Message')?>
'; - $xfullpath = $this->converter->AsciiToHex ( - ($fullpath == '')? '.': $fullpath); - - print anchor ("code/file/{$project->id}/{$xfullpath}/{$h['rev']}", $h['rev']); - - if (!empty($h['tag'])) +
+ + + + + + + '; ?> + + 0; ) { - print ' '; - print ''; - print htmlspecialchars($h['tag']); - print ''; - } - print ''; + $h = $history[--$i]; - print ''; + $rowclass = $rowclasses[($history_count - $i) % 2]; + print ""; - print ''; + print ''; + print anchor ("code/file/{$project->id}/{$xfullpath}/{$h['rev']}", $h['rev']); - print ''; - - print ''; - - // - // let's track the copy path. - // - $paths = $h['paths']; - $colspan = 6; - foreach ($paths as $p) - { - if (array_key_exists ('copyfrom', $p) && - $p['action'] == 'A') + if (!empty($h['tag'])) { - $d = $curfullpath; - $f = ''; + print ' '; + print ''; + print htmlspecialchars($h['tag']); + print ''; + } + print ''; - while ($d != '/' && $d != '') + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + // + // let's track the copy path. + // + $paths = $h['paths']; + $colspan = 6; + foreach ($paths as $p) + { + if (array_key_exists ('copyfrom', $p) && + $p['action'] == 'A') { - if ($d == $p['path']) - { - $curfullpath = $p['copyfrom'] . $f; - print ""; - break; - } + $d = $curfullpath; + $f = ''; - $d = dirname ($d); - $f = substr ($curfullpath, strlen($d)); + while ($d != '/' && $d != '') + { + if ($d == $p['path']) + { + $curfullpath = $p['copyfrom'] . $f; + print ""; + break; + } + + $d = dirname ($d); + $f = substr ($curfullpath, strlen($d)); + } } } - } - } -?> -
lang->line('Revision')?>lang->line('Committer')?>lang->line('Date')?>lang->line('Message')?>
'; - // Repository migration from googlecode revealed that it did not put - // 'author' for initial project creation. So I've added the following check. - if (array_key_exists('author', $h)) print htmlspecialchars($h['author']); - print '
'; - print strftime('%Y-%m-%d', strtotime($h['date'])); - print ''; + $xfullpath = $this->converter->AsciiToHex ( + ($fullpath == '')? '.': $fullpath); - print ''; - print anchor ("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}", htmlspecialchars($h['msg']), "class='commit-message'"); - //print '
';
-		//print htmlspecialchars($h['msg']);
-		//print '
'; - print '
'; - if ($file['type'] == 'file') - { - print anchor ("code/blame/{$project->id}/{$xfullpath}/{$h['rev']}", - ' ' . $this->lang->line('Blame')); - print ' | '; - print anchor ("code/diff/{$project->id}/{$xfullpath}/{$h['rev']}", - ' ' . $this->lang->line('Difference')); - } - print '
'; + // Repository migration from googlecode revealed that it did not put + // 'author' for initial project creation. So I've added the following check. + if (array_key_exists('author', $h)) print htmlspecialchars($h['author']); + print ''; + print strftime('%Y-%m-%d', strtotime($h['date'])); + print ''; + print anchor ("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}", htmlspecialchars($h['msg']), "class='commit-message'"); + //print '
';
+			//print htmlspecialchars($h['msg']);
+			//print '
'; + print '
'; + if ($file['type'] == 'file') + { + print anchor ("code/blame/{$project->id}/{$xfullpath}/{$h['rev']}", + ' ' . $this->lang->line('Blame')); + print ' | '; + print anchor ("code/diff/{$project->id}/{$xfullpath}/{$h['rev']}", + ' ' . $this->lang->line('Difference')); + } + print '
{$curfullpath}
{$curfullpath}
-
+ } + ?> +
+
diff --git a/codepot/src/codepot/views/code_revision.php b/codepot/src/codepot/views/code_revision.php index 2e9b4f20..3e9d5391 100644 --- a/codepot/src/codepot/views/code_revision.php +++ b/codepot/src/codepot/views/code_revision.php @@ -639,9 +639,6 @@ $history = $file['history'];
- - -
-
+
+
+
lang->line('Files')?>
+
+ + '; + print ''; + print ''; + print ''; + */ + $diff_anchor_text = ' ' . $this->lang->line('Difference'); + $fulldiff_anchor_text = ' ' . $this->lang->line('Full Difference'); -
-
lang->line('Files')?>
-
-
' . $this->lang->line('Path') . '
-'; - print ''; - print ''; - print ''; - */ - $diff_anchor_text = ' ' . $this->lang->line('Difference'); - $fulldiff_anchor_text = ' ' . $this->lang->line('Full Difference'); + $rowclasses = array ('odd', 'even'); + $rowcount = 0; + foreach ($history['paths'] as &$p) + { + $rowclass = $rowclasses[++$rowcount % 2]; + print ""; - $rowclasses = array ('odd', 'even'); - $rowcount = 0; - foreach ($history['paths'] as &$p) - { - $rowclass = $rowclasses[++$rowcount % 2]; - print ""; + $xpar = $this->converter->AsciiToHex ($p['path']); - $xpar = $this->converter->AsciiToHex ($p['path']); + print "'; - print "'; + print ''; - print ''; + print ''; - print ''; - - print ''; - } -?> -
' . $this->lang->line('Path') . '
"; + print anchor ("code/file/{$project->id}/{$xpar}/{$history['rev']}", htmlspecialchars($p['path'])); + print '"; - print anchor ("code/file/{$project->id}/{$xpar}/{$history['rev']}", htmlspecialchars($p['path'])); - print ''; + //print anchor ("code/blame/{$project->id}/{$xpar}/{$history['rev']}", $this->lang->line('Blame')); + //print ' '; + print anchor ("code/diff/{$project->id}/{$xpar}/{$history['rev']}", $diff_anchor_text); + print ''; - //print anchor ("code/blame/{$project->id}/{$xpar}/{$history['rev']}", $this->lang->line('Blame')); - //print ' '; - print anchor ("code/diff/{$project->id}/{$xpar}/{$history['rev']}", $diff_anchor_text); - print ''; + print anchor ("code/fulldiff/{$project->id}/{$xpar}/{$history['rev']}", $fulldiff_anchor_text); + print ''; - print anchor ("code/fulldiff/{$project->id}/{$xpar}/{$history['rev']}", $fulldiff_anchor_text); - print '
-
-
+ print ''; + } + ?> + +
+
-
lang->line('CODE_PROPERTIES');?>
-
- - 0 || count($deleted_props) > 0) +
lang->line('CODE_PROPERTIES');?>
+
+
+ $v) + if (array_key_exists('props', $p) && array_key_exists('prev_props', $p)) { - print ""; - if ($first) + $common_props = array_intersect_assoc ($p['props'], $p['prev_props']); + $added_props = array_diff_assoc ($p['props'], $common_props); + $deleted_props = array_diff_assoc ($p['prev_props'], $common_props); + + if (count($added_props) > 0 || count($deleted_props) > 0) { - print ""; + if ($first) + { + print "'; + + print ''; + print ''; + } + + foreach ($deleted_props as $k => $v) + { + print ""; + if ($first) + { + print "'; + + print ''; + print ''; + } + } - else print "'; - - print ''; - print ''; } - - foreach ($deleted_props as $k => $v) - { - print ""; - if ($first) - { - print "'; - - print ''; - print ''; - } - } - } - } -?> -
"; - $xpar = $this->converter->AsciiToHex ($p['path']); - print anchor ("code/file/{$project->id}/{$xpar}/{$history['rev']}", htmlspecialchars($p['path'])); - $first = FALSE; + $rowclass = $rowclasses[++$rowcount % 2]; + $first = TRUE; + + foreach ($added_props as $k => $v) + { + print "
"; + $xpar = $this->converter->AsciiToHex ($p['path']); + print anchor ("code/file/{$project->id}/{$xpar}/{$history['rev']}", htmlspecialchars($p['path'])); + $first = FALSE; + } + else print ""; + print ''; + printf ('%s - %s', htmlspecialchars($k), htmlspecialchars($v)); + print '
"; + $xpar = $this->converter->AsciiToHex ($p['path']); + print anchor ("code/file/{$project->id}/{$xpar}/{$history['rev']}", htmlspecialchars($p['path'])); + $first = FALSE; + } + else print ""; + print ''; + printf ('%s - %s', htmlspecialchars($k), htmlspecialchars($v)); + print '
"; - print ''; - printf ('%s - %s', htmlspecialchars($k), htmlspecialchars($v)); - print '
"; - $xpar = $this->converter->AsciiToHex ($p['path']); - print anchor ("code/file/{$project->id}/{$xpar}/{$history['rev']}", htmlspecialchars($p['path'])); - $first = FALSE; - } - else print ""; - print ''; - printf ('%s - %s', htmlspecialchars($k), htmlspecialchars($v)); - print '
-
+ ?> + +
-
lang->line('Comment')?>  - - - lang->line('New'), - array ('id' => 'code_revision_new_review_comment_button')); - ?> - - -
+
lang->line('Comment')?>  + + + lang->line('New'), + array ('id' => 'code_revision_new_review_comment_button')); + ?> + + +
-
-\n"; - printf (" %d", $rc->sno); - printf (" %s", $rc->updatedby); - printf (" %s", codepot_dbdatetodispdate($rc->updatedon)); - - if ($login['id'] == $rc->updatedby) +
+ lang->line('Edit'), - array ('id' => 'code_revision_edit_review_comment_button_' . $i) - ); + $rc = $reviews[$i]; + $i++; + print "
\n"; + printf (" %d", $rc->sno); + printf (" %s", $rc->updatedby); + printf (" %s", codepot_dbdatetodispdate($rc->updatedon)); + + if ($login['id'] == $rc->updatedby) + { + print ' '; + print anchor ( + "#", $this->lang->line('Edit'), + array ('id' => 'code_revision_edit_review_comment_button_' . $i) + ); + } + + print ("
\n"); + + print "
\n"; + print "\n"; + print "
\n"; } - - print ("
\n"); - - print "
\n"; - print "\n"; - print "
\n"; - } -?> -
+ ?> +
diff --git a/codepot/src/codepot/views/file_edit.php b/codepot/src/codepot/views/file_edit.php deleted file mode 100644 index 4ec29e42..00000000 --- a/codepot/src/codepot/views/file_edit.php +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -<?php print htmlspecialchars($file->name)?> - - - - -
- - - -load->view ('taskbar'); ?> - - - -load->view ( - 'projectbar', - array ( - 'banner' => NULL, - - 'page' => array ( - 'type' => 'project', - 'id' => 'file', - 'project' => $project, - ), - - 'ctxmenuitems' => array () - ) -); -?> - - - -
- -'.htmlspecialchars($message).'
'; ?> - -
-id}/" . $this->converter->AsciiToHex($file->name))?> - -
- lang->line('Name').': ', 'file_name'); - print form_input('file_name', set_value('file_name', $file->name), 'maxlength="255" size="40"'); - ?> - -
- -
- lang->line('Tag').': ', 'file_tag')?> - - tag), $extra)?> - -
- -
- lang->line('Description').': ', 'file_description')?> - lang->line('Preview')?> - -
-
- description), 'id=file_edit_mainarea_description')?> -
-
- - lang->line('Update')); ?> - - -
- -
- - - -
- - - -load->view ('footer'); ?> - - - - - - - diff --git a/codepot/src/codepot/views/file_home.php b/codepot/src/codepot/views/file_home.php index e5f85ac5..d729bfe8 100644 --- a/codepot/src/codepot/views/file_home.php +++ b/codepot/src/codepot/views/file_home.php @@ -27,7 +27,7 @@ function show_alert (outputMsg, titleMsg) { - $('#file_home_mainarea_alert').html(outputMsg).dialog({ + $('#file_home_alert').html(outputMsg).dialog({ title: titleMsg, resizable: true, modal: true, @@ -45,7 +45,7 @@ function render_wiki(input_text) { creole_render_wiki_with_input_text ( input_text, - "file_home_mainarea_new_description_preview", + "file_home_new_description_preview", "/wiki/show/id?>/", "/wiki/attachment0/id?>/" ); @@ -65,15 +65,15 @@ function populate_selected_files () var f = populated_file_obj[n]; if (f != null) { - var d = $('#file_home_mainarea_new_file_desc_' + n); + var d = $('#file_home_new_file_desc_' + n); if (d != null) file_desc[f.name] = d.val(); } } - $('#file_home_mainarea_new_file_table').empty(); + $('#file_home_new_file_table').empty(); populated_file_obj = []; - var f = $('#file_home_mainarea_new_files').get(0); + var f = $('#file_home_new_files').get(0); var f_no = 0; for (var n = 0; n < f.files.length; n++) { @@ -82,9 +82,9 @@ function populate_selected_files () var desc = file_desc[f.files[n].name]; if (desc == null) desc = ''; - $('#file_home_mainarea_new_file_table').append ( + $('#file_home_new_file_table').append ( codepot_sprintf ( - '%s', + '%s', f_no, f_no, f_no, codepot_htmlspecialchars(f.files[n].name), f_no, codepot_addslashes(desc) ) ); @@ -99,7 +99,7 @@ function populate_selected_files () function cancel_out_new_file (no) { - $('#file_home_mainarea_new_file_row_' + no).remove (); + $('#file_home_new_file_row_' + no).remove (); populated_file_obj[no] = null; } @@ -107,16 +107,16 @@ $(function () { - $('#file_home_mainarea_new_files').change (function () { + $('#file_home_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_new_description_tabs").tabs (); + $("#file_home_new_description_tabs").bind ('tabsshow', function (event, ui) { + if (ui.index == 2) render_wiki ($("#file_home_new_description").val()); }); - $('#file_home_mainarea_new_form_div').dialog ( + $('#file_home_new_form_div').dialog ( { title: 'lang->line('New');?>', resizable: true, @@ -145,7 +145,7 @@ $(function () { { form_data.append ('file_new_file_' + f_no, f); - var d = $('#file_home_mainarea_new_file_desc_' + i); + var d = $('#file_home_new_file_desc_' + i); if (d != null) form_data.append('file_new_file_desc_' + f_no, d.val()); f_no++; @@ -153,11 +153,11 @@ $(function () { } 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()); + form_data.append ('file_new_tag', $('#file_home_new_tag').val()); + form_data.append ('file_new_name', $('#file_home_new_name').val()); + form_data.append ('file_new_description', $('#file_home_new_description').val()); - $('#file_home_mainarea_new_form_div').dialog('disable'); + $('#file_home_new_form_div').dialog('disable'); $.ajax({ url: codepot_merge_path('', 'id}"; ?>'), type: 'POST', @@ -169,8 +169,8 @@ $(function () { 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'); + $('#file_home_new_form_div').dialog('enable'); + $('#file_home_new_form_div').dialog('close'); if (data == 'ok') { // refresh the page to the head revision @@ -184,8 +184,8 @@ $(function () { 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'); + $('#file_home_new_form_div').dialog('enable'); + $('#file_home_new_form_div').dialog('close'); var errmsg = ''; if (errmsg == '' && errorThrown != null) errmsg = errorThrown; if (errmsg == '' && textStatus != null) errmsg = textStatus; @@ -201,7 +201,7 @@ $(function () { }, 'lang->line('Cancel')?>': function () { if (import_in_progress) return; - $('#file_home_mainarea_new_form_div').dialog('close'); + $('#file_home_new_form_div').dialog('close'); } }, @@ -212,9 +212,9 @@ $(function () { } ); - $("#file_home_mainarea_new_button").button().click ( + $("#file_home_new_button").button().click ( function () { - $('#file_home_mainarea_new_form_div').dialog('open'); + $('#file_home_new_form_div').dialog('open'); return false; // prevent the default behavior } ); @@ -270,113 +270,86 @@ $this->load->view ( ?> - lang->line('New')?> + lang->line('New')?>
-
-lang->line('FILE_MSG_NO_FILES_AVAILABLE')); -} -else -{ - function comp_tag ($a, $b) +
+ $cy)? -1: - ($cx < $cy)? 1: 0; + print htmlspecialchars($this->lang->line('FILE_MSG_NO_FILES_AVAILABLE')); } - - function comp_files ($a, $b) + else { - //$cmp = version_compare ($b->tag, $a->tag); - $cmp = comp_tag ($b->tag, $a->tag); - if ($cmp == 0) + function comp_tag ($a, $b) { - $cmp = strcmp ($a->name, $b->name); - } - return $cmp; - } + //$x = explode ('.', $a); + //$y = explode ('.', $b); + $x = explode ('.', str_replace('-', '.', $a)); + $y = explode ('.', str_replace('-', '.', $b)); + $cx = count($x); + $cy = count($y); + $min = min($cx, $cy); - usort ($files, 'comp_files'); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $oldtag = ''; - $rownum = 0; - $rowclasses = array ('odd', 'even'); - foreach ($files as $file) - { - $hexname = $this->converter->AsciiToHex ($file->name); - $rowclass = $rowclasses[$rownum++ % 2]; - - $file_list_count = count($file->file_list); - - if ($file_list_count <= 0) - { - print ""; - - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; + return ($cx > $cy)? -1: + ($cx < $cy)? 1: 0; } - else + + function comp_files ($a, $b) { - for ($i = 0; $i < $file_list_count; $i++) + //$cmp = version_compare ($b->tag, $a->tag); + $cmp = comp_tag ($b->tag, $a->tag); + if ($cmp == 0) + { + $cmp = strcmp ($a->name, $b->name); + } + return $cmp; + } + + usort ($files, 'comp_files'); + + print '
' . $this->lang->line('Tag') . '' . $this->lang->line('Name') . '' . $this->lang->line('File') . '' . $this->lang->line('Summary') . '' . $this->lang->line('MD5') . '
'; - if ($file->tag != $oldtag) + for ($i = 0; $i < $min; $i++) { - print htmlspecialchars($file->tag); - $oldtag = $file->tag; + if (is_numeric($x[$i]) && is_numeric($y[$i])) + { + $q = (int)$x[$i] - (int)$y[$i]; + } + else + { + $q = strcmp($x[$i], $y[$i]); + } + if ($q != 0) return $q; } - print ''; - print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); - print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $oldtag = ''; + $rownum = 0; + $rowclasses = array ('odd', 'even'); + foreach ($files as $file) + { + $hexname = $this->converter->AsciiToHex ($file->name); + $rowclass = $rowclasses[$rownum++ % 2]; + + $file_list_count = count($file->file_list); + + if ($file_list_count <= 0) { print ""; - $f = $file->file_list[$i]; - $xname = $this->converter->AsciiToHex ($f->filename); - print ''; print ''; - print ''; - - print ''; - - print ''; + print ''; + print ''; + print ''; print ''; } - } - } - print '
' . $this->lang->line('Tag') . '' . $this->lang->line('Name') . '' . $this->lang->line('File') . '' . $this->lang->line('Summary') . '' . $this->lang->line('MD5') . '
'; - if ($i == 0 && $file->tag != $oldtag) + if ($file->tag != $oldtag) { print htmlspecialchars($file->tag); $oldtag = $file->tag; @@ -384,59 +357,84 @@ else print ''; - if ($i == 0) print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); + print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); print ''; - print anchor ("file/get/{$project->id}/{$xname}", htmlspecialchars($f->filename)); - print ''; - print htmlspecialchars($f->description); - print ''; - print $f->md5sum; - print '
'; -} -?> + else + { + for ($i = 0; $i < $file_list_count; $i++) + { + print ""; -
+ $f = $file->file_list[$i]; + $xname = $this->converter->AsciiToHex ($f->filename); + + print ''; + if ($i == 0 && $file->tag != $oldtag) + { + print htmlspecialchars($file->tag); + $oldtag = $file->tag; + } + print ''; + + print ''; + if ($i == 0) print anchor ("file/show/{$project->id}/{$hexname}", htmlspecialchars($file->name)); + print ''; + + print ''; + print anchor ("file/get/{$project->id}/{$xname}", htmlspecialchars($f->filename)); + print ''; + + print ''; + print htmlspecialchars($f->description); + print ''; + + print ''; + print $f->md5sum; + print ''; + + print ''; + } + } + } + print ''; + } + ?> +
+
+
lang->line('Tag'); ?>:
+
lang->line('Name'); ?>:
-
-
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 3e1e9205..3deab6e1 100644 --- a/codepot/src/codepot/views/file_show.php +++ b/codepot/src/codepot/views/file_show.php @@ -34,7 +34,7 @@ $creole_file_base = site_url() . "/wiki/attachment0/{$project->id}/";