added the codecharset field to the project table.

changed the code_file view and the code_blame view to use it.
code_diff view yet to be changed. project view yet to be changed to be able to modify the field
This commit is contained in:
hyung-hwan 2015-10-28 16:20:11 +00:00
parent 65b0e818cc
commit 7d5e336664
6 changed files with 25 additions and 3 deletions

View File

@ -21,6 +21,7 @@ UPGRADING FROM 0.2.0
mysql> ALTER TABLE file DROP COLUMN summary; mysql> ALTER TABLE file DROP COLUMN summary;
mysql> ALTER TABLE file DROP COLUMN md5sum; mysql> ALTER TABLE file DROP COLUMN md5sum;
mysql> ALTER TABLE file DROP COLUMN encname; mysql> ALTER TABLE file DROP COLUMN encname;
mysql> ALTER TABLE project ADD COLUMN (codecharset VARCHAR(32));
INSTALLATION ON CENTOS INSTALLATION ON CENTOS

View File

@ -22,6 +22,7 @@ CREATE TABLE project (
description TEXT NOT NULL, description TEXT NOT NULL,
commitable CHAR(1) NOT NULL DEFAULT 'Y', commitable CHAR(1) NOT NULL DEFAULT 'Y',
public CHAR(1) NOT NULL DEFAULT 'Y', public CHAR(1) NOT NULL DEFAULT 'Y',
codecharset VARCHAR(32),
createdon DATETIME NOT NULL, createdon DATETIME NOT NULL,
updatedon DATETIME NOT NULL, updatedon DATETIME NOT NULL,

View File

@ -43,6 +43,7 @@ CREATE TABLE "cpot_project" (
"description" CLOB NOT NULL, "description" CLOB NOT NULL,
"commitable" CHAR(1) DEFAULT 'Y' NOT NULL, "commitable" CHAR(1) DEFAULT 'Y' NOT NULL,
"public" CHAR(1) DEFAULT 'Y' NOT NULL, "public" CHAR(1) DEFAULT 'Y' NOT NULL,
"codecharset" VARCHAR(32),
"createdon" TIMESTAMP NOT NULL, "createdon" TIMESTAMP NOT NULL,
"updatedon" TIMESTAMP NOT NULL, "updatedon" TIMESTAMP NOT NULL,
"createdby" VARCHAR(32) NOT NULL, "createdby" VARCHAR(32) NOT NULL,
@ -122,7 +123,7 @@ CREATE TABLE "cpot_issue_change" (
"status" VARCHAR(32) NOT NULL, "status" VARCHAR(32) NOT NULL,
"owner" VARCHAR(255) NOT NULL, "owner" VARCHAR(255) NOT NULL,
"priority" VARCHAR(32) NOT NULL, "priority" VARCHAR(32) NOT NULL,
"comment" CLOB NOT NULL, "comment" CLOB NOT NULL,
"updatedon" TIMESTAMP NOT NULL, "updatedon" TIMESTAMP NOT NULL,
"updatedby" VARCHAR(32) NOT NULL, "updatedby" VARCHAR(32) NOT NULL,
PRIMARY KEY ("projectid", "id", "sno"), PRIMARY KEY ("projectid", "id", "sno"),

View File

@ -38,6 +38,7 @@ CREATE TABLE project (
description TEXT NOT NULL, description TEXT NOT NULL,
commitable CHAR(1) NOT NULL DEFAULT 'Y', commitable CHAR(1) NOT NULL DEFAULT 'Y',
public CHAR(1) NOT NULL DEFAULT 'Y', public CHAR(1) NOT NULL DEFAULT 'Y',
codecharset VARCHAR(32),
createdon TIMESTAMP NOT NULL, createdon TIMESTAMP NOT NULL,
updatedon TIMESTAMP NOT NULL, updatedon TIMESTAMP NOT NULL,

View File

@ -302,7 +302,14 @@ if ($login['settings'] != NULL &&
{ {
$line = &$content[$i]; $line = &$content[$i];
print htmlspecialchars ($line['line']); if (property_exists($project, 'codecharset') && strlen($project->codecharset))
{
print htmlspecialchars (iconv($project->codecharset, 'UTF-8//IGNORE', $line['line']));
}
else
{
print htmlspecialchars ($line['line']);
}
print "\n"; print "\n";
} }

View File

@ -299,7 +299,18 @@ if ($login['settings'] != NULL &&
} }
} }
if (!$is_image_stream) print htmlspecialchars($file['content']); if (!$is_image_stream)
{
if (property_exists($project, 'codecharset') && strlen($project->codecharset))
{
print htmlspecialchars(iconv ($project->codecharset, 'UTF-8//IGNORE', $file['content']));
}
else
{
print htmlspecialchars($file['content']);
}
}
?> ?>
</pre> </pre>