# 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:
parent
434a1f8f3f
commit
39139aa5c2
@ -7,6 +7,15 @@ CODEPOT
|
||||
multiple subversion repositories independent of each other. Going beyond it,
|
||||
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
|
||||
|
||||
A RPM package is provided for RedHat/CentOS Linux. The RPM package specifies
|
||||
|
@ -192,7 +192,7 @@ CREATE TABLE log (
|
||||
CREATE TABLE user_settings (
|
||||
userid VARCHAR(32) PRIMARY KEY,
|
||||
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
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
|
@ -37,6 +37,7 @@ class Project extends Controller
|
||||
$search->id = '';
|
||||
$search->name = '';
|
||||
$search->summary = '';
|
||||
$search->or = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -44,6 +45,7 @@ class Project extends Controller
|
||||
if (!array_key_exists ('id', $search)) $search['id'] = '';
|
||||
if (!array_key_exists ('name', $search)) $search['name'] = '';
|
||||
if (!array_key_exists ('summary', $search)) $search['summary'] = '';
|
||||
if (!array_key_exists ('or', $search)) $search['or'] = '';
|
||||
|
||||
$search = (object) $search;
|
||||
}
|
||||
@ -486,6 +488,7 @@ class Project extends Controller
|
||||
$search->id = '';
|
||||
$search->name = '';
|
||||
$search->summary = '';
|
||||
$search->or = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -493,6 +496,7 @@ class Project extends Controller
|
||||
if (!array_key_exists ('id', $search)) $search['id'] = '';
|
||||
if (!array_key_exists ('name', $search)) $search['name'] = '';
|
||||
if (!array_key_exists ('summary', $search)) $search['summary'] = '';
|
||||
if (!array_key_exists ('or', $search)) $search['or'] = '';
|
||||
|
||||
$search = (object) $search;
|
||||
}
|
||||
@ -581,7 +585,8 @@ class Project extends Controller
|
||||
|
||||
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);
|
||||
|
@ -200,7 +200,7 @@ class User extends Controller
|
||||
}
|
||||
|
||||
$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->uploaded_icon_name = $uploaded_fname;
|
||||
|
||||
@ -227,7 +227,7 @@ class User extends Controller
|
||||
{
|
||||
if ($settings === FALSE) $data['message'] = 'DATABASE ERROR';
|
||||
$settings->code_hide_line_num = ' ';
|
||||
$settings->code_hide_details = ' ';
|
||||
$settings->code_hide_metadata = ' ';
|
||||
$settings->icon_name = '';
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$lang['Administration'] = 'Administration';
|
||||
$lang['All'] = 'All';
|
||||
$lang['Apply'] = 'Apply';
|
||||
$lang['Attachment'] = 'Attachment';
|
||||
$lang['Attachments'] = 'Attachments';
|
||||
$lang['Blame'] = 'Blame';
|
||||
@ -31,13 +32,14 @@ $lang['Enstyle'] = 'Enstyle';
|
||||
$lang['Error'] = 'Error';
|
||||
$lang['File'] = 'File';
|
||||
$lang['Files'] = 'Files';
|
||||
$lang['Filter'] = 'Filter';
|
||||
$lang['First'] = 'First';
|
||||
$lang['Folder'] = 'Folder';
|
||||
$lang['Full Difference'] = 'FullDiff';
|
||||
$lang['Graph'] = 'Graph';
|
||||
$lang['Graphs'] = 'Graphs';
|
||||
$lang['Head revision'] = 'Head revision';
|
||||
$lang['Hide details'] = 'Hide details';
|
||||
$lang['Hide metadata'] = 'Hide metadata';
|
||||
$lang['History'] = 'History';
|
||||
$lang['Home'] = 'Home';
|
||||
$lang['Icon'] = 'Icon';
|
||||
@ -54,6 +56,7 @@ $lang['MD5'] = 'MD5';
|
||||
$lang['Member'] = 'Member';
|
||||
$lang['Members'] = 'Members';
|
||||
$lang['Message'] = 'Message';
|
||||
$lang['Metadata'] = 'Metadata';
|
||||
$lang['More'] = 'More';
|
||||
$lang['My issues'] = 'My issues';
|
||||
$lang['My projects'] = 'My projects';
|
||||
@ -78,7 +81,7 @@ $lang['Repository'] = 'Repository';
|
||||
$lang['Revision'] = 'Revision';
|
||||
$lang['Search'] = 'Search';
|
||||
$lang['Settings'] = 'Settings';
|
||||
$lang['Show details'] = 'Show details';
|
||||
$lang['Show metadata'] = 'Show metadata';
|
||||
$lang['Sign in'] = 'Sign in';
|
||||
$lang['Sign out'] = 'Sign out';
|
||||
$lang['Site'] = 'Site';
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
$lang['PROJECT_MSG_TOTAL_NUM_PROJECTS'] = 'Total %d projects';
|
||||
$lang['PROJECT_MSG_TOTAL_PROJECTS'] = 'Total projects';
|
||||
?>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
$lang['USER_MSG_HIDE_DETAILS'] = 'Hide details';
|
||||
$lang['USER_MSG_HIDE_METADATA'] = 'Hide metadata';
|
||||
$lang['USER_MSG_HIDE_LINE_NUMBER'] = 'Hide line numbers';
|
||||
?>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$lang['Administration'] = 'Administration';
|
||||
$lang['All'] = 'Semua';
|
||||
$lang['Apply'] = 'Apply';
|
||||
$lang['Attachment'] = 'Attachment';
|
||||
$lang['Attachments'] = 'Attachments';
|
||||
$lang['Blame'] = 'Menyalahkan';
|
||||
@ -31,12 +32,14 @@ $lang['Enstyle'] = 'Enstyle';
|
||||
$lang['Error'] = 'Error';
|
||||
$lang['File'] = 'File';
|
||||
$lang['Files'] = 'File';
|
||||
$lang['Filter'] = 'Filter';
|
||||
$lang['First'] = 'Pertama';
|
||||
$lang['Folder'] = 'Folder';
|
||||
$lang['Full Difference'] = 'FullDiff';
|
||||
$lang['Graph'] = 'Graph';
|
||||
$lang['Graphs'] = 'Graphs';
|
||||
$lang['Head revision'] = 'Kepala revisi';
|
||||
$lang['Hide metadata'] = 'Hide metadata';
|
||||
$lang['History'] = 'Sejarah';
|
||||
$lang['Home'] = 'Beranda';
|
||||
$lang['Icon'] = 'Icon';
|
||||
@ -53,6 +56,8 @@ $lang['MD5'] = 'MD5';
|
||||
$lang['Member'] = 'Anggota';
|
||||
$lang['Members'] = 'Anggota';
|
||||
$lang['Message'] = 'Pesan';
|
||||
$lang['Metadata'] = 'Metadata';
|
||||
$lang['More'] = 'More';
|
||||
$lang['My issues'] = 'Issue saya';
|
||||
$lang['My projects'] = 'Proyek saya';
|
||||
$lang['Name'] = 'Nama';
|
||||
@ -75,6 +80,7 @@ $lang['Recently resolved issues'] = 'Recently resolved issues';
|
||||
$lang['Repository'] = 'Repository';
|
||||
$lang['Revision'] = 'Revisi';
|
||||
$lang['Search'] = 'Search';
|
||||
$lang['Show metadata'] = 'Show metadata';
|
||||
$lang['Sign in'] = 'Masuk';
|
||||
$lang['Sign out'] = 'Keluar';
|
||||
$lang['Site'] = 'Site';
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$lang['Administration'] = '관리';
|
||||
$lang['All'] = '모두';
|
||||
$lang['Apply'] = '적용';
|
||||
$lang['Attachment'] = '첨부';
|
||||
$lang['Attachments'] = '첨부';
|
||||
$lang['Blame'] = '책임전가';
|
||||
@ -31,13 +32,14 @@ $lang['Enstyle'] = '모양새내기';
|
||||
$lang['Error'] = '오류';
|
||||
$lang['File'] = '파일';
|
||||
$lang['Files'] = '파일';
|
||||
$lang['Filter'] = '필터';
|
||||
$lang['First'] = '처음';
|
||||
$lang['Folder'] = '폴더';
|
||||
$lang['Full Difference'] = '전체차이';
|
||||
$lang['Graph'] = '그래프';
|
||||
$lang['Graphs'] = '그래프';
|
||||
$lang['Head revision'] = '최신리비전';
|
||||
$lang['Hide details'] = '상세내역숨김';
|
||||
$lang['Hide metadata'] = '메타정보숨김';
|
||||
$lang['History'] = '변경기록';
|
||||
$lang['Home'] = '홈';
|
||||
$lang['Icon'] = '아이콘';
|
||||
@ -54,6 +56,7 @@ $lang['MD5'] = 'MD5';
|
||||
$lang['Member'] = '구성원';
|
||||
$lang['Members'] = '구성원';
|
||||
$lang['Message'] = '메시지';
|
||||
$lang['Metadata'] = '메타정보';
|
||||
$lang['More'] = '더';
|
||||
$lang['My issues'] = '내 이슈';
|
||||
$lang['My projects'] = '내 프로젝트';
|
||||
@ -78,7 +81,7 @@ $lang['Repository'] = '저장소';
|
||||
$lang['Revision'] = '리비전';
|
||||
$lang['Search'] = '찾기';
|
||||
$lang['Settings'] = '설정';
|
||||
$lang['Show details'] = '상세내역보기';
|
||||
$lang['Show metadata'] = '메타정보보기';
|
||||
$lang['Sign in'] = '로그인';
|
||||
$lang['Sign out'] = '로그아웃';
|
||||
$lang['Site'] = '사이트';
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
$lang['PROJECT_MSG_TOTAL_NUM_PROJECTS'] = '전체 프로젝트 %d개';
|
||||
$lang['PROJECT_MSG_TOTAL_PROJECTS'] = '전체 프로젝트';
|
||||
?>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
$lang['USER_MSG_HIDE_DETAILS'] = '상세내역을 보고 싶지 않아요';
|
||||
$lang['USER_MSG_HIDE_METADATA'] = '메타정보을 보고 싶지 않아요';
|
||||
$lang['USER_MSG_HIDE_LINE_NUMBER'] = '라인번호를 보고 싶지 않아요';
|
||||
?>
|
||||
|
@ -58,9 +58,19 @@ class ProjectModel extends Model
|
||||
|
||||
$this->db->select ('count(id) as count');
|
||||
$this->db->order_by ('name', 'asc');
|
||||
if (!empty($search->id)) $this->db->like ('id', $search->id);
|
||||
if (!empty($search->name)) $this->db->like ('name', $search->name);
|
||||
if (!empty($search->summary)) $this->db->like ('summary', $search->summary);
|
||||
|
||||
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->name)) $this->db->like ('name', $search->name);
|
||||
if (!empty($search->summary)) $this->db->like ('summary', $search->summary);
|
||||
}
|
||||
|
||||
$query = $this->db->get ('project');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
@ -83,9 +93,19 @@ class ProjectModel extends Model
|
||||
{
|
||||
$this->db->trans_start ();
|
||||
$this->db->order_by ('name', 'asc');
|
||||
if (!empty($search->id)) $this->db->like ('id', $search->id);
|
||||
if (!empty($search->name)) $this->db->like ('name', $search->name);
|
||||
if (!empty($search->summary)) $this->db->like ('summary', $search->summary);
|
||||
|
||||
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->name)) $this->db->like ('name', $search->name);
|
||||
if (!empty($search->summary)) $this->db->like ('summary', $search->summary);
|
||||
}
|
||||
$query = $this->db->get ('project', $limit, $offset);
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
@ -332,8 +352,8 @@ class ProjectModel extends Model
|
||||
$this->db->set ('type', 'project');
|
||||
$this->db->set ('action', 'delete');
|
||||
$this->db->set ('projectid', $project->id);
|
||||
$this->db->set ('userid', $userid);
|
||||
$this->db->set ('message', $project->name);
|
||||
$this->db->set ('userid', $userid);
|
||||
$this->db->set ('message', $project->name);
|
||||
$this->db->insert ('log');
|
||||
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
|
@ -53,7 +53,7 @@ class UserModel extends Model
|
||||
{
|
||||
$this->db->set ('userid', $userid);
|
||||
$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);
|
||||
$this->db->insert ('user_settings');
|
||||
}
|
||||
@ -61,7 +61,7 @@ class UserModel extends Model
|
||||
{
|
||||
$this->db->where ('userid', $userid);
|
||||
$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);
|
||||
$this->db->update ('user_settings');
|
||||
}
|
||||
@ -90,7 +90,7 @@ class UserModel extends Model
|
||||
|
||||
$this->db->where ('userid', $userid);
|
||||
$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);
|
||||
$this->db->update ('user_settings');
|
||||
|
||||
@ -104,7 +104,7 @@ class UserModel extends Model
|
||||
{
|
||||
$this->db->set ('userid', $userid);
|
||||
$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');
|
||||
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
|
@ -30,23 +30,23 @@ $(function () {
|
||||
?>
|
||||
|
||||
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
|
||||
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"))
|
||||
{
|
||||
$("#code_blame_mainarea_result_info").hide("blind",{},200);
|
||||
$("#code_blame_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show details')?>");
|
||||
$("#code_blame_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show metadata')?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#code_blame_mainarea_result_info").show("blind",{},200);
|
||||
$("#code_blame_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide details')?>");
|
||||
$("#code_blame_mainarea_metadata_button").button(
|
||||
"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 ' | ';
|
||||
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 class="result" id="code_blame_mainarea_result">
|
||||
|
@ -29,22 +29,22 @@ $(function () {
|
||||
?>
|
||||
|
||||
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
|
||||
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"))
|
||||
{
|
||||
$("#code_file_mainarea_result_info").hide("blind",{},200);
|
||||
$("#code_file_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show details')?>");
|
||||
$("#code_file_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show metadata')?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#code_file_mainarea_result_info").show("blind",{},200);
|
||||
$("#code_file_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide details')?>");
|
||||
$("#code_file_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide metadata')?>");
|
||||
}
|
||||
});
|
||||
|
||||
@ -226,7 +226,7 @@ $this->load->view (
|
||||
print ' | ';
|
||||
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 class="result" id="code_file_mainarea_result">
|
||||
|
@ -168,23 +168,23 @@ $(function () {
|
||||
?>
|
||||
|
||||
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
|
||||
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"))
|
||||
{
|
||||
$("#code_folder_mainarea_result_info").hide("blind",{},200);
|
||||
$("#code_folder_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show details')?>");
|
||||
$("#code_folder_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show metadata')?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#code_folder_mainarea_result_info").show("blind",{},200);
|
||||
$("#code_folder_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide details')?>");
|
||||
$("#code_folder_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide metadata')?>");
|
||||
}
|
||||
});
|
||||
|
||||
@ -400,7 +400,7 @@ $this->load->view (
|
||||
if ($file_count > 0)
|
||||
{
|
||||
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();
|
||||
|
@ -35,24 +35,24 @@ function render_wiki()
|
||||
|
||||
$(function () {
|
||||
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
|
||||
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"))
|
||||
{
|
||||
$("#file_show_mainarea_result_info").hide("blind",{},200);
|
||||
$("#file_show_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show details')?>");
|
||||
$("#file_show_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show metadata')?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#file_show_mainarea_result_info").show("blind",{},200);
|
||||
$("#file_show_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide details')?>");
|
||||
$("#file_show_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide metadata')?>");
|
||||
}
|
||||
});
|
||||
|
||||
@ -104,7 +104,7 @@ $this->load->view (
|
||||
|
||||
<div class="infostrip" id="wiki_show_mainarea_infostrip">
|
||||
<?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 id="file_show_mainarea_result">
|
||||
|
@ -6,13 +6,13 @@
|
||||
<script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script>
|
||||
<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')?>" />
|
||||
|
||||
<?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-ui.min.js')?>"></script>
|
||||
<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">
|
||||
$(function () {
|
||||
$("#purge_confirm").dialog({
|
||||
@ -34,7 +34,7 @@ $(function () {
|
||||
});
|
||||
$("#log_mainarea_purge").button().click(
|
||||
function () {
|
||||
$('#purge_confirm').dialog('open');
|
||||
$('#purge_confirm').dialog('open');
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -47,8 +47,6 @@ $(function () {
|
||||
if ($login['id'] != '') $caption .= "({$login['id']})";
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<title><?php print htmlspecialchars($caption)?></title>
|
||||
</head>
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var last_attempted_filter = '';
|
||||
var last_successful_filter = '';
|
||||
var site_url = "<?php print site_url(); ?>";
|
||||
var total_num_avail = <?php print $total_num_projects; ?>;
|
||||
var total_num_shown = <?php print count($projects); ?>;
|
||||
@ -28,7 +30,7 @@ function prepare_page_button (i, req_size)
|
||||
b.click (
|
||||
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());
|
||||
$.ajax({
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
function render_project_pages (total, shown, req_offset, req_size)
|
||||
{
|
||||
var pages = "";
|
||||
@ -109,11 +111,20 @@ function render_project_list (json)
|
||||
{
|
||||
var p = json.projects[i];
|
||||
|
||||
var cap = p.name + " (" + p.id + ")";
|
||||
var li = codepot_sprintf ("<li><a href='%s/project/home/%s'>%s</a> - %s</li>", site_url, p.id, cap, p.summary);
|
||||
list.append (li); // TODO: html escaping of p.id and p.name
|
||||
var cap;
|
||||
if (p.id == p.name) cap = 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));
|
||||
}
|
||||
else
|
||||
@ -123,39 +134,7 @@ function render_project_list (json)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$(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.
|
||||
// as i want the next page or the previous page to be loaded dynamically
|
||||
// without killing the original pagination available.
|
||||
@ -163,7 +142,9 @@ $(function () {
|
||||
|
||||
$("#project_catalog_mainarea_search_button").button().click (
|
||||
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({
|
||||
url: "<?php print site_url(); ?>/project/catalog_json/" + filter,
|
||||
dataType: "json",
|
||||
@ -173,6 +154,11 @@ $(function () {
|
||||
);
|
||||
|
||||
render_project_pages (total_num_avail, total_num_shown, req_page_offset, req_page_size);
|
||||
|
||||
$("#project_catalog_mainarea_search_form").accordion({
|
||||
collapsible: true
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -213,25 +199,19 @@ $this->load->view (
|
||||
|
||||
<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>
|
||||
<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">
|
||||
<div id="project_search_form_id">
|
||||
<div id="project_search_form_id_and_name">
|
||||
<?php
|
||||
print form_label($this->lang->line('ID'), 'id');
|
||||
print ' ';
|
||||
print form_input('id', set_value('owner', $search->id), 'id="project_search_id"');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="project_search_form_name">
|
||||
<?php
|
||||
print form_label($this->lang->line('Name'), 'name');
|
||||
print ' ';
|
||||
@ -239,14 +219,22 @@ $this->load->view (
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="project_search_form_summary">
|
||||
<div id="project_search_form_summary_and_or">
|
||||
<?php
|
||||
print form_label($this->lang->line('Summary'), 'summary');
|
||||
print ' ';
|
||||
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>
|
||||
</div>
|
||||
|
||||
@ -262,7 +250,9 @@ else
|
||||
print '<ul id="project_catalog_mainarea_result_list">';
|
||||
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));
|
||||
$sum = htmlspecialchars ($project->summary);
|
||||
print "<li>{$anc} - {$sum}</li>";
|
||||
|
@ -155,7 +155,7 @@ foreach ($urls as $url)
|
||||
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<?php print anchor ("/project/log/{$project->id}", $this->lang->line('Change log')) ?>
|
||||
<?php print anchor ("/project/log/{$project->id}", $this->lang->line('Change log')) ?>
|
||||
</div>
|
||||
<?php
|
||||
if (count($log_entries) > 0)
|
||||
@ -260,7 +260,7 @@ foreach ($urls as $url)
|
||||
print htmlspecialchars (sprintf($fmt, $log['userid']));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
@ -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/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')?>" />
|
||||
@ -19,11 +26,13 @@
|
||||
function render_wiki()
|
||||
{
|
||||
creole_render_wiki (
|
||||
"site_home_mainarea_wiki_text",
|
||||
"site_home_mainarea_wiki",
|
||||
"site_home_mainarea_result_wiki_text",
|
||||
"site_home_mainarea_result_wiki",
|
||||
"<?php print site_url()?>/site/wiki/",
|
||||
"<?php print site_url()?>/site/image/"
|
||||
);
|
||||
|
||||
prettyPrint ();
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -228,10 +237,12 @@ foreach ($latest_projects as $project)
|
||||
|
||||
</div> <!-- site_home_mainarea_sidebar -->
|
||||
|
||||
<div class="result" id="site_home_mainarea_result">
|
||||
|
||||
<?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>
|
||||
<ul>
|
||||
<ul id="site_home_mainarea_result_open_issues_list">
|
||||
<?php
|
||||
foreach ($issues as $issue)
|
||||
{
|
||||
@ -258,9 +269,9 @@ foreach ($latest_projects as $project)
|
||||
<?php endif; ?>
|
||||
|
||||
<?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>
|
||||
<ul>
|
||||
<ul id="site_home_mainarea_result_resolved_issues_list">
|
||||
<?php
|
||||
foreach ($recently_resolved_issues as $issue)
|
||||
{
|
||||
@ -287,13 +298,13 @@ foreach ($latest_projects as $project)
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
<div class="result" id="site_home_mainarea_wiki">
|
||||
<pre id="site_home_mainarea_wiki_text" style="visibility: hidden">
|
||||
<div id="site_home_mainarea_result_wiki">
|
||||
<pre id="site_home_mainarea_result_wiki_text" style="visibility: hidden">
|
||||
<?php print htmlspecialchars($site->text); ?>
|
||||
</pre>
|
||||
</div> <!-- site_home_mainarea_text -->
|
||||
|
||||
</div> <! -- site_home_mainarea_result -->
|
||||
<!-- ////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
</div> <!-- site_home_mainarea -->
|
||||
|
@ -157,6 +157,7 @@ $(function () {
|
||||
|
||||
$("#taskbar_project_to_find").button().autocomplete({
|
||||
minLength: 1, // is this too small?
|
||||
delay: 1000,
|
||||
source: function (request, response) {
|
||||
|
||||
var term = codepot_string_to_hex(request.term);
|
||||
|
@ -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/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-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 () {
|
||||
$('#user_settings_mainarea_result').accordion();
|
||||
});
|
||||
</script>
|
||||
|
||||
<title><?php print htmlspecialchars($login['id'])?></title>
|
||||
</head>
|
||||
@ -70,10 +62,10 @@ $this->load->view (
|
||||
?>
|
||||
<?php print $this->lang->line('USER_MSG_HIDE_LINE_NUMBER')?>
|
||||
|
||||
<?php print form_checkbox('code_hide_details',
|
||||
'Y', $settings->code_hide_details == 'Y')
|
||||
<?php print form_checkbox('code_hide_metadata',
|
||||
'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'>
|
||||
<?php print form_label($this->lang->line('Icon').': ', 'icon_img_file_name')?>
|
||||
|
@ -57,23 +57,23 @@ function render_wiki()
|
||||
|
||||
$(function () {
|
||||
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
|
||||
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"))
|
||||
{
|
||||
$("#wiki_show_mainarea_result_info").hide("blind",{},200);
|
||||
$("#wiki_show_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show details')?>");
|
||||
$("#wiki_show_mainarea_metadata_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Show metadata')?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#wiki_show_mainarea_result_info").show("blind",{},200);
|
||||
$("#wiki_show_mainarea_details_button").button(
|
||||
"option", "label", "<?php print $this->lang->line('Hide details')?>");
|
||||
$("#wiki_show_mainarea_metadata_button").button(
|
||||
"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="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 id="wiki_show_mainarea_result" class="result">
|
||||
|
@ -574,8 +574,6 @@ pre.prettyprint li.L9 { background: #eee }
|
||||
|
||||
background: #E5ECF9 none repeat scroll 0 0;
|
||||
border: #D4DBE8 1px solid;
|
||||
/*background: #DDDDDD none repeat scroll 0 0;
|
||||
border: 1px solid #CCCCCC;*/
|
||||
|
||||
margin: 0.3em 0em 0em 0em;
|
||||
padding: 0.3em 0.3em 0.3em 0.3em;
|
||||
|
@ -58,16 +58,41 @@
|
||||
}
|
||||
|
||||
#project_catalog_mainarea_result_list {
|
||||
margin: 1em;
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding: 1em;
|
||||
white-space: nowrap;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
#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
|
||||
*-----------------------------------------------*/
|
||||
@ -159,7 +184,7 @@
|
||||
border: 0;
|
||||
margin: 0;
|
||||
font-size: 0.8em;
|
||||
text-align: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#project_code_blame_mainarea_result_info .title a {
|
||||
|
@ -44,6 +44,23 @@
|
||||
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
|
||||
*-----------------------------------------------*/
|
||||
|
@ -240,6 +240,7 @@ top_srcdir = @top_srcdir@
|
||||
wwwdir = $(WWWDIR)/js
|
||||
SUBDIRS = prettify
|
||||
www_DATA = \
|
||||
codepot.js \
|
||||
creole.js \
|
||||
jquery.min.js \
|
||||
jquery-ui.min.js \
|
||||
|
@ -312,6 +312,76 @@ function codepot_sprintf() {
|
||||
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: '<a href='test'>Test</a>'
|
||||
// example 2: htmlspecialchars("ab\"c'd", ['ENT_NOQUOTES', 'ENT_QUOTES']);
|
||||
// returns 2: 'ab"c'd'
|
||||
// example 3: htmlspecialchars('my "&entity;" is still here', null, null, false);
|
||||
// returns 3: 'my "&entity;" 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, '&');
|
||||
}
|
||||
string = string.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
|
||||
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, ''');
|
||||
}
|
||||
if (!noquotes) {
|
||||
string = string.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
function codepot_ascii_to_hex (x)
|
||||
{
|
||||
var r="";
|
||||
|
Loading…
Reference in New Issue
Block a user