mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 23:11:59 +01:00
added a gui item for managing automated searches
This commit is contained in:
parent
3d472205b6
commit
e49704fac7
@ -8,11 +8,13 @@ $page = 0;
|
||||
$sort = "date";
|
||||
$order = 0;
|
||||
$dry_run = 0;
|
||||
$auto_search = 0;
|
||||
|
||||
$opts = 'w:s:dyh';
|
||||
$opts = 'w:s:dayh';
|
||||
$lopts = array(
|
||||
'webui:',
|
||||
'search:',
|
||||
'auto',
|
||||
'dry-run',
|
||||
'yesterday',
|
||||
'help'
|
||||
@ -36,16 +38,33 @@ if(isset($options['webui']))
|
||||
display_help();
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($options['search']))
|
||||
|
||||
if(isset($options['auto']) || isset($options['a']) )
|
||||
{
|
||||
$search_expression = $options['search'];
|
||||
} else {
|
||||
print "\nError: must provide a search expression\n\n";
|
||||
display_help();
|
||||
exit;
|
||||
$auto_search = 1;
|
||||
}
|
||||
|
||||
if($auto_search == 0)
|
||||
{
|
||||
if(isset($options['search']))
|
||||
{
|
||||
$search_expression = $options['search'];
|
||||
} else {
|
||||
print "\nError: must provide a search expression\n\n";
|
||||
display_help();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(isset($options['search']))
|
||||
{
|
||||
print "\nError: don't specify BOTH --search AND --auto\n\n";
|
||||
display_help();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(isset($options['dry-run']) || isset($options['d']) )
|
||||
{
|
||||
$dry_run = 1;
|
||||
@ -148,55 +167,83 @@ $data = array(
|
||||
|
||||
$loader->model('search/search');
|
||||
$loader->model('search/message');
|
||||
$loader->model('search/auto');
|
||||
$loader->model('mail/mail');
|
||||
|
||||
$search = new ModelSearchSearch();
|
||||
$mail = new ModelMailMail();
|
||||
|
||||
$a = $search->preprocess_post_expert_request($data);
|
||||
|
||||
if(isset($options['yesterday']) || isset($options['y']) )
|
||||
if($auto_search == 1)
|
||||
{
|
||||
$a['date1'] = $a['date2'] = date("Y.m.d", time() - 86400);
|
||||
}
|
||||
$sa = new ModelSearchAuto();
|
||||
|
||||
list ($n, $total_found, $all_ids, $messages) = $search->search_messages($a, $page);
|
||||
$queries = $sa->get();
|
||||
|
||||
if($dry_run == 0)
|
||||
{
|
||||
$msg = "From: " . SMTP_FROMADDR . EOL;
|
||||
$msg .= "To: " . ADMIN_EMAIL . EOL;
|
||||
$msg .= "Subject: =?UTF-8?Q?" . preg_replace("/\n/", "", my_qp_encode($title)) . "?=" . EOL;
|
||||
$msg .= "Message-ID: <" . generate_random_string(25) . '@' . SITE_NAME . ">" . EOL;
|
||||
$msg .= "MIME-Version: 1.0" . EOL;
|
||||
$msg .= "Content-Type: text/html; charset=\"utf-8\"" . EOL;
|
||||
$msg .= EOL . EOL;
|
||||
foreach ($queries as $query) {
|
||||
$data['search'] = $query['query'];
|
||||
|
||||
ob_start();
|
||||
include($webuidir . "/view/theme/default/templates/search/auto.tpl");
|
||||
$msg .= ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
$x = $mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $automated_search_recipients, $msg);
|
||||
do_search($data, $automated_search_recipients);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "search = $search_expression\n";
|
||||
print_r($all_ids);
|
||||
print EOL;
|
||||
do_search($data, $automated_search_recipients);
|
||||
}
|
||||
|
||||
function do_search($data = array(), $automated_search_recipients = array())
|
||||
{
|
||||
global $options;
|
||||
global $dry_run;
|
||||
global $webuidir;
|
||||
|
||||
$search = new ModelSearchSearch();
|
||||
$mail = new ModelMailMail();
|
||||
|
||||
$a = $search->preprocess_post_expert_request($data);
|
||||
|
||||
if(isset($options['yesterday']) || isset($options['y']) )
|
||||
{
|
||||
$a['date1'] = $a['date2'] = date("Y.m.d", time() - 86400);
|
||||
}
|
||||
|
||||
list ($n, $total_found, $all_ids, $messages) = $search->search_messages($a, 0);
|
||||
|
||||
if($dry_run == 0)
|
||||
{
|
||||
$msg = "From: " . SMTP_FROMADDR . EOL;
|
||||
$msg .= "To: " . ADMIN_EMAIL . EOL;
|
||||
$msg .= "Subject: =?UTF-8?Q?" . preg_replace("/\n/", "", my_qp_encode($title)) . "?=" . EOL;
|
||||
$msg .= "Message-ID: <" . generate_random_string(25) . '@' . SITE_NAME . ">" . EOL;
|
||||
$msg .= "MIME-Version: 1.0" . EOL;
|
||||
$msg .= "Content-Type: text/html; charset=\"utf-8\"" . EOL;
|
||||
$msg .= EOL . EOL;
|
||||
|
||||
ob_start();
|
||||
include($webuidir . "/view/theme/default/templates/search/auto.tpl");
|
||||
$msg .= ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
$x = $mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $automated_search_recipients, $msg);
|
||||
}
|
||||
else {
|
||||
print "search = " . $data['search'] . "\n";
|
||||
print_r($all_ids);
|
||||
print EOL . EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function display_help() {
|
||||
$phpself = basename(__FILE__);
|
||||
|
||||
echo("\nUsage: $phpself --webui [PATH] --search '[SEARCH EXPRESSION]' [OPTIONS...]\n\n");
|
||||
echo("\nUsage: $phpself [OPTIONS...] --webui [PATH] --search '[SEARCH EXPRESSION]' | --auto\n\n");
|
||||
echo("\nThe results go to the recipients defined in \$automated_search_recipients, see config-site.php\n\n");
|
||||
|
||||
echo("\t--webui=\"[REQUIRED: path to the piler webui directory]\"\n");
|
||||
echo("\t--search=\"[REQUIRED: the search expression]\"\n\n");
|
||||
echo("\t--search=\"[REQUIRED (unless you specify --auto): the search expression]\"\n\n");
|
||||
echo("options:\n");
|
||||
echo("\t-a | --auto: Perform an automated search based on queries defined via the piler gui\n");
|
||||
echo("\t-y | --yesterday: Search \"yesterday\"\n");
|
||||
echo("\t-d | --dry-run: Only print the found IDs\n");
|
||||
echo("\t-h | --help: Prints this help screen and exits\n");
|
||||
|
@ -411,3 +411,8 @@ create table if not exists `import` (
|
||||
) Engine=InnoDB;
|
||||
|
||||
|
||||
create table if not exists `autosearch` (
|
||||
`id` int not null auto_increment primary key,
|
||||
`query` varchar(512) not null
|
||||
) Engine=InnoDB;
|
||||
|
||||
|
@ -29,3 +29,10 @@ alter table ldap add column ldap_distributionlist_objectclass varchar(128) defau
|
||||
alter table google change column id id char(32) not null primary key;
|
||||
alter table google_imap change column id id char(32) not null primary key;
|
||||
|
||||
|
||||
create table if not exists `autosearch` (
|
||||
`id` int not null auto_increment primary key,
|
||||
`query` varchar(512) not null
|
||||
) Engine=InnoDB;
|
||||
|
||||
|
||||
|
@ -331,6 +331,7 @@ define('TABLE_ONLINE', 'online');
|
||||
define('TABLE_IMPORT', 'import');
|
||||
define('TABLE_GOOGLE', 'google');
|
||||
define('TABLE_GOOGLE_IMAP', 'google_imap');
|
||||
define('TABLE_AUTOSEARCH', 'autosearch');
|
||||
define('VIEW_MESSAGES', 'v_messages');
|
||||
|
||||
define('EOL', "\n");
|
||||
|
117
webui/controller/search/autosearch.php
Normal file
117
webui/controller/search/autosearch.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerSearchAutosearch extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "search/autosearch.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$ldap_id = 0;
|
||||
|
||||
|
||||
$this->load->model('search/auto');
|
||||
|
||||
$this->document->title = $this->data['text_automated_search'];
|
||||
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$this->data['page'] = 0;
|
||||
$this->data['page_len'] = get_page_length();
|
||||
|
||||
$this->data['total'] = 0;
|
||||
|
||||
$this->data['domains'] = array();
|
||||
|
||||
/* get search term if there's any */
|
||||
|
||||
$this->data['search'] = '';
|
||||
|
||||
$this->data['remove'] = 0;
|
||||
$this->data['removed_query'] = '';
|
||||
|
||||
if(isset($this->request->post['search'])) { $this->data['search'] = $this->request->post['search']; }
|
||||
else if(isset($this->request->get['search'])) { $this->data['search'] = $this->request->get['search']; }
|
||||
|
||||
|
||||
|
||||
/* get page */
|
||||
|
||||
if(isset($this->request->get['page']) && is_numeric($this->request->get['page']) && $this->request->get['page'] > 0) {
|
||||
$this->data['page'] = $this->request->get['page'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->validate() == true) {
|
||||
if($this->model_search_auto->add($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_added'];
|
||||
} else {
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_add'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->data['errorstring'] = $this->data['text_error_message'];
|
||||
$this->data['errors'] = $this->error;
|
||||
$this->data['post'] = $this->request->post;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($this->request->get['remove']) && $this->request->get['remove'] == 1 && $this->request->get['id'] > 0) {
|
||||
$this->model_search_auto->remove($this->request->get['id']);
|
||||
|
||||
$this->data['remove'] = 1;
|
||||
$this->data['removed_query'] = $this->request->get['name'];
|
||||
}
|
||||
|
||||
|
||||
$this->data['data'] = $this->model_search_auto->get($this->data['search']);
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
||||
|
||||
$this->data['prev_page'] = $this->data['page'] - 1;
|
||||
$this->data['next_page'] = $this->data['page'] + 1;
|
||||
|
||||
$this->data['total'] = floor(count($this->data['data']) / $this->data['page_len']);
|
||||
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
private function validate() {
|
||||
|
||||
if(!isset($this->request->post['query']) || strlen($this->request->post['query']) < 3) {
|
||||
$this->data['text_field_length'] = str_replace("?",3,$this->data['text_field_length']);
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -472,5 +472,9 @@ $_['text_refresh_qr_code'] = "Refresh QR code";
|
||||
$_['text_print_message'] = "Print";
|
||||
$_['text_forward_selected_emails_to'] = "Forward selected emails to";
|
||||
$_['text_search_expression'] = "Search expression";
|
||||
$_['text_automated_search'] = "Automated search";
|
||||
$_['text_delete_confirm_message'] = "Do you wish to delete";
|
||||
$_['text_existing'] = "Existing";
|
||||
$_['text_new'] = "new";
|
||||
|
||||
?>
|
||||
|
@ -31,6 +31,7 @@ $_['text_attachment_name'] = "Attachment name";
|
||||
$_['text_attachment_size'] = "Attachment size";
|
||||
$_['text_attachment_type'] = "Attachment type";
|
||||
$_['text_audit'] = "Audit";
|
||||
$_['text_automated_search'] = "Automated search";
|
||||
|
||||
$_['text_back'] = "Back";
|
||||
$_['text_background_colour'] = "Background colour";
|
||||
@ -75,6 +76,7 @@ $_['text_days_to_retain'] = "Days to retain";
|
||||
$_['text_deferred_queue'] = "deferred queue";
|
||||
$_['text_deferred_queue_sender'] = "deferred queue vs. sender";
|
||||
$_['text_delay'] = "Delay";
|
||||
$_['text_delete_confirm_message'] = "Do you wish to delete";
|
||||
$_['text_deleted_users'] = "deleted";
|
||||
$_['text_deliver'] = "Deliver";
|
||||
$_['text_delivered'] = "Delivered";
|
||||
@ -116,6 +118,7 @@ $_['text_enter_search_terms'] = "Enter your search terms";
|
||||
$_['text_error'] = "Error";
|
||||
$_['text_exact_domain_name_or_email_address'] = "exact domain name or email address";
|
||||
$_['text_exclude'] = "Exclude";
|
||||
$_['text_existing'] = "Existing";
|
||||
$_['text_existing_domains'] = "Existing domains";
|
||||
$_['text_existing_email'] = "Existing email";
|
||||
$_['text_existing_folders'] = "Existing folders";
|
||||
@ -219,6 +222,7 @@ $_['text_monitor'] = "Monitor";
|
||||
$_['text_months'] = "months";
|
||||
$_['text_monthly_report'] = "Monthly report";
|
||||
|
||||
$_['text_new'] = "new";
|
||||
$_['text_new_users'] = "new";
|
||||
$_['text_next'] = "Next";
|
||||
$_['text_no_domain_found'] = 'No domain found';
|
||||
|
@ -471,5 +471,9 @@ $_['text_refresh_qr_code'] = "Refresh QR code";
|
||||
$_['text_print_message'] = "Print";
|
||||
$_['text_forward_selected_emails_to'] = "Forward selected emails to";
|
||||
$_['text_search_expression'] = "Search expression";
|
||||
$_['text_automated_search'] = "Automated search";
|
||||
$_['text_delete_confirm_message'] = "Do you wish to delete";
|
||||
$_['text_existing'] = "Existing";
|
||||
$_['text_new'] = "new";
|
||||
|
||||
?>
|
||||
|
@ -31,6 +31,7 @@ $_['text_attachment_name'] = "Mell
|
||||
$_['text_attachment_size'] = "Melléklet méret";
|
||||
$_['text_attachment_type'] = "Melléklet típus";
|
||||
$_['text_audit'] = "Audit";
|
||||
$_['text_automated_search'] = "Automatikus keresés";
|
||||
|
||||
$_['text_back'] = "Vissza";
|
||||
$_['text_background_colour'] = "Háttérszín";
|
||||
@ -75,6 +76,7 @@ $_['text_days_to_retain'] = "Meg
|
||||
$_['text_deferred_queue'] = "késõbbi kiküldésre váró üzenetsor";
|
||||
$_['text_deferred_queue_sender'] = "késõbbi kiküldésre váró üzenetsor (feladó szerint)";
|
||||
$_['text_delay'] = "Késleltetés";
|
||||
$_['text_delete_confirm_message'] = "Törölni akarja";
|
||||
$_['text_deleted_users'] = "törölt";
|
||||
$_['text_deliver'] = "Kézbesítés";
|
||||
$_['text_delivered'] = "Kézbesített";
|
||||
@ -117,6 +119,7 @@ $_['text_enter_search_terms'] = "
|
||||
$_['text_error'] = "Hiba";
|
||||
$_['text_exact_domain_name_or_email_address'] = "pontos domainnév vagy email cím";
|
||||
$_['text_exclude'] = "Kihagy";
|
||||
$_['text_existing'] = "Létező";
|
||||
$_['text_existing_domains'] = "Létezõ domainek";
|
||||
$_['text_existing_email'] = "Létezõ email";
|
||||
$_['text_existing_entries'] = "Jelenlegi bejegyzések";
|
||||
@ -220,6 +223,7 @@ $_['text_monitor'] = "Monitor";
|
||||
$_['text_months'] = "hónap";
|
||||
$_['text_monthly_report'] = "Havi jelentés";
|
||||
|
||||
$_['text_new'] = "új";
|
||||
$_['text_new_users'] = "új";
|
||||
$_['text_next'] = "Következõ";
|
||||
$_['text_no_domain_found'] = 'Nem találtam domaineket';
|
||||
|
@ -31,6 +31,7 @@ $_['text_attachment_name'] = "Melléklet név";
|
||||
$_['text_attachment_size'] = "Melléklet méret";
|
||||
$_['text_attachment_type'] = "Melléklet típus";
|
||||
$_['text_audit'] = "Audit";
|
||||
$_['text_automated_search'] = "Automatikus keresés";
|
||||
|
||||
$_['text_back'] = "Vissza";
|
||||
$_['text_background_colour'] = "Háttérszín";
|
||||
@ -75,6 +76,7 @@ $_['text_days_to_retain'] = "Megőrzési idő (nap)";
|
||||
$_['text_deferred_queue'] = "későbbi kiküldésre váró üzenetsor";
|
||||
$_['text_deferred_queue_sender'] = "későbbi kiküldésre váró üzenetsor (feladó szerint)";
|
||||
$_['text_delay'] = "Késleltetés";
|
||||
$_['text_delete_confirm_message'] = "Törölni akarja";
|
||||
$_['text_deleted_users'] = "törölt";
|
||||
$_['text_deliver'] = "Kézbesítés";
|
||||
$_['text_delivered'] = "Kézbesített";
|
||||
@ -117,6 +119,7 @@ $_['text_enter_search_terms'] = "Írja be a keresési feltételeket";
|
||||
$_['text_error'] = "Hiba";
|
||||
$_['text_exact_domain_name_or_email_address'] = "pontos domainnév vagy email cím";
|
||||
$_['text_exclude'] = "Kihagy";
|
||||
$_['text_existing'] = "Létező";
|
||||
$_['text_existing_domains'] = "Létező domainek";
|
||||
$_['text_existing_email'] = "Létező email";
|
||||
$_['text_existing_entries'] = "Jelenlegi bejegyzések";
|
||||
@ -220,6 +223,7 @@ $_['text_monitor'] = "Monitor";
|
||||
$_['text_months'] = "hónap";
|
||||
$_['text_monthly_report'] = "Havi jelentés";
|
||||
|
||||
$_['text_new'] = "új";
|
||||
$_['text_new_users'] = "új";
|
||||
$_['text_next'] = "Következő";
|
||||
$_['text_no_domain_found'] = 'Nem találtam domaineket';
|
||||
|
@ -461,5 +461,9 @@ $_['text_qr_code'] = "QR";
|
||||
$_['text_refresh_qr_code'] = "Renovar código QR";
|
||||
$_['text_forward_selected_emails_to'] = "Forward selected emails to";
|
||||
$_['text_search_expression'] = "Search expression";
|
||||
$_['text_automated_search'] = "Automated search";
|
||||
$_['text_delete_confirm_message'] = "Do you wish to delete";
|
||||
$_['text_existing'] = "Existing";
|
||||
$_['text_new'] = "new";
|
||||
|
||||
?>
|
||||
|
51
webui/model/search/auto.php
Normal file
51
webui/model/search/auto.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class ModelSearchAuto extends Model {
|
||||
|
||||
|
||||
|
||||
public function get($s = '') {
|
||||
$data = array();
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_AUTOSEARCH . " ORDER BY id ASC");
|
||||
|
||||
if(isset($query->rows)) {
|
||||
foreach($query->rows as $q) {
|
||||
|
||||
$data[] = array('id' => $q['id'], 'query' => $q['query']);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function add($data = array()) {
|
||||
if(!isset($data['query'])) { return 0; }
|
||||
|
||||
$query = $this->db->query("INSERT INTO " . TABLE_AUTOSEARCH . " (query) VALUES (?)", array($data['query']));
|
||||
$rc = $this->db->countAffected();
|
||||
|
||||
LOGGER("add new automated search query: " . $data['query'] . " (rc=$rc)");
|
||||
|
||||
return $rc;
|
||||
}
|
||||
|
||||
|
||||
public function remove($id = 0) {
|
||||
if($id == 0) { return 0; }
|
||||
|
||||
$query = $this->db->query("DELETE FROM " . TABLE_AUTOSEARCH . " WHERE id=?", array($id));
|
||||
|
||||
$rc = $this->db->countAffected();
|
||||
|
||||
LOGGER("remove autosearch: $id (rc=$rc)");
|
||||
|
||||
return $rc;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -48,6 +48,8 @@ if(isset($this->request->get['route'])) {
|
||||
<?php print $menu; ?>
|
||||
</div>
|
||||
|
||||
<div id="messagebox1" class="alert alert-info lead"></div>
|
||||
|
||||
<div id="piler1" class="container">
|
||||
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
<?php } ?>
|
||||
<li><a href="index.php?route=policy/archiving"><i class="icon-folder-open"></i> <?php print $text_archiving_rules; ?></a></li>
|
||||
<li><a href="index.php?route=policy/retention"><i class="icon-time"></i> <?php print $text_retention_rules; ?></a></li>
|
||||
<li><a href="index.php?route=search/autosearch"><i class="icon-search"></i> <?php print $text_automated_search; ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
79
webui/view/theme/default/templates/search/autosearch.tpl
Normal file
79
webui/view/theme/default/templates/search/autosearch.tpl
Normal file
@ -0,0 +1,79 @@
|
||||
<div id="deleteconfirm-modal" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
|
||||
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php print $text_delete_confirm_message; ?> <span id="name">ERROR</span>?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
|
||||
<a href="index.php?route=search/autosearch&remove=1&id=-1&&confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--form method="get" name="search1" action="index.php?route=search/autosearch" class="form-inline pull-right">
|
||||
<div class="input-append">
|
||||
<input type="text" name="search" class="input-medium" value="<?php print $search; ?>" />
|
||||
<input type="submit" class="btn" value="<?php print $text_search; ?>" />
|
||||
</div>
|
||||
</form-->
|
||||
|
||||
<h4><?php print $text_new; ?></h4>
|
||||
|
||||
<?php if(isset($errorstring)){ ?><div class="alert alert-danger"><?php print $text_error; ?>: <?php print $errorstring; ?></div><?php } ?>
|
||||
<?php if(isset($x)){ ?>
|
||||
<div class="alert alert-success"><?php print $x; ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<form method="post" name="add1" action="index.php?route=search/autosearch" class="form-horizontal">
|
||||
|
||||
<div class="control-group<?php if(isset($errors['mapped'])){ print " error"; } ?>">
|
||||
<label class="control-label" for="mapped"><?php print $text_search; ?>:</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="text span6" name="query" placeholder="Search query"<?php if(isset($post['query'])){ echo " value='".$post['query']."'"; } ?> />
|
||||
<?php if ( isset($errors['query']) ) { ?><span class="help-inline"><?php print $errors['query']; ?></span><?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?php print $text_add; ?>" class="btn btn-primary" />
|
||||
<input type="reset" value="<?php print $text_clear; ?>" class="btn" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<h4><?php print $text_existing; ?></h4>
|
||||
|
||||
<div class="listarea">
|
||||
|
||||
<?php if(isset($data) && count($data) > 0){ ?>
|
||||
|
||||
<table id="ss1" class="table table-striped table-condensed">
|
||||
<tr>
|
||||
<th><?php print $text_search; ?></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
|
||||
<?php foreach($data as $d) { ?>
|
||||
<tr>
|
||||
<td><?php print $d['query']; ?></td>
|
||||
<td><a href="index.php?route=search/autosearch&remove=1&id=<?php print $d['id']; ?>&query=<?php print urlencode($d['query']); ?>" class="confirm-delete" data-id="<?php print $d['id']; ?>" data-name="<?php print $d['query']; ?>"><i class="icon-remove-sign"></i> <?php print $text_remove; ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<div class="alert alert-error lead">
|
||||
<?php print $text_not_found; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if($remove == 1) { ?>
|
||||
<script>Piler.show_message('messagebox1', '<?php print $text_successfully_removed; ?>', 0.85);</script>
|
||||
<?php } ?>
|
||||
|
@ -41,6 +41,8 @@ if(isset($this->request->get['route'])) {
|
||||
|
||||
} ?>>
|
||||
|
||||
<div id="messagebox1"></div>
|
||||
|
||||
<div id="piler1" class="container">
|
||||
|
||||
<div id="menu">
|
||||
|
@ -37,6 +37,7 @@
|
||||
<?php } ?>
|
||||
<li><a href="index.php?route=policy/archiving"><?php print $text_archiving_rules; ?></a></li>
|
||||
<li><a href="index.php?route=policy/retention"><?php print $text_retention_rules; ?></a></li>
|
||||
<li><a href="index.php?route=search/autosearch"><?php print $text_automated_search; ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
73
webui/view/theme/mobile/templates/search/autosearch.tpl
Normal file
73
webui/view/theme/mobile/templates/search/autosearch.tpl
Normal file
@ -0,0 +1,73 @@
|
||||
<div id="deleteconfirm-modal" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
|
||||
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php print $text_delete_confirm_message; ?> <span id="name">ERROR</span>?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
|
||||
<a href="index.php?route=search/autosearch&remove=1&id=-1&domain=Error&confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--form method="get" name="search1" action="index.php?route=search/autosearch" class="form-inline pull-right">
|
||||
<div class="input-append">
|
||||
<input type="text" name="search" class="input-medium" value="<?php print $search; ?>" />
|
||||
<input type="submit" class="btn" value="<?php print $text_search; ?>" />
|
||||
</div>
|
||||
</form-->
|
||||
|
||||
<h4><?php print $text_new; ?></h4>
|
||||
|
||||
<form method="post" name="add1" action="index.php?route=search/autosearch" class="formbottom">
|
||||
|
||||
<div id="ss1">
|
||||
<div class="row">
|
||||
<div class="domaincell"><?php print $text_search; ?>:</div>
|
||||
<div class="domaincell"><input type="text" class="text span6" name="query" /></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell"><input type="submit" class="btn btn-primary" value="<?php print $text_add; ?>" /> <input type="reset" class="btn" value="<?php print $text_cancel; ?>" /></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<h4><?php print $text_existing; ?></h4>
|
||||
|
||||
<div class="listarea">
|
||||
|
||||
<?php if(isset($data) && count($data) > 0){ ?>
|
||||
|
||||
<div id="ss1">
|
||||
<div class="domainrow">
|
||||
<div class="domaincell"><?php print $text_search; ?></div>
|
||||
<div class="domaincell"> </div>
|
||||
</div>
|
||||
|
||||
<?php foreach($data as $d) { ?>
|
||||
<div class="domainrow">
|
||||
<div class="domaincell"><?php print $d['query']; ?></a></div>
|
||||
<div class="domaincell"><a href="index.php?route=search/autosearch&id=1&domain=<?php print urlencode($d['query']); ?>" class="confirm-delete" data-id="<?php print $d['id']; ?>" data-name="<?php print $d['query']; ?>"><i class="icon-remove-sign"></i> <?php print $text_remove; ?></a></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<?php print $text_not_found; ?>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php if($remove == 1) { ?>
|
||||
<script>Piler.show_message('messagebox1', '<?php print $text_successfully_removed; ?>', 0.85);</script>
|
||||
<?php } ?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user