Skip to content
Snippets Groups Projects
Commit 15009344 authored by Kelli Shaver's avatar Kelli Shaver
Browse files

cleaning up category view, and faq list view in SCP

parent 48722426
No related branches found
No related tags found
No related merge requests found
......@@ -3,59 +3,51 @@ if(!defined('OSTSTAFFINC') || !$thisstaff) die('Access Denied');
?>
<h2>Frequently Asked Questions</h2>
<form id="kbSearch" action="kb.php" method="get" style="padding-top:15px;">
<form id="kbSearch" action="kb.php" method="get">
<input type="hidden" name="a" value="search">
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="440">
<input id="query" type="text" size="20" name="q" value="<?php echo Format::htmlchars($_REQUEST['q']); ?>">
<select name="cid">
<option value="">&mdash; All Categories &mdash;</option>
<?php
$sql='SELECT category_id, name, count(faq.category_id) as faqs '
.' FROM '.FAQ_CATEGORY_TABLE.' cat '
.' LEFT JOIN '.FAQ_TABLE.' faq USING(category_id) '
.' GROUP BY cat.category_id '
.' HAVING faqs>0 '
.' ORDER BY cat.name DESC ';
if(($res=db_query($sql)) && db_num_rows($res)) {
while($row=db_fetch_array($res))
echo sprintf('<option value="%d" %s>%s (%d)</option>',
$row['category_id'],
($_REQUEST['cid'] && $row['category_id']==$_REQUEST['cid']?'selected="selected"':''),
$row['name'],
$row['faqs']);
}
?>
</select>
</td>
<td width="100" rowspan="2">
<input id="searchSubmit" type="submit" value="Search">
</td>
</tr>
<tr>
<td width="400">
<select name="topicId" style="width:350px;">
<option value="">&mdash; All Help Topics &mdash;</option>
<?php
$sql='SELECT ht.topic_id, ht.topic, count(faq.topic_id) as faqs '
.' FROM '.TOPIC_TABLE.' ht '
.' LEFT JOIN '.FAQ_TOPIC_TABLE.' faq USING(topic_id) '
.' GROUP BY ht.topic_id '
.' HAVING faqs>0 '
.' ORDER BY ht.topic DESC ';
if(($res=db_query($sql)) && db_num_rows($res)) {
while($row=db_fetch_array($res))
echo sprintf('<option value="%d" %s>%s (%d)</option>',
$row['topic_id'],
($_REQUEST['topicId'] && $row['topic_id']==$_REQUEST['cid']?'selected="selected"':''),
$row['topic'], $row['faqs']);
}
?>
</select>
</td>
</tr>
</table>
<div>
<input id="query" type="text" size="20" name="q" value="<?php echo Format::htmlchars($_REQUEST['q']); ?>">
<select name="cid" id="cid">
<option value="">&mdash; All Categories &mdash;</option>
<?php
$sql='SELECT category_id, name, count(faq.category_id) as faqs '
.' FROM '.FAQ_CATEGORY_TABLE.' cat '
.' LEFT JOIN '.FAQ_TABLE.' faq USING(category_id) '
.' GROUP BY cat.category_id '
.' HAVING faqs>0 '
.' ORDER BY cat.name DESC ';
if(($res=db_query($sql)) && db_num_rows($res)) {
while($row=db_fetch_array($res))
echo sprintf('<option value="%d" %s>%s (%d)</option>',
$row['category_id'],
($_REQUEST['cid'] && $row['category_id']==$_REQUEST['cid']?'selected="selected"':''),
$row['name'],
$row['faqs']);
}
?>
</select>
<input id="searchSubmit" type="submit" value="Search">
</div>
<div>
<select name="topicId" style="width:350px;" id="topic-id">
<option value="">&mdash; All Help Topics &mdash;</option>
<?php
$sql='SELECT ht.topic_id, ht.topic, count(faq.topic_id) as faqs '
.' FROM '.TOPIC_TABLE.' ht '
.' LEFT JOIN '.FAQ_TOPIC_TABLE.' faq USING(topic_id) '
.' GROUP BY ht.topic_id '
.' HAVING faqs>0 '
.' ORDER BY ht.topic DESC ';
if(($res=db_query($sql)) && db_num_rows($res)) {
while($row=db_fetch_array($res))
echo sprintf('<option value="%d" %s>%s (%d)</option>',
$row['topic_id'],
($_REQUEST['topicId'] && $row['topic_id']==$_REQUEST['cid']?'selected="selected"':''),
$row['topic'], $row['faqs']);
}
?>
</select>
</div>
</form>
<hr>
<div>
......@@ -96,7 +88,7 @@ if($_REQUEST['q'] || $_REQUEST['cid'] || $_REQUEST['topicId']) { //Search.
echo '<div>Click on the category to browse FAQs.</div>
<ul id="kb">';
while($row=db_fetch_array($res)) {
echo sprintf('
<li>
<h4><a href="kb.php?cid=%d">%s (%d)</a> - <span>%s</span></h4>
......
......@@ -11,23 +11,23 @@ if(!defined('OSTSTAFFINC') || !$category || !$thisstaff) die('Access Denied');
<div>
<strong><?php echo $category->getName() ?></strong>
<span>(<?php echo $category->isPublic()?'Public':'Internal'; ?>)</span>
<br>
<div class="faded">&nbsp;Last updated <?php echo Format::db_daydatetime($category->getUpdateDate()); ?></div>
<time>Last updated <?php echo Format::db_daydatetime($category->getUpdateDate()); ?></time>
</div>
<p>
<div class="cat-desc">
<?php echo Format::safe_html($category->getDescription()); ?>
</p>
</div>
<?php
if($thisstaff->canManageFAQ()) {
echo sprintf('<a href="categories.php?id=%d" class="Icon editCategory">Edit Category</a>
| <a href="categories.php" class="Icon deleteCategory">Delete Category</a>
| <a href="faq.php?cid=%d&a=add" class="Icon newFAQ">Add New FAQ</a>',
echo sprintf('<div class="cat-manage-bar"><a href="categories.php?id=%d" class="Icon editCategory">Edit Category</a>
<a href="categories.php" class="Icon deleteCategory">Delete Category</a>
<a href="faq.php?cid=%d&a=add" class="Icon newFAQ">Add New FAQ</a></div>',
$category->getId(),
$category->getId());
}
} else {
?>
<hr>
<?php
}
$sql='SELECT faq.faq_id, question, ispublished, count(attach.file_id) as attachments '
.' FROM '.FAQ_TABLE.' faq '
......@@ -39,7 +39,7 @@ if(($res=db_query($sql)) && db_num_rows($res)) {
<ol>';
while($row=db_fetch_array($res)) {
echo sprintf('
<li><a href="faq.php?id=%d" class="previewfaq">%s</a> - <span>%s</span></li>',
<li><a href="faq.php?id=%d" class="previewfaq">%s <span>- %s</span></a></li>',
$row['faq_id'],$row['question'],$row['ispublished']?'Published':'Internal');
}
echo ' </ol>
......
......@@ -1020,34 +1020,84 @@ h2 .reload {
line-height:24px;
}
/* Knowledgebase */
/* Knowledgebase */
#kb {
margin: 2px 0;
padding: 0;
padding: 5px;
overflow: hidden;
}
#kb > li {
margin: 0 0 5px 0;
padding: 0 10px;
width: auto;
float: left;
clear: both;
#kb li {
padding:10px 10px 10px 46px;
height:auto !important;
overflow:hidden;
margin:0;
background-image:url(../images/kb_large_folder.png), url(../images/kb_category_bg.png);
background-position:0 50%, bottom left;
background-repeat:no-repeat, repeat-x;
border-bottom:1px solid #ddd;
}
#kb > li h4 {
#kb li h4 {
padding-bottom:3px;
margin-bottom:3px;
margin:0 0 3px 0;
}
#kb > li h4 span {
#kb li h4 span {
color:#666;
font-weight:normal;
}
#kb > li h4 a {
#kb li h4 a {
font-size: 14px;
}
#kbSearch {
padding:10px 0;
overflow:hidden;
}
#kbSearch div {
clear:both;
overflow:hidden;
padding-top:5px;
}
#kbSearch #query {
margin:0;
display:inline-block;
float:left;
width:200px;
margin-right:5px;
}
#kbSearch #cid {
margin:0;
display:inline-block;
float:left;
width:200px;
margin-right:5px;
position:relative;
top:2px;
}
#kbSearch #topic-id {
margin:0;
display:inline-block;
float:left;
width:410px;
}
#kbSearch #searchSubmit {
margin:0;
display:inline-block;
float:left;
position:relative;
top:2px;
}
#faq {
clear: both;
margin: 0;
......@@ -1060,13 +1110,48 @@ h2 .reload {
}
#faq ol li {
list-style: none;
margin: 0 0 10px 0;
margin: 0;
padding:5px 0;
color: #999;
border-bottom:1px solid #ddd;
}
#faq ol li a {
display: inline;
height: 16px;
font-size:13px;
line-height: 16px;
padding-left: 24px;
background: url('../images/icons/page.png') 0 50% no-repeat;
}
#faq ol li a span {
font-weight:normal;
color:#777;
}
#faq ol li:hover {
background-color:#e9f5ff;
}
time {
display:inline-block;
float:right;
color:#777;
}
.cat-desc {
padding-top:5px;
padding-bottom:25px;
}
.cat-manage-bar {
background:#e3f5ff;
padding:5px;
border-bottom:1px solid #777;
}
.cat-manage-bar a {
display:inline-block;
margin-right:20px;
}
\ No newline at end of file
scp/images/kb_category_bg.png

937 B

scp/images/kb_large_folder.png

2.47 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment