# added codepot_htmlspecialchars by copying htmlspecialchars from phpjs.org.

# renamed some instances of the words 'details' to 'metadata'
# renamed the database column 'code_hide_details' to 'code_hide_metadata'.
# almost finished the new project_catalog page.
This commit is contained in:
hyung-hwan 2015-04-17 04:02:42 +00:00
parent 434a1f8f3f
commit 39139aa5c2
29 changed files with 297 additions and 148 deletions

View File

@ -7,6 +7,15 @@ CODEPOT
multiple subversion repositories independent of each other. Going beyond it, multiple subversion repositories independent of each other. Going beyond it,
you can track issues, write documents, and upload release files. you can track issues, write documents, and upload release files.
UPGRADING FROM 0.2.0
The code_hide_details column in the user_settings table has been renamed
to code_hide_metadata. You must rename your existing database manually.
mysql> ALTER TABLE user_settings CHANGE code_hide_details code_hide_metadata char(1) NOT NULL;
oracle> ALTER TABLE user_settings RENAME COLUMN code_hide_details TO code_hide_metadata;
INSTALLATION ON CENTOS INSTALLATION ON CENTOS
A RPM package is provided for RedHat/CentOS Linux. The RPM package specifies A RPM package is provided for RedHat/CentOS Linux. The RPM package specifies

View File

@ -192,7 +192,7 @@ CREATE TABLE log (
CREATE TABLE user_settings ( CREATE TABLE user_settings (
userid VARCHAR(32) PRIMARY KEY, userid VARCHAR(32) PRIMARY KEY,
code_hide_line_num CHAR(1) NOT NULL, code_hide_line_num CHAR(1) NOT NULL,
code_hide_details CHAR(1) NOT NULL, code_hide_metadata CHAR(1) NOT NULL,
icon_name VARCHAR(255) UNIQUE NULL icon_name VARCHAR(255) UNIQUE NULL
) charset=utf8 engine=InnoDB; ) charset=utf8 engine=InnoDB;

View File

@ -37,6 +37,7 @@ class Project extends Controller
$search->id = ''; $search->id = '';
$search->name = ''; $search->name = '';
$search->summary = ''; $search->summary = '';
$search->or = '';
} }
else else
{ {
@ -44,6 +45,7 @@ class Project extends Controller
if (!array_key_exists ('id', $search)) $search['id'] = ''; if (!array_key_exists ('id', $search)) $search['id'] = '';
if (!array_key_exists ('name', $search)) $search['name'] = ''; if (!array_key_exists ('name', $search)) $search['name'] = '';
if (!array_key_exists ('summary', $search)) $search['summary'] = ''; if (!array_key_exists ('summary', $search)) $search['summary'] = '';
if (!array_key_exists ('or', $search)) $search['or'] = '';
$search = (object) $search; $search = (object) $search;
} }
@ -486,6 +488,7 @@ class Project extends Controller
$search->id = ''; $search->id = '';
$search->name = ''; $search->name = '';
$search->summary = ''; $search->summary = '';
$search->or = '';
} }
else else
{ {
@ -493,6 +496,7 @@ class Project extends Controller
if (!array_key_exists ('id', $search)) $search['id'] = ''; if (!array_key_exists ('id', $search)) $search['id'] = '';
if (!array_key_exists ('name', $search)) $search['name'] = ''; if (!array_key_exists ('name', $search)) $search['name'] = '';
if (!array_key_exists ('summary', $search)) $search['summary'] = ''; if (!array_key_exists ('summary', $search)) $search['summary'] = '';
if (!array_key_exists ('or', $search)) $search['or'] = '';
$search = (object) $search; $search = (object) $search;
} }
@ -581,7 +585,8 @@ class Project extends Controller
foreach ($projects as &$p) foreach ($projects as &$p)
{ {
if ($p->id != $p->value) $p->value = $p->id . ' - ' . $p->value; $p->label = ($p->id != $p->value)? ($p->id . ' - ' . $p->value): $p->value;
//$p->value = $p->id;
} }
print codepot_json_encode ($projects); print codepot_json_encode ($projects);

View File

@ -200,7 +200,7 @@ class User extends Controller
} }
$settings->code_hide_line_num = $this->input->post('code_hide_line_num'); $settings->code_hide_line_num = $this->input->post('code_hide_line_num');
$settings->code_hide_details = $this->input->post('code_hide_details'); $settings->code_hide_metadata = $this->input->post('code_hide_metadata');
$settings->icon_name = $icon_fname; $settings->icon_name = $icon_fname;
$settings->uploaded_icon_name = $uploaded_fname; $settings->uploaded_icon_name = $uploaded_fname;
@ -227,7 +227,7 @@ class User extends Controller
{ {
if ($settings === FALSE) $data['message'] = 'DATABASE ERROR'; if ($settings === FALSE) $data['message'] = 'DATABASE ERROR';
$settings->code_hide_line_num = ' '; $settings->code_hide_line_num = ' ';
$settings->code_hide_details = ' '; $settings->code_hide_metadata = ' ';
$settings->icon_name = ''; $settings->icon_name = '';
} }

View File

@ -1,6 +1,7 @@
<?php <?php
$lang['Administration'] = 'Administration'; $lang['Administration'] = 'Administration';
$lang['All'] = 'All'; $lang['All'] = 'All';
$lang['Apply'] = 'Apply';
$lang['Attachment'] = 'Attachment'; $lang['Attachment'] = 'Attachment';
$lang['Attachments'] = 'Attachments'; $lang['Attachments'] = 'Attachments';
$lang['Blame'] = 'Blame'; $lang['Blame'] = 'Blame';
@ -31,13 +32,14 @@ $lang['Enstyle'] = 'Enstyle';
$lang['Error'] = 'Error'; $lang['Error'] = 'Error';
$lang['File'] = 'File'; $lang['File'] = 'File';
$lang['Files'] = 'Files'; $lang['Files'] = 'Files';
$lang['Filter'] = 'Filter';
$lang['First'] = 'First'; $lang['First'] = 'First';
$lang['Folder'] = 'Folder'; $lang['Folder'] = 'Folder';
$lang['Full Difference'] = 'FullDiff'; $lang['Full Difference'] = 'FullDiff';
$lang['Graph'] = 'Graph'; $lang['Graph'] = 'Graph';
$lang['Graphs'] = 'Graphs'; $lang['Graphs'] = 'Graphs';
$lang['Head revision'] = 'Head revision'; $lang['Head revision'] = 'Head revision';
$lang['Hide details'] = 'Hide details'; $lang['Hide metadata'] = 'Hide metadata';
$lang['History'] = 'History'; $lang['History'] = 'History';
$lang['Home'] = 'Home'; $lang['Home'] = 'Home';
$lang['Icon'] = 'Icon'; $lang['Icon'] = 'Icon';
@ -54,6 +56,7 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = 'Member'; $lang['Member'] = 'Member';
$lang['Members'] = 'Members'; $lang['Members'] = 'Members';
$lang['Message'] = 'Message'; $lang['Message'] = 'Message';
$lang['Metadata'] = 'Metadata';
$lang['More'] = 'More'; $lang['More'] = 'More';
$lang['My issues'] = 'My issues'; $lang['My issues'] = 'My issues';
$lang['My projects'] = 'My projects'; $lang['My projects'] = 'My projects';
@ -78,7 +81,7 @@ $lang['Repository'] = 'Repository';
$lang['Revision'] = 'Revision'; $lang['Revision'] = 'Revision';
$lang['Search'] = 'Search'; $lang['Search'] = 'Search';
$lang['Settings'] = 'Settings'; $lang['Settings'] = 'Settings';
$lang['Show details'] = 'Show details'; $lang['Show metadata'] = 'Show metadata';
$lang['Sign in'] = 'Sign in'; $lang['Sign in'] = 'Sign in';
$lang['Sign out'] = 'Sign out'; $lang['Sign out'] = 'Sign out';
$lang['Site'] = 'Site'; $lang['Site'] = 'Site';

View File

@ -1,3 +1,3 @@
<?php <?php
$lang['PROJECT_MSG_TOTAL_NUM_PROJECTS'] = 'Total %d projects'; $lang['PROJECT_MSG_TOTAL_PROJECTS'] = 'Total projects';
?> ?>

View File

@ -1,4 +1,4 @@
<?php <?php
$lang['USER_MSG_HIDE_DETAILS'] = 'Hide details'; $lang['USER_MSG_HIDE_METADATA'] = 'Hide metadata';
$lang['USER_MSG_HIDE_LINE_NUMBER'] = 'Hide line numbers'; $lang['USER_MSG_HIDE_LINE_NUMBER'] = 'Hide line numbers';
?> ?>

View File

@ -1,6 +1,7 @@
<?php <?php
$lang['Administration'] = 'Administration'; $lang['Administration'] = 'Administration';
$lang['All'] = 'Semua'; $lang['All'] = 'Semua';
$lang['Apply'] = 'Apply';
$lang['Attachment'] = 'Attachment'; $lang['Attachment'] = 'Attachment';
$lang['Attachments'] = 'Attachments'; $lang['Attachments'] = 'Attachments';
$lang['Blame'] = 'Menyalahkan'; $lang['Blame'] = 'Menyalahkan';
@ -31,12 +32,14 @@ $lang['Enstyle'] = 'Enstyle';
$lang['Error'] = 'Error'; $lang['Error'] = 'Error';
$lang['File'] = 'File'; $lang['File'] = 'File';
$lang['Files'] = 'File'; $lang['Files'] = 'File';
$lang['Filter'] = 'Filter';
$lang['First'] = 'Pertama'; $lang['First'] = 'Pertama';
$lang['Folder'] = 'Folder'; $lang['Folder'] = 'Folder';
$lang['Full Difference'] = 'FullDiff'; $lang['Full Difference'] = 'FullDiff';
$lang['Graph'] = 'Graph'; $lang['Graph'] = 'Graph';
$lang['Graphs'] = 'Graphs'; $lang['Graphs'] = 'Graphs';
$lang['Head revision'] = 'Kepala revisi'; $lang['Head revision'] = 'Kepala revisi';
$lang['Hide metadata'] = 'Hide metadata';
$lang['History'] = 'Sejarah'; $lang['History'] = 'Sejarah';
$lang['Home'] = 'Beranda'; $lang['Home'] = 'Beranda';
$lang['Icon'] = 'Icon'; $lang['Icon'] = 'Icon';
@ -53,6 +56,8 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = 'Anggota'; $lang['Member'] = 'Anggota';
$lang['Members'] = 'Anggota'; $lang['Members'] = 'Anggota';
$lang['Message'] = 'Pesan'; $lang['Message'] = 'Pesan';
$lang['Metadata'] = 'Metadata';
$lang['More'] = 'More';
$lang['My issues'] = 'Issue saya'; $lang['My issues'] = 'Issue saya';
$lang['My projects'] = 'Proyek saya'; $lang['My projects'] = 'Proyek saya';
$lang['Name'] = 'Nama'; $lang['Name'] = 'Nama';
@ -75,6 +80,7 @@ $lang['Recently resolved issues'] = 'Recently resolved issues';
$lang['Repository'] = 'Repository'; $lang['Repository'] = 'Repository';
$lang['Revision'] = 'Revisi'; $lang['Revision'] = 'Revisi';
$lang['Search'] = 'Search'; $lang['Search'] = 'Search';
$lang['Show metadata'] = 'Show metadata';
$lang['Sign in'] = 'Masuk'; $lang['Sign in'] = 'Masuk';
$lang['Sign out'] = 'Keluar'; $lang['Sign out'] = 'Keluar';
$lang['Site'] = 'Site'; $lang['Site'] = 'Site';

View File

@ -1,6 +1,7 @@
<?php <?php
$lang['Administration'] = '관리'; $lang['Administration'] = '관리';
$lang['All'] = '모두'; $lang['All'] = '모두';
$lang['Apply'] = '적용';
$lang['Attachment'] = '첨부'; $lang['Attachment'] = '첨부';
$lang['Attachments'] = '첨부'; $lang['Attachments'] = '첨부';
$lang['Blame'] = '책임전가'; $lang['Blame'] = '책임전가';
@ -31,13 +32,14 @@ $lang['Enstyle'] = '모양새내기';
$lang['Error'] = '오류'; $lang['Error'] = '오류';
$lang['File'] = '파일'; $lang['File'] = '파일';
$lang['Files'] = '파일'; $lang['Files'] = '파일';
$lang['Filter'] = '필터';
$lang['First'] = '처음'; $lang['First'] = '처음';
$lang['Folder'] = '폴더'; $lang['Folder'] = '폴더';
$lang['Full Difference'] = '전체차이'; $lang['Full Difference'] = '전체차이';
$lang['Graph'] = '그래프'; $lang['Graph'] = '그래프';
$lang['Graphs'] = '그래프'; $lang['Graphs'] = '그래프';
$lang['Head revision'] = '최신리비전'; $lang['Head revision'] = '최신리비전';
$lang['Hide details'] = '상세내역숨김'; $lang['Hide metadata'] = '메타정보숨김';
$lang['History'] = '변경기록'; $lang['History'] = '변경기록';
$lang['Home'] = '홈'; $lang['Home'] = '홈';
$lang['Icon'] = '아이콘'; $lang['Icon'] = '아이콘';
@ -54,6 +56,7 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = '구성원'; $lang['Member'] = '구성원';
$lang['Members'] = '구성원'; $lang['Members'] = '구성원';
$lang['Message'] = '메시지'; $lang['Message'] = '메시지';
$lang['Metadata'] = '메타정보';
$lang['More'] = '더'; $lang['More'] = '더';
$lang['My issues'] = '내 이슈'; $lang['My issues'] = '내 이슈';
$lang['My projects'] = '내 프로젝트'; $lang['My projects'] = '내 프로젝트';
@ -78,7 +81,7 @@ $lang['Repository'] = '저장소';
$lang['Revision'] = '리비전'; $lang['Revision'] = '리비전';
$lang['Search'] = '찾기'; $lang['Search'] = '찾기';
$lang['Settings'] = '설정'; $lang['Settings'] = '설정';
$lang['Show details'] = '상세내역보기'; $lang['Show metadata'] = '메타정보보기';
$lang['Sign in'] = '로그인'; $lang['Sign in'] = '로그인';
$lang['Sign out'] = '로그아웃'; $lang['Sign out'] = '로그아웃';
$lang['Site'] = '사이트'; $lang['Site'] = '사이트';

View File

@ -1,3 +1,3 @@
<?php <?php
$lang['PROJECT_MSG_TOTAL_NUM_PROJECTS'] = '전체 프로젝트 %d개'; $lang['PROJECT_MSG_TOTAL_PROJECTS'] = '전체 프로젝트';
?> ?>

View File

@ -1,4 +1,4 @@
<?php <?php
$lang['USER_MSG_HIDE_DETAILS'] = '상세내역을 보고 싶지 않아요'; $lang['USER_MSG_HIDE_METADATA'] = '메타정보을 보고 싶지 않아요';
$lang['USER_MSG_HIDE_LINE_NUMBER'] = '라인번호를 보고 싶지 않아요'; $lang['USER_MSG_HIDE_LINE_NUMBER'] = '라인번호를 보고 싶지 않아요';
?> ?>

View File

@ -58,9 +58,19 @@ class ProjectModel extends Model
$this->db->select ('count(id) as count'); $this->db->select ('count(id) as count');
$this->db->order_by ('name', 'asc'); $this->db->order_by ('name', 'asc');
if ($search->or == 'Y')
{
if (!empty($search->id)) $this->db->or_like ('id', $search->id);
if (!empty($search->name)) $this->db->or_like ('name', $search->name);
if (!empty($search->summary)) $this->db->or_like ('summary', $search->summary);
}
else
{
if (!empty($search->id)) $this->db->like ('id', $search->id); if (!empty($search->id)) $this->db->like ('id', $search->id);
if (!empty($search->name)) $this->db->like ('name', $search->name); if (!empty($search->name)) $this->db->like ('name', $search->name);
if (!empty($search->summary)) $this->db->like ('summary', $search->summary); if (!empty($search->summary)) $this->db->like ('summary', $search->summary);
}
$query = $this->db->get ('project'); $query = $this->db->get ('project');
if ($this->db->trans_status() === FALSE) if ($this->db->trans_status() === FALSE)
@ -83,9 +93,19 @@ class ProjectModel extends Model
{ {
$this->db->trans_start (); $this->db->trans_start ();
$this->db->order_by ('name', 'asc'); $this->db->order_by ('name', 'asc');
if ($search->or == 'Y')
{
if (!empty($search->id)) $this->db->or_like ('id', $search->id);
if (!empty($search->name)) $this->db->or_like ('name', $search->name);
if (!empty($search->summary)) $this->db->or_like ('summary', $search->summary);
}
else
{
if (!empty($search->id)) $this->db->like ('id', $search->id); if (!empty($search->id)) $this->db->like ('id', $search->id);
if (!empty($search->name)) $this->db->like ('name', $search->name); if (!empty($search->name)) $this->db->like ('name', $search->name);
if (!empty($search->summary)) $this->db->like ('summary', $search->summary); if (!empty($search->summary)) $this->db->like ('summary', $search->summary);
}
$query = $this->db->get ('project', $limit, $offset); $query = $this->db->get ('project', $limit, $offset);
$this->db->trans_complete (); $this->db->trans_complete ();
if ($this->db->trans_status() === FALSE) return FALSE; if ($this->db->trans_status() === FALSE) return FALSE;

View File

@ -53,7 +53,7 @@ class UserModel extends Model
{ {
$this->db->set ('userid', $userid); $this->db->set ('userid', $userid);
$this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num); $this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num);
$this->db->set ('code_hide_details', (string)$settings->code_hide_details); $this->db->set ('code_hide_metadata', (string)$settings->code_hide_metadata);
if ($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name); if ($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name);
$this->db->insert ('user_settings'); $this->db->insert ('user_settings');
} }
@ -61,7 +61,7 @@ class UserModel extends Model
{ {
$this->db->where ('userid', $userid); $this->db->where ('userid', $userid);
$this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num); $this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num);
$this->db->set ('code_hide_details', (string)$settings->code_hide_details); $this->db->set ('code_hide_metadata', (string)$settings->code_hide_metadata);
if ($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name); if ($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name);
$this->db->update ('user_settings'); $this->db->update ('user_settings');
} }
@ -90,7 +90,7 @@ class UserModel extends Model
$this->db->where ('userid', $userid); $this->db->where ('userid', $userid);
$this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num); $this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num);
$this->db->set ('code_hide_details', (string)$settings->code_hide_details); $this->db->set ('code_hide_metadata', (string)$settings->code_hide_metadata);
if (strlen($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name); if (strlen($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name);
$this->db->update ('user_settings'); $this->db->update ('user_settings');
@ -104,7 +104,7 @@ class UserModel extends Model
{ {
$this->db->set ('userid', $userid); $this->db->set ('userid', $userid);
$this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num); $this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num);
$this->db->set ('code_hide_details', (string)$settings->code_hide_details); $this->db->set ('code_hide_metadata', (string)$settings->code_hide_metadata);
$this->db->insert ('user_settings'); $this->db->insert ('user_settings');
if ($this->db->trans_status() === FALSE) if ($this->db->trans_status() === FALSE)

View File

@ -30,23 +30,23 @@ $(function () {
?> ?>
if ($("#code_blame_mainarea_result_info").is(":visible")) if ($("#code_blame_mainarea_result_info").is(":visible"))
btn_label = "<?php print $this->lang->line('Hide details')?>"; btn_label = "<?php print $this->lang->line('Hide metadata')?>";
else else
btn_label = "<?php print $this->lang->line('Show details')?>"; btn_label = "<?php print $this->lang->line('Show metadata')?>";
btn = $("#code_blame_mainarea_details_button").button({"label": btn_label}).click (function () { btn = $("#code_blame_mainarea_metadata_button").button({"label": btn_label}).click (function () {
if ($("#code_blame_mainarea_result_info").is(":visible")) if ($("#code_blame_mainarea_result_info").is(":visible"))
{ {
$("#code_blame_mainarea_result_info").hide("blind",{},200); $("#code_blame_mainarea_result_info").hide("blind",{},200);
$("#code_blame_mainarea_details_button").button( $("#code_blame_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Show details')?>"); "option", "label", "<?php print $this->lang->line('Show metadata')?>");
} }
else else
{ {
$("#code_blame_mainarea_result_info").show("blind",{},200); $("#code_blame_mainarea_result_info").show("blind",{},200);
$("#code_blame_mainarea_details_button").button( $("#code_blame_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Hide details')?>"); "option", "label", "<?php print $this->lang->line('Hide metadata')?>");
} }
}); });
@ -189,7 +189,7 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $this->lang->line('D
print ' | '; print ' | ';
printf ('%s: %s', $this->lang->line('Size'), $file['size']); printf ('%s: %s', $this->lang->line('Size'), $file['size']);
?> ?>
<a id="code_blame_mainarea_details_button" href='#'><?php print $this->lang->line('Details')?></a> <a id="code_blame_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div> </div>
<div class="result" id="code_blame_mainarea_result"> <div class="result" id="code_blame_mainarea_result">

View File

@ -29,22 +29,22 @@ $(function () {
?> ?>
if ($("#code_file_mainarea_result_info").is(":visible")) if ($("#code_file_mainarea_result_info").is(":visible"))
btn_label = "<?php print $this->lang->line('Hide details')?>"; btn_label = "<?php print $this->lang->line('Hide metadata')?>";
else else
btn_label = "<?php print $this->lang->line('Show details')?>"; btn_label = "<?php print $this->lang->line('Show metadata')?>";
btn = $("#code_file_mainarea_details_button").button({"label": btn_label}).click (function () { btn = $("#code_file_mainarea_metadata_button").button({"label": btn_label}).click (function () {
if ($("#code_file_mainarea_result_info").is(":visible")) if ($("#code_file_mainarea_result_info").is(":visible"))
{ {
$("#code_file_mainarea_result_info").hide("blind",{},200); $("#code_file_mainarea_result_info").hide("blind",{},200);
$("#code_file_mainarea_details_button").button( $("#code_file_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Show details')?>"); "option", "label", "<?php print $this->lang->line('Show metadata')?>");
} }
else else
{ {
$("#code_file_mainarea_result_info").show("blind",{},200); $("#code_file_mainarea_result_info").show("blind",{},200);
$("#code_file_mainarea_details_button").button( $("#code_file_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Hide details')?>"); "option", "label", "<?php print $this->lang->line('Hide metadata')?>");
} }
}); });
@ -226,7 +226,7 @@ $this->load->view (
print ' | '; print ' | ';
printf ('%s: %s', $this->lang->line('Size'), $file['size']); printf ('%s: %s', $this->lang->line('Size'), $file['size']);
?> ?>
<a id="code_file_mainarea_details_button" href='#'><?php print $this->lang->line('Details')?></a> <a id="code_file_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div> </div>
<div class="result" id="code_file_mainarea_result"> <div class="result" id="code_file_mainarea_result">

View File

@ -168,23 +168,23 @@ $(function () {
?> ?>
if ($("#code_folder_mainarea_result_info").is(":visible")) if ($("#code_folder_mainarea_result_info").is(":visible"))
btn_label = "<?php print $this->lang->line('Hide details')?>"; btn_label = "<?php print $this->lang->line('Hide metadata')?>";
else else
btn_label = "<?php print $this->lang->line('Show details')?>"; btn_label = "<?php print $this->lang->line('Show metadata')?>";
btn = $("#code_folder_mainarea_details_button").button({"label": btn_label}).click (function () { btn = $("#code_folder_mainarea_metadata_button").button({"label": btn_label}).click (function () {
if ($("#code_folder_mainarea_result_info").is(":visible")) if ($("#code_folder_mainarea_result_info").is(":visible"))
{ {
$("#code_folder_mainarea_result_info").hide("blind",{},200); $("#code_folder_mainarea_result_info").hide("blind",{},200);
$("#code_folder_mainarea_details_button").button( $("#code_folder_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Show details')?>"); "option", "label", "<?php print $this->lang->line('Show metadata')?>");
} }
else else
{ {
$("#code_folder_mainarea_result_info").show("blind",{},200); $("#code_folder_mainarea_result_info").show("blind",{},200);
$("#code_folder_mainarea_details_button").button( $("#code_folder_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Hide details')?>"); "option", "label", "<?php print $this->lang->line('Hide metadata')?>");
} }
}); });
@ -400,7 +400,7 @@ $this->load->view (
if ($file_count > 0) if ($file_count > 0)
{ {
print ' | '; print ' | ';
printf ('<a id="code_folder_mainarea_details_button" href="#">%s</a>', $this->lang->line('Details')); printf ('<a id="code_folder_mainarea_metadata_button" href="#">%s</a>', $this->lang->line('Metadata'));
} }
print form_close(); print form_close();

View File

@ -35,24 +35,24 @@ function render_wiki()
$(function () { $(function () {
if ($("#file_show_mainarea_result_info").is(":visible")) if ($("#file_show_mainarea_result_info").is(":visible"))
btn_label = "<?php print $this->lang->line('Hide details')?>"; btn_label = "<?php print $this->lang->line('Hide metadata')?>";
else else
btn_label = "<?php print $this->lang->line('Show details')?>"; btn_label = "<?php print $this->lang->line('Show metadata')?>";
btn = $("#file_show_mainarea_details_button").button({"label": btn_label}).click (function () { btn = $("#file_show_mainarea_metadata_button").button({"label": btn_label}).click (function () {
if ($("#file_show_mainarea_result_info").is(":visible")) if ($("#file_show_mainarea_result_info").is(":visible"))
{ {
$("#file_show_mainarea_result_info").hide("blind",{},200); $("#file_show_mainarea_result_info").hide("blind",{},200);
$("#file_show_mainarea_details_button").button( $("#file_show_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Show details')?>"); "option", "label", "<?php print $this->lang->line('Show metadata')?>");
} }
else else
{ {
$("#file_show_mainarea_result_info").show("blind",{},200); $("#file_show_mainarea_result_info").show("blind",{},200);
$("#file_show_mainarea_details_button").button( $("#file_show_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Hide details')?>"); "option", "label", "<?php print $this->lang->line('Hide metadata')?>");
} }
}); });
@ -104,7 +104,7 @@ $this->load->view (
<div class="infostrip" id="wiki_show_mainarea_infostrip"> <div class="infostrip" id="wiki_show_mainarea_infostrip">
<?php print anchor ("file/get/{$project->id}/". $this->converter->AsciiToHex($file->name), $this->lang->line('Download')) ?> <?php print anchor ("file/get/{$project->id}/". $this->converter->AsciiToHex($file->name), $this->lang->line('Download')) ?>
| <a id="file_show_mainarea_details_button" href='#'><?php print $this->lang->line('Details')?></a> | <a id="file_show_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div> </div>
<div id="file_show_mainarea_result"> <div id="file_show_mainarea_result">

View File

@ -7,12 +7,12 @@
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/log.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/log.css')?>" />
<?php if ($login['sysadmin?'] && isset($site)): ?>
<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.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.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')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
<?php if ($login['sysadmin?'] && isset($site)): ?>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$("#purge_confirm").dialog({ $("#purge_confirm").dialog({
@ -47,8 +47,6 @@ $(function () {
if ($login['id'] != '') $caption .= "({$login['id']})"; if ($login['id'] != '') $caption .= "({$login['id']})";
?> ?>
<title><?php print htmlspecialchars($caption)?></title> <title><?php print htmlspecialchars($caption)?></title>
</head> </head>

View File

@ -14,6 +14,8 @@
<script type="text/javascript"> <script type="text/javascript">
var last_attempted_filter = '';
var last_successful_filter = '';
var site_url = "<?php print site_url(); ?>"; var site_url = "<?php print site_url(); ?>";
var total_num_avail = <?php print $total_num_projects; ?>; var total_num_avail = <?php print $total_num_projects; ?>;
var total_num_shown = <?php print count($projects); ?>; var total_num_shown = <?php print count($projects); ?>;
@ -28,7 +30,7 @@ function prepare_page_button (i, req_size)
b.click ( b.click (
function () function ()
{ {
var filter = codepot_ascii_to_hex($('#project_search_form').serialize()); var filter = codepot_ascii_to_hex(last_successful_filter);
var offset = parseInt($(this).text()); var offset = parseInt($(this).text());
$.ajax({ $.ajax({
url: "<?php print site_url(); ?>/project/catalog_json/" + filter + "/" + ((offset - 1) * req_size), url: "<?php print site_url(); ?>/project/catalog_json/" + filter + "/" + ((offset - 1) * req_size),
@ -39,8 +41,8 @@ function prepare_page_button (i, req_size)
); );
return b; return b;
} }
function render_project_pages (total, shown, req_offset, req_size) function render_project_pages (total, shown, req_offset, req_size)
{ {
var pages = ""; var pages = "";
@ -109,11 +111,20 @@ function render_project_list (json)
{ {
var p = json.projects[i]; var p = json.projects[i];
var cap = p.name + " (" + p.id + ")"; var cap;
var li = codepot_sprintf ("<li><a href='%s/project/home/%s'>%s</a> - %s</li>", site_url, p.id, cap, p.summary); if (p.id == p.name) cap = p.name;
list.append (li); // TODO: html escaping of p.id and p.name else cap = p.name + " (" + p.id + ")";
var li = codepot_sprintf ("<li><a href='%s/project/home/%s'>%s</a> - %s</li>",
codepot_htmlspecialchars(site_url),
codepot_htmlspecialchars(p.id),
codepot_htmlspecialchars(cap),
codepot_htmlspecialchars(p.summary));
list.append (li);
} }
last_successful_filter = last_attempted_filter;
$("#project_catalog_mainarea_total_projects").text(json.total_num_projects);
render_project_pages (parseInt(json.total_num_projects), parseInt(json.projects.length), parseInt(json.req_page_offset), parseInt(json.req_page_size)); render_project_pages (parseInt(json.total_num_projects), parseInt(json.projects.length), parseInt(json.req_page_offset), parseInt(json.req_page_size));
} }
else else
@ -123,39 +134,7 @@ function render_project_list (json)
} }
$(function () { $(function () {
/*
$("#project_catalog_mainarea_search_form").dialog ({
title: '<?php print $this->lang->line('Search')?>',
autoOpen: false,
modal: true,
width: '80%',
buttons: {
'<?php print $this->lang->line('OK')?>': function () {
$(this).dialog('close');
var filter = codepot_ascii_to_hex($('#project_search_form').serialize());
var url='<?php print site_url()?>/project/catalog/' + filter;
$('body').append('<form id="magic_form" method="get" action="'+url+'"></form>');
$('#magic_form').submit();
},
'<?php print $this->lang->line('Cancel')?>': function () {
$(this).dialog('close');
}
},
close: function() {}
});
$("#project_catalog_mainarea_search_button").button().click (
function () {
$('#project_catalog_mainarea_search_form').dialog('open');
return false;
}
);
*/
// Empty the page indicators generated by the server side. // Empty the page indicators generated by the server side.
// as i want the next page or the previous page to be loaded dynamically // as i want the next page or the previous page to be loaded dynamically
// without killing the original pagination available. // without killing the original pagination available.
@ -163,7 +142,9 @@ $(function () {
$("#project_catalog_mainarea_search_button").button().click ( $("#project_catalog_mainarea_search_button").button().click (
function () { function () {
var filter = codepot_ascii_to_hex($('#project_search_form').serialize()); last_attempted_filter = $('#project_search_form').serialize();
var filter = codepot_ascii_to_hex(last_attempted_filter);
$.ajax({ $.ajax({
url: "<?php print site_url(); ?>/project/catalog_json/" + filter, url: "<?php print site_url(); ?>/project/catalog_json/" + filter,
dataType: "json", dataType: "json",
@ -173,6 +154,11 @@ $(function () {
); );
render_project_pages (total_num_avail, total_num_shown, req_page_offset, req_page_size); render_project_pages (total_num_avail, total_num_shown, req_page_offset, req_page_size);
$("#project_catalog_mainarea_search_form").accordion({
collapsible: true
});
}); });
</script> </script>
@ -213,25 +199,19 @@ $this->load->view (
<div class="mainarea" id="project_catalog_mainarea"> <div class="mainarea" id="project_catalog_mainarea">
<div class="infostrip">
<?php
printf ($this->lang->line('PROJECT_MSG_TOTAL_NUM_PROJECTS'), $total_num_projects);
print ' | ';
printf ('<a id="project_catalog_mainarea_search_button" href="#">%s</a>', $this->lang->line('Search'));
?>
</div>
<div id="project_catalog_mainarea_search_form"> <div id="project_catalog_mainarea_search_form">
<div>
<span><?php print $this->lang->line('Filter'); ?></span>
<span id="project_catalog_mainarea_total_projects_holder"><?php printf ('%s: <span id="project_catalog_mainarea_total_projects">%d</span>', $this->lang->line('PROJECT_MSG_TOTAL_PROJECTS'), $total_num_projects); ?></span>
</div>
<form id="project_search_form"> <form id="project_search_form">
<div id="project_search_form_id"> <div id="project_search_form_id_and_name">
<?php <?php
print form_label($this->lang->line('ID'), 'id'); print form_label($this->lang->line('ID'), 'id');
print ' '; print ' ';
print form_input('id', set_value('owner', $search->id), 'id="project_search_id"'); print form_input('id', set_value('owner', $search->id), 'id="project_search_id"');
?> ?>
</div>
<div id="project_search_form_name">
<?php <?php
print form_label($this->lang->line('Name'), 'name'); print form_label($this->lang->line('Name'), 'name');
print ' '; print ' ';
@ -239,14 +219,22 @@ $this->load->view (
?> ?>
</div> </div>
<div id="project_search_form_summary"> <div id="project_search_form_summary_and_or">
<?php <?php
print form_label($this->lang->line('Summary'), 'summary'); print form_label($this->lang->line('Summary'), 'summary');
print ' '; print ' ';
print form_input('summary', set_value('summary', $search->summary), 'id="project_search_summary" size="50"'); print form_input('summary', set_value('summary', $search->summary), 'id="project_search_summary" size="50"');
?> ?>
</div>
<?php
print form_label('OR', 'or');
print ' ';
print form_checkbox('or', 'Y', set_checkbox('or', $search->or), 'id="project_search_or"');
?>
</div>
<?php
printf ('<a id="project_catalog_mainarea_search_button" href="#">%s</a>', $this->lang->line('Apply'));
?>
</form> </form>
</div> </div>
@ -262,7 +250,9 @@ else
print '<ul id="project_catalog_mainarea_result_list">'; print '<ul id="project_catalog_mainarea_result_list">';
foreach ($projects as $project) foreach ($projects as $project)
{ {
$cap = "{$project->name} ({$project->id})"; /* the formatting here must match the render_project_list() javascript function */
if ($project->name == $project->id) $cap = $project->name;
else $cap = "{$project->name} ({$project->id})";
$anc = anchor ("project/home/{$project->id}", htmlspecialchars($cap)); $anc = anchor ("project/home/{$project->id}", htmlspecialchars($cap));
$sum = htmlspecialchars ($project->summary); $sum = htmlspecialchars ($project->summary);
print "<li>{$anc} - {$sum}</li>"; print "<li>{$anc} - {$sum}</li>";

View File

@ -11,6 +11,13 @@
<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/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.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.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')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
@ -19,11 +26,13 @@
function render_wiki() function render_wiki()
{ {
creole_render_wiki ( creole_render_wiki (
"site_home_mainarea_wiki_text", "site_home_mainarea_result_wiki_text",
"site_home_mainarea_wiki", "site_home_mainarea_result_wiki",
"<?php print site_url()?>/site/wiki/", "<?php print site_url()?>/site/wiki/",
"<?php print site_url()?>/site/image/" "<?php print site_url()?>/site/image/"
); );
prettyPrint ();
} }
</script> </script>
@ -228,10 +237,12 @@ foreach ($latest_projects as $project)
</div> <!-- site_home_mainarea_sidebar --> </div> <!-- site_home_mainarea_sidebar -->
<div class="result" id="site_home_mainarea_result">
<?php if ($issues && count($issues) > 0): ?> <?php if ($issues && count($issues) > 0): ?>
<div id="site_home_mainarea_issues"> <div id="site_home_mainarea_result_open_issues">
<div><?php print $this->lang->line('Open issues')?></div> <div><?php print $this->lang->line('Open issues')?></div>
<ul> <ul id="site_home_mainarea_result_open_issues_list">
<?php <?php
foreach ($issues as $issue) foreach ($issues as $issue)
{ {
@ -258,9 +269,9 @@ foreach ($latest_projects as $project)
<?php endif; ?> <?php endif; ?>
<?php if ($recently_resolved_issues && count($recently_resolved_issues) > 0): ?> <?php if ($recently_resolved_issues && count($recently_resolved_issues) > 0): ?>
<div id="site_home_mainarea_issues"> <div id="site_home_mainarea_result_resolved_issues">
<div><?php print $this->lang->line('Recently resolved issues')?></div> <div><?php print $this->lang->line('Recently resolved issues')?></div>
<ul> <ul id="site_home_mainarea_result_resolved_issues_list">
<?php <?php
foreach ($recently_resolved_issues as $issue) foreach ($recently_resolved_issues as $issue)
{ {
@ -287,13 +298,13 @@ foreach ($latest_projects as $project)
<?php endif; ?> <?php endif; ?>
<div id="site_home_mainarea_result_wiki">
<div class="result" id="site_home_mainarea_wiki"> <pre id="site_home_mainarea_result_wiki_text" style="visibility: hidden">
<pre id="site_home_mainarea_wiki_text" style="visibility: hidden">
<?php print htmlspecialchars($site->text); ?> <?php print htmlspecialchars($site->text); ?>
</pre> </pre>
</div> <!-- site_home_mainarea_text --> </div> <!-- site_home_mainarea_text -->
</div> <! -- site_home_mainarea_result -->
<!-- ////////////////////////////////////////////////////////////////////// --> <!-- ////////////////////////////////////////////////////////////////////// -->
</div> <!-- site_home_mainarea --> </div> <!-- site_home_mainarea -->

View File

@ -157,6 +157,7 @@ $(function () {
$("#taskbar_project_to_find").button().autocomplete({ $("#taskbar_project_to_find").button().autocomplete({
minLength: 1, // is this too small? minLength: 1, // is this too small?
delay: 1000,
source: function (request, response) { source: function (request, response) {
var term = codepot_string_to_hex(request.term); var term = codepot_string_to_hex(request.term);

View File

@ -7,17 +7,9 @@
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/user.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/user.css')?>" />
<!--
<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.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.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')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
-->
<script type="text/javascript">
$(function () {
$('#user_settings_mainarea_result').accordion();
});
</script>
<title><?php print htmlspecialchars($login['id'])?></title> <title><?php print htmlspecialchars($login['id'])?></title>
</head> </head>
@ -70,10 +62,10 @@ $this->load->view (
?> ?>
<?php print $this->lang->line('USER_MSG_HIDE_LINE_NUMBER')?> <?php print $this->lang->line('USER_MSG_HIDE_LINE_NUMBER')?>
<?php print form_checkbox('code_hide_details', <?php print form_checkbox('code_hide_metadata',
'Y', $settings->code_hide_details == 'Y') 'Y', $settings->code_hide_metadata == 'Y')
?> ?>
<?php print $this->lang->line('USER_MSG_HIDE_DETAILS')?> <?php print $this->lang->line('USER_MSG_HIDE_METADATA')?>
<div class='form_input_field'> <div class='form_input_field'>
<?php print form_label($this->lang->line('Icon').': ', 'icon_img_file_name')?> <?php print form_label($this->lang->line('Icon').': ', 'icon_img_file_name')?>

View File

@ -57,23 +57,23 @@ function render_wiki()
$(function () { $(function () {
if ($("#wiki_show_mainarea_result_info").is(":visible")) if ($("#wiki_show_mainarea_result_info").is(":visible"))
btn_label = "<?php print $this->lang->line('Hide details')?>"; btn_label = "<?php print $this->lang->line('Hide metadata')?>";
else else
btn_label = "<?php print $this->lang->line('Show details')?>"; btn_label = "<?php print $this->lang->line('Show metadata')?>";
btn = $("#wiki_show_mainarea_details_button").button({"label": btn_label}).click (function () { btn = $("#wiki_show_mainarea_metadata_button").button({"label": btn_label}).click (function () {
if ($("#wiki_show_mainarea_result_info").is(":visible")) if ($("#wiki_show_mainarea_result_info").is(":visible"))
{ {
$("#wiki_show_mainarea_result_info").hide("blind",{},200); $("#wiki_show_mainarea_result_info").hide("blind",{},200);
$("#wiki_show_mainarea_details_button").button( $("#wiki_show_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Show details')?>"); "option", "label", "<?php print $this->lang->line('Show metadata')?>");
} }
else else
{ {
$("#wiki_show_mainarea_result_info").show("blind",{},200); $("#wiki_show_mainarea_result_info").show("blind",{},200);
$("#wiki_show_mainarea_details_button").button( $("#wiki_show_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Hide details')?>"); "option", "label", "<?php print $this->lang->line('Hide metadata')?>");
} }
}); });
@ -120,7 +120,7 @@ $this->load->view (
<div class="title"><?php print htmlspecialchars($wiki->name)?></div> <div class="title"><?php print htmlspecialchars($wiki->name)?></div>
<div class="infostrip" id="wiki_show_mainarea_infostrip"> <div class="infostrip" id="wiki_show_mainarea_infostrip">
<a id="wiki_show_mainarea_details_button" href='#'><?php print $this->lang->line('Details')?></a> <a id="wiki_show_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div> </div>
<div id="wiki_show_mainarea_result" class="result"> <div id="wiki_show_mainarea_result" class="result">

View File

@ -574,8 +574,6 @@ pre.prettyprint li.L9 { background: #eee }
background: #E5ECF9 none repeat scroll 0 0; background: #E5ECF9 none repeat scroll 0 0;
border: #D4DBE8 1px solid; border: #D4DBE8 1px solid;
/*background: #DDDDDD none repeat scroll 0 0;
border: 1px solid #CCCCCC;*/
margin: 0.3em 0em 0em 0em; margin: 0.3em 0em 0em 0em;
padding: 0.3em 0.3em 0.3em 0.3em; padding: 0.3em 0.3em 0.3em 0.3em;

View File

@ -58,16 +58,41 @@
} }
#project_catalog_mainarea_result_list { #project_catalog_mainarea_result_list {
margin: 1em; margin-left: 1em;
margin-right: 1em;
margin-top: 0;
margin-bottom: 0;
padding: 1em; padding: 1em;
white-space: nowrap; white-space: nowrap;
line-height: 1.5em; line-height: 1.5em;
} }
#project_catalog_mainarea_result_pages { #project_catalog_mainarea_result_pages {
margin: 1em; margin-left: 1em;
margin-right: 1em;
margin-top: 0.5em;
margin-bottom: 0.5em;
} }
#project_catalog_mainarea_search_form {
margin-top: 1em;
}
#project_catalog_mainarea_search_form .ui-accordion-header {
/* trying to emulate infostrip with the header of a jquery-ui's accordion widget */
background: #E5ECF9 none repeat scroll 0 0;
border: #D4DBE8 1px solid;
}
#project_catalog_mainarea_search_form form {
line-height: 2.5em;
}
#project_catalog_mainarea_total_projects_holder {
position: absolute;
right: 1em;
font-weight: normal;
}
/*----------------------------------------------- /*-----------------------------------------------
* project source folder view * project source folder view
*-----------------------------------------------*/ *-----------------------------------------------*/

View File

@ -44,6 +44,23 @@
white-space: pre-wrap; white-space: pre-wrap;
} }
#site_home_mainarea_result_open_issues_list {
margin-left: 1em;
margin-right: 1em;
margin-top: 0;
margin-bottom: 0;
padding: 1em;
line-height: 1.5em;
}
#site_home_mainarea_result_resolved_issues_list {
margin-left: 1em;
margin-right: 1em;
margin-top: 0;
margin-bottom: 0;
padding: 1em;
line-height: 1.5em;
}
/*----------------------------------------------- /*-----------------------------------------------
* site show view * site show view
*-----------------------------------------------*/ *-----------------------------------------------*/

View File

@ -240,6 +240,7 @@ top_srcdir = @top_srcdir@
wwwdir = $(WWWDIR)/js wwwdir = $(WWWDIR)/js
SUBDIRS = prettify SUBDIRS = prettify
www_DATA = \ www_DATA = \
codepot.js \
creole.js \ creole.js \
jquery.min.js \ jquery.min.js \
jquery-ui.min.js \ jquery-ui.min.js \

View File

@ -312,6 +312,76 @@ function codepot_sprintf() {
return format.replace(regex, doFormat); return format.replace(regex, doFormat);
} }
function codepot_htmlspecialchars(string, quote_style, charset, double_encode) {
// discuss at: http://phpjs.org/functions/htmlspecialchars/
// original by: Mirek Slugen
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Nathan
// bugfixed by: Arno
// bugfixed by: Brett Zamir (http://brett-zamir.me)
// bugfixed by: Brett Zamir (http://brett-zamir.me)
// revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// input by: Ratheous
// input by: Mailfaker (http://www.weedem.fr/)
// input by: felix
// reimplemented by: Brett Zamir (http://brett-zamir.me)
// note: charset argument not supported
// example 1: htmlspecialchars("<a href='test'>Test</a>", 'ENT_QUOTES');
// returns 1: '&lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;'
// example 2: htmlspecialchars("ab\"c'd", ['ENT_NOQUOTES', 'ENT_QUOTES']);
// returns 2: 'ab"c&#039;d'
// example 3: htmlspecialchars('my "&entity;" is still here', null, null, false);
// returns 3: 'my &quot;&entity;&quot; is still here'
var optTemp = 0,
i = 0,
noquotes = false;
if (typeof quote_style === 'undefined' || quote_style === null) {
quote_style = 2;
}
string = string.toString();
if (double_encode !== false) {
// Put this first to avoid double-encoding
string = string.replace(/&/g, '&amp;');
}
string = string.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
var OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
'ENT_COMPAT': 2,
'ENT_QUOTES': 3,
'ENT_IGNORE': 4
};
if (quote_style === 0) {
noquotes = true;
}
if (typeof quote_style !== 'number') {
// Allow for a single string or an array of string flags
quote_style = [].concat(quote_style);
for (i = 0; i < quote_style.length; i++) {
// Resolve string input to bitwise e.g. 'ENT_IGNORE' becomes 4
if (OPTS[quote_style[i]] === 0) {
noquotes = true;
} else if (OPTS[quote_style[i]]) {
optTemp = optTemp | OPTS[quote_style[i]];
}
}
quote_style = optTemp;
}
if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
string = string.replace(/'/g, '&#039;');
}
if (!noquotes) {
string = string.replace(/"/g, '&quot;');
}
return string;
}
function codepot_ascii_to_hex (x) function codepot_ascii_to_hex (x)
{ {
var r=""; var r="";