diff --git a/include/class.draft.php b/include/class.draft.php index d83a47e4e7e456c97b6d0a5a072d73e2a59c1eaa..a12fbf292d06e3650c32dad6e7e510ddbda8e5a9 100644 --- a/include/class.draft.php +++ b/include/class.draft.php @@ -171,7 +171,7 @@ class Draft extends VerySimpleModel { */ static function deleteForNamespace($namespace, $staff_id=false) { $attachments = Attachment::objects() - ->filter(array('draft__namespace__like' => $namespace)); + ->filter(array('draft__namespace__startswith' => $namespace)); if ($staff_id) $attachments->filter(array('draft__staff_id' => $staff_id)); diff --git a/include/class.topic.php b/include/class.topic.php index 77e85ec442243fec663224d944c02fc90a8a8c58..9b98db058027fcbb7cee603f7f2c6a2dfc36caa3 100644 --- a/include/class.topic.php +++ b/include/class.topic.php @@ -110,7 +110,7 @@ implements TemplateVariable { } function getFullName() { - return self::getTopicName($this->getId()); + return self::getTopicName($this->getId()) ?: $this->topic; } static function getTopicName($id) { diff --git a/include/staff/faq-categories.inc.php b/include/staff/faq-categories.inc.php index d1b7316a8dcaa06c01bae05805a766790e9d961d..1faf2e74f4554875ede3bc35e57cd2d90077931b 100644 --- a/include/staff/faq-categories.inc.php +++ b/include/staff/faq-categories.inc.php @@ -2,51 +2,98 @@ if(!defined('OSTSTAFFINC') || !$thisstaff) die('Access Denied'); ?> -<h2><?php echo __('Frequently Asked Questions');?></h2> <form id="kbSearch" action="kb.php" method="get"> <input type="hidden" name="a" value="search"> - <div> - <input id="query" type="search" size="20" name="q" autofocus - value="<?php echo Format::htmlchars($_REQUEST['q']); ?>"> - <select name="cid" id="cid"> - <option value="">— <?php echo __('All Categories');?> —</option> - <?php - $categories = Category::objects() - ->annotate(array('faq_count'=>SqlAggregate::COUNT('faqs'))) - ->filter(array('faq_count__gt'=>0)) - ->order_by('name'); - foreach ($categories as $C) { - echo sprintf('<option value="%d" %s>%s (%d)</option>', - $C->getId(), - ($_REQUEST['cid'] && $C->getId()==$_REQUEST['cid']?'selected="selected"':''), - $C->getLocalName(), - $C->faq_count - ); - } ?> - </select> - <input id="searchSubmit" type="submit" value="<?php echo __('Search');?>"> - </div> - <div> - <select name="topicId" style="width:350px;" id="topic-id"> - <option value="">— <?php echo __('All Help Topics');?> —</option> - <?php - $topics = Topic::objects() - ->annotate(array('faq_count'=>SqlAggregate::COUNT('faqs'))) - ->filter(array('faq_count__gt'=>0)) - ->all(); - usort($topics, function($a, $b) { - return strcmp($a->getFullName(), $b->getFullName()); - }); - foreach ($topics as $T) { - echo sprintf('<option value="%d" %s>%s (%d)</option>', - $T->getId(), - ($_REQUEST['topicId'] && $T->getId()==$_REQUEST['topicId']?'selected="selected"':''), - $T->getFullName(), $T->faq_count); - } - ?> - </select> + <input type="hidden" name="cid" value="<?php echo Format::htmlchars($_REQUEST['cid']); ?>"/> + <input type="hidden" name="topicId" value="<?php echo Format::htmlchars($_REQUEST['topicId']); ?>"/> + + <div id="basic_search"> + <div class="attached input"> + <input id="query" type="text" size="20" name="q" autofocus + value="<?php echo Format::htmlchars($_REQUEST['q']); ?>"> + <button class="attached button" id="searchSubmit" type="submit"> + <i class="icon icon-search"></i> + </button> + </div> + + <div class="pull-right"> + <span class="action-button muted" data-dropdown="#category-dropdown"> + <i class="icon-caret-down pull-right"></i> + <span> + <i class="icon icon-filter"></i> + <?php echo __('Category'); ?> + </span> + </span> + <span class="action-button muted" data-dropdown="#topic-dropdown"> + <i class="icon-caret-down pull-right"></i> + <span> + <i class="icon icon-filter"></i> + <?php echo __('Help Topic'); ?> + </span> + </span> + </div> + + <div id="category-dropdown" class="action-dropdown anchor-right" + onclick="javascript: + var form = $(this).closest('form'); + form.find('[name=cid]').val($(event.target).data('cid')); + form.submit();"> + <ul class="bleed-left"> +<?php +$total = FAQ::objects()->count(); + +$categories = Category::objects() + ->annotate(array('faq_count' => SqlAggregate::COUNT('faqs'))) + ->filter(array('faq_count__gt' => 0)) + ->order_by('name') + ->all(); +array_unshift($categories, new Category(array('id' => 0, 'name' => __('All Categories'), 'faq_count' => $total))); +foreach ($categories as $C) { + $active = $_REQUEST['cid'] == $C->getId(); ?> + <li <?php if ($active) echo 'class="active"'; ?>> + <a href="#" data-cid="<?php echo $C->getId(); ?>"> + <i class="icon-fixed-width <?php + if ($active) echo 'icon-hand-right'; ?>"></i> + <?php echo sprintf('%s (%d)', + Format::htmlchars($C->getLocalName()), + $C->faq_count); ?></a> + </li> <?php +} ?> + </ul> + </div> + + <div id="topic-dropdown" class="action-dropdown anchor-right" + onclick="javascript: + var form = $(this).closest('form'); + form.find('[name=topicId]').val($(event.target).data('topicId')); + form.submit();"> + <ul class="bleed-left"> +<?php +$topics = Topic::objects() + ->annotate(array('faq_count'=>SqlAggregate::COUNT('faqs'))) + ->filter(array('faq_count__gt'=>0)) + ->all(); +usort($topics, function($a, $b) { + return strcmp($a->getFullName(), $b->getFullName()); +}); +array_unshift($topics, new Topic(array('id' => 0, 'topic' => __('All Topics'), 'faq_count' => $total))); +foreach ($topics as $T) { + $active = $_REQUEST['topicId'] == $T->getId(); ?> + <li <?php if ($active) echo 'class="active"'; ?>> + <a href="#" data-topic-id="<?php echo $T->getId(); ?>"> + <i class="icon-fixed-width <?php + if ($active) echo 'icon-hand-right'; ?>"></i> + <?php echo sprintf('%s (%d)', + Format::htmlchars($T->getFullName()), + $T->faq_count); ?></a> + </li> <?php +} ?> + </ul> + </div> + </div> </form> +<h2><?php echo __('Frequently Asked Questions');?></h2> <hr> <div> <?php diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 1728c48035058a9df65dbbb72723e5a39f7a7852..51e1fe1289ca4621fb5f54a5fd20735e31d65c56 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -917,7 +917,9 @@ $tcount = $ticket->getThreadEntries($types)->count(); <input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>"> <fieldset class="notes"> <label class="fixed-size" for="notes"><?php echo __('Print Notes');?>:</label> + <label class="inline checkbox"> <input type="checkbox" id="notes" name="notes" value="1"> <?php echo __('Print <b>Internal</b> Notes/Comments');?> + </label> </fieldset> <fieldset> <label class="fixed-size" for="psize"><?php echo __('Paper Size');?>:</label> diff --git a/scp/css/scp.css b/scp/css/scp.css index fe2cc992446b895cf36363189db106ea159031a5..a71a023879270907372cdc8dcdfc36736a3dec66 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1467,48 +1467,13 @@ h2 > i.help-tip { } #kbSearch { - padding:10px 0; - overflow:hidden; -} - -#kbSearch div { - clear:both; - overflow:hidden; - padding:5px 0 2px 3px; + margin-bottom: 1em; } #kbSearch #query { - margin:1px 5px 0 0; - display:inline-block; - float:left; width:200px; } -#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;