added pop3 import to the gui

This commit is contained in:
SJ
2013-08-23 13:02:51 +02:00
parent d7faf096f1
commit eb826537dd
30 changed files with 1010 additions and 24 deletions

View File

@ -969,6 +969,26 @@ var Piler =
},
test_pop3_connection:function()
{
Piler.log("[test_pop3_connection]");
jQuery.ajax('index.php?route=import/test', {
data: {
type: $('#type').val(),
server: $('#server').val(),
username: $('#username').val(),
password: $('#password').val()
},
type: "POST"
})
.done( function(a) {
$('#LDAPTEST').html(a);
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
},
clear_ldap_test: function()
{
$('#LDAPTEST').html('');

View File

@ -38,6 +38,7 @@ if(isset($this->request->get['route'])) {
if($this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'stat/online') { ?> onload="setInterval('Piler.reload_page()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'import/jobs') { ?> onload="setInterval('Piler.reload_page()', 10 * 1000);"<?php }
} ?>>

View File

@ -37,6 +37,7 @@
<?php if(ENABLE_SAAS == 1) { ?>
<li><a href="index.php?route=ldap/list"><i class="icon-key"></i>&nbsp;<?php print $text_ldap; ?></a></li>
<li><a href="index.php?route=customer/list"><i class="icon-wrench"></i>&nbsp;<?php print $text_customers; ?></a></li>
<li><a href="index.php?route=import/list"><i class="icon-lightbulb"></i>&nbsp;<?php print $text_import; ?></a></li>
<?php } ?>
<li><a href="index.php?route=policy/archiving"><i class="icon-folder-open"></i>&nbsp;<?php print $text_archiving_rules; ?></a></li>
<li><a href="index.php?route=policy/retention"><i class="icon-time"></i>&nbsp;<?php print $text_retention_rules; ?></a></li>

View File

@ -0,0 +1,61 @@
<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_import_job_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=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<?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 } ?>
<?php if($id == -1) { ?>
<h4><?php print $text_progress; ?></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_server_name; ?></td>
<th><?php print $text_progress; ?></td>
<th><?php print $text_status; ?></td>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td><?php print $e['server']; ?></td>
<td><?php print $e['imported']; ?> / <?php print $e['total']; ?></td>
<td><?php print $import_status[$e['status']]; ?></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,104 @@
<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_import_job_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=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<h4><?php if(isset($id) && ($id > 0)) { print $text_edit_entry; } else { print $text_add_new_entry; } ?></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=import/list" class="form-horizontal">
<?php if(isset($id) && ($id > 0)) { ?>
<input type="hidden" name="id" id="id" value="<?php print $id; ?>" />
<?php } ?>
<input type="hidden" name="type" id="type" value="pop3" />
<div class="control-group<?php if(isset($errors['server'])){ print " error"; } ?>">
<label class="control-label" for="server"><?php print $text_server_name; ?>:</label>
<div class="controls">
<input type="text" class="text" name="server" id="server" placeholder="" value="<?php if(isset($a['server'])) { print $a['server']; } ?>" />
<?php if ( isset($errors['server']) ) { ?><span class="help-inline"><?php print $errors['server']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['username'])){ print " error"; } ?>">
<label class="control-label" for="username"><?php print $text_username; ?>:</label>
<div class="controls">
<input type="text" class="text" name="username" id="username" placeholder="" value="<?php if(isset($a['username'])) { print $a['username']; } ?>" />
<?php if ( isset($errors['username']) ) { ?><span class="help-inline"><?php print $errors['username']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['password'])){ print " error"; } ?>">
<label class="control-label" for="password"><?php print $text_password; ?>:</label>
<div class="controls">
<input type="password" class="password" name="password" id="password" placeholder="" value="<?php if(isset($a['password'])) { print $a['password']; } ?>" /> <input type="button" value="<?php print $text_test_connection; ?>" class="btn btn-danger" onclick="Piler.test_pop3_connection(); return false;" /> <span id="LDAPTEST"></span>
<?php if ( isset($errors['password']) ) { ?><span class="help-inline"><?php print $errors['password']; ?></span><?php } ?>
</div>
</div>
<div class="form-actions">
<input type="submit" value="<?php if(isset($id) && ($id > 0)) { print $text_modify; } else { print $text_add; } ?>" class="btn btn-primary" />
<?php if(isset($id) && ($id > 0)) { ?>
<a href="index.php?route=import/list" class="btn"><?php print $text_cancel; ?></a>
<?php } else { ?>
<input type="reset" value="<?php print $text_clear; ?>" class="btn" onclick="Piler.clear_ldap_test();" />
<?php } ?>
</div>
</form>
<?php if($id == -1) { ?>
<h4><?php print $text_existing_entries; ?> <a href="index.php?route=import/jobs"><?php print $text_view_progress; ?></a></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_password; ?></th>
<th><?php print $text_server_name; ?></td>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td>*******</td>
<td><?php print $e['server']; ?></td>
<td><a href="index.php?route=import/list&amp;id=<?php print $e['id']; ?>"><i class="icon-edit"></i>&nbsp;<?php print $text_edit; ?></a></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,13 @@
<div>
<?php if($confirmed){ ?>
<div class="alert alert-success"><?php print $x; ?>.</div>
<?php } ?>
<p><a href="index.php?route=import/list"><i class="icon-circle-arrow-left"></i>&nbsp;<?php print $text_back; ?></a></p>
</div>

View File

@ -35,6 +35,7 @@ if(isset($this->request->get['route'])) {
if($this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'stat/online') { ?> onload="setInterval('Piler.reload_page()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'import/jobs') { ?> onload="setInterval('Piler.reload_page()', 10 * 1000);"<?php }
} ?>>

View File

@ -33,6 +33,7 @@
<?php if(ENABLE_SAAS == 1) { ?>
<li><a href="index.php?route=ldap/list"><?php print $text_ldap; ?></a></li>
<li><a href="index.php?route=customer/list"><?php print $text_customers; ?></a></li>
<li><a href="index.php?route=import/list"><?php print $text_import; ?></a></li>
<?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>

View File

@ -0,0 +1,61 @@
<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_import_job_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=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<?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 } ?>
<?php if($id == -1) { ?>
<h4><?php print $text_progress; ?></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_server_name; ?></td>
<th><?php print $text_progress; ?></td>
<th><?php print $text_status; ?></td>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td><?php print $e['server']; ?></td>
<td><?php print $e['imported']; ?> / <?php print $e['total']; ?></td>
<td><?php print $import_status[$e['status']]; ?></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,104 @@
<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_import_job_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=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<h4><?php if(isset($id) && ($id > 0)) { print $text_edit_entry; } else { print $text_add_new_entry; } ?></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=import/list" class="form-horizontal">
<?php if(isset($id) && ($id > 0)) { ?>
<input type="hidden" name="id" id="id" value="<?php print $id; ?>" />
<?php } ?>
<input type="hidden" name="type" id="type" value="pop3" />
<div class="control-group<?php if(isset($errors['server'])){ print " error"; } ?>">
<label class="control-label" for="server"><?php print $text_server_name; ?>:</label>
<div class="controls">
<input type="text" class="text" name="server" id="server" placeholder="" value="<?php if(isset($a['server'])) { print $a['server']; } ?>" />
<?php if ( isset($errors['server']) ) { ?><span class="help-inline"><?php print $errors['server']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['username'])){ print " error"; } ?>">
<label class="control-label" for="username"><?php print $text_username; ?>:</label>
<div class="controls">
<input type="text" class="text" name="username" id="username" placeholder="" value="<?php if(isset($a['username'])) { print $a['username']; } ?>" />
<?php if ( isset($errors['username']) ) { ?><span class="help-inline"><?php print $errors['username']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['password'])){ print " error"; } ?>">
<label class="control-label" for="password"><?php print $text_password; ?>:</label>
<div class="controls">
<input type="password" class="password" name="password" id="password" placeholder="" value="<?php if(isset($a['password'])) { print $a['password']; } ?>" /> <input type="button" value="<?php print $text_test_connection; ?>" class="btn btn-danger" onclick="Piler.test_pop3_connection(); return false;" /> <span id="LDAPTEST"></span>
<?php if ( isset($errors['password']) ) { ?><span class="help-inline"><?php print $errors['password']; ?></span><?php } ?>
</div>
</div>
<div class="form-actions">
<input type="submit" value="<?php if(isset($id) && ($id > 0)) { print $text_modify; } else { print $text_add; } ?>" class="btn btn-primary" />
<?php if(isset($id) && ($id > 0)) { ?>
<a href="index.php?route=import/list" class="btn"><?php print $text_cancel; ?></a>
<?php } else { ?>
<input type="reset" value="<?php print $text_clear; ?>" class="btn" onclick="Piler.clear_ldap_test();" />
<?php } ?>
</div>
</form>
<?php if($id == -1) { ?>
<h4><?php print $text_existing_entries; ?> <a href="index.php?route=import/jobs"><?php print $text_view_progress; ?></a></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_password; ?></th>
<th><?php print $text_server_name; ?></td>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td>*******</td>
<td><?php print $e['server']; ?></td>
<td><a href="index.php?route=import/list&amp;id=<?php print $e['id']; ?>"><i class="icon-edit"></i>&nbsp;<?php print $text_edit; ?></a></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,13 @@
<div>
<?php if($confirmed){ ?>
<div class="alert alert-success"><?php print $x; ?>.</div>
<?php } ?>
<p><a href="index.php?route=import/list"><i class="icon-circle-arrow-left"></i>&nbsp;<?php print $text_back; ?></a></p>
</div>