added a piler daemon reload button to the policy pages. Thx for Jack Zielke for the idea

This commit is contained in:
SJ 2013-04-17 17:23:20 +02:00
parent 676f479d23
commit b92431b0e1
15 changed files with 98 additions and 3 deletions

View File

@ -44,7 +44,11 @@ case "$1" in
start; start;
;; ;;
reload)
kill -HUP $PID_NUMBER
;;
*) *)
echo "Usage: $0 start|stop|restart|status" echo "Usage: $0 start|stop|restart|reload|status"
esac esac

View File

@ -44,7 +44,11 @@ case "$1" in
start; start;
;; ;;
reload)
kill -HUP $PID_NUMBER
;;
*) *)
echo "Usage: $0 start|stop|restart|status" echo "Usage: $0 start|stop|restart|reload|status"
esac esac

View File

@ -0,0 +1,36 @@
<?php
class ControllerPolicyApply extends Controller {
private $error = array();
public function index(){
$this->id = "content";
$this->template = "policy/apply.tpl";
$this->layout = "common/layout-empty";
$request = Registry::get('request');
$db = Registry::get('db');
$lang = Registry::get('language');
if(Registry::get('admin_user') == 0) {
die("go away");
}
system('sudo -n /etc/init.d/rc.piler reload', $val);
if($val === 0) {
print $lang->data['text_applied'];
} else {
print $lang->data['text_install_sudo_apply'];
}
}
}
?>

View File

@ -17,6 +17,8 @@ $_['text_advanced'] = "Erweitert";
$_['text_advanced_search'] = "Erweiterte Suche"; $_['text_advanced_search'] = "Erweiterte Suche";
$_['text_all'] = "alle"; $_['text_all'] = "alle";
$_['text_any'] = "jede"; $_['text_any'] = "jede";
$_['text_applied'] = "Applied";
$_['text_apply_changes'] = "Apply changes";
$_['text_archive_size'] = "Archivgröße"; $_['text_archive_size'] = "Archivgröße";
$_['text_archived_messages'] = "Archivierte Nachrichten"; $_['text_archived_messages'] = "Archivierte Nachrichten";
$_['text_archiving_rules'] = "Archivierungsregeln"; $_['text_archiving_rules'] = "Archivierungsregeln";
@ -138,6 +140,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Benutzer importieren"; $_['text_import_users'] = "Benutzer importieren";
$_['text_import_users_from_LDAP'] = "Benutzer aus LDAP importieren"; $_['text_import_users_from_LDAP'] = "Benutzer aus LDAP importieren";
$_['text_inbound'] = "eingehend"; $_['text_inbound'] = "eingehend";
$_['text_install_sudo_apply'] = "Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "intern"; $_['text_internal'] = "intern";
$_['text_invalid_data'] = "Ungültige Daten"; $_['text_invalid_data'] = "Ungültige Daten";
$_['text_invalid_email'] = "Ungültige E-Mail-Adresse"; $_['text_invalid_email'] = "Ungültige E-Mail-Adresse";

View File

@ -17,6 +17,8 @@ $_['text_advanced'] = "Advanced";
$_['text_advanced_search'] = "Advanced search"; $_['text_advanced_search'] = "Advanced search";
$_['text_all'] = "all"; $_['text_all'] = "all";
$_['text_any'] = "any"; $_['text_any'] = "any";
$_['text_applied'] = "Applied";
$_['text_apply_changes'] = "Apply changes";
$_['text_archive_size'] = "Archive size"; $_['text_archive_size'] = "Archive size";
$_['text_archived_messages'] = "Archived messages"; $_['text_archived_messages'] = "Archived messages";
$_['text_archiving_rules'] = "Archiving rules"; $_['text_archiving_rules'] = "Archiving rules";
@ -138,6 +140,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Import users"; $_['text_import_users'] = "Import users";
$_['text_import_users_from_LDAP'] = "Import users from LDAP"; $_['text_import_users_from_LDAP'] = "Import users from LDAP";
$_['text_inbound'] = "inbound"; $_['text_inbound'] = "inbound";
$_['text_install_sudo_apply'] = "Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "internal"; $_['text_internal'] = "internal";
$_['text_invalid_data'] = "Invalid data"; $_['text_invalid_data'] = "Invalid data";
$_['text_invalid_email'] = "Invalid email"; $_['text_invalid_email'] = "Invalid email";

View File

@ -17,6 +17,8 @@ $_['text_advanced'] = "
$_['text_advanced_search'] = "Összetett keresés"; $_['text_advanced_search'] = "Összetett keresés";
$_['text_all'] = "összes"; $_['text_all'] = "összes";
$_['text_any'] = "mindegy"; $_['text_any'] = "mindegy";
$_['text_applied'] = "Alkalmazva";
$_['text_apply_changes'] = "Beállítások alkalmazása";
$_['text_archive_size'] = "Archívum méret"; $_['text_archive_size'] = "Archívum méret";
$_['text_archived_messages'] = "Archivált levelek"; $_['text_archived_messages'] = "Archivált levelek";
$_['text_archiving_rules'] = "Archiválási szabályok"; $_['text_archiving_rules'] = "Archiválási szabályok";
@ -138,6 +140,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Felhasználók importálása"; $_['text_import_users'] = "Felhasználók importálása";
$_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból"; $_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból";
$_['text_inbound'] = "bejövő"; $_['text_inbound'] = "bejövő";
$_['text_install_sudo_apply'] = "Adja az alábbi sort a /etc/sudoers file-hoz: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "belső"; $_['text_internal'] = "belső";
$_['text_invalid_data'] = "Érvénytelen adat(ok)"; $_['text_invalid_data'] = "Érvénytelen adat(ok)";
$_['text_invalid_email'] = "Érvénytelen email cím"; $_['text_invalid_email'] = "Érvénytelen email cím";

View File

@ -17,6 +17,8 @@ $_['text_advanced'] = "Összetett";
$_['text_advanced_search'] = "Összetett keresés"; $_['text_advanced_search'] = "Összetett keresés";
$_['text_all'] = "összes"; $_['text_all'] = "összes";
$_['text_any'] = "mindegy"; $_['text_any'] = "mindegy";
$_['text_applied'] = "Alkalmazva";
$_['text_apply_changes'] = "Beállítások alkalmazása";
$_['text_archive_size'] = "Archívum méret"; $_['text_archive_size'] = "Archívum méret";
$_['text_archived_messages'] = "Archivált levelek"; $_['text_archived_messages'] = "Archivált levelek";
$_['text_archiving_rules'] = "Archiválási szabályok"; $_['text_archiving_rules'] = "Archiválási szabályok";
@ -138,6 +140,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Felhasználók importálása"; $_['text_import_users'] = "Felhasználók importálása";
$_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból"; $_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból";
$_['text_inbound'] = "bejövő"; $_['text_inbound'] = "bejövő";
$_['text_install_sudo_apply'] = "Adja az alábbi sort a /etc/sudoers file-hoz: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "belső"; $_['text_internal'] = "belső";
$_['text_invalid_data'] = "Érvénytelen adat(ok)"; $_['text_invalid_data'] = "Érvénytelen adat(ok)";
$_['text_invalid_email'] = "Érvénytelen email cím"; $_['text_invalid_email'] = "Érvénytelen email cím";

View File

@ -17,6 +17,8 @@ $_['text_advanced'] = "Avançado";
$_['text_advanced_search'] = "Pesquisa avançada"; $_['text_advanced_search'] = "Pesquisa avançada";
$_['text_all'] = "todos"; $_['text_all'] = "todos";
$_['text_any'] = "qualquer"; $_['text_any'] = "qualquer";
$_['text_applied'] = "Applied";
$_['text_apply_changes'] = "Apply changes";
$_['text_archive_size'] = "Tamanho do arquivo"; $_['text_archive_size'] = "Tamanho do arquivo";
$_['text_archived_messages'] = "Mensagens arquivadas"; $_['text_archived_messages'] = "Mensagens arquivadas";
$_['text_archiving_rules'] = "Regras de não arquivamento"; $_['text_archiving_rules'] = "Regras de não arquivamento";
@ -138,6 +140,7 @@ $_['text_import'] = "Importar";
$_['text_import_users'] = "Importar usuários"; $_['text_import_users'] = "Importar usuários";
$_['text_import_users_from_LDAP'] = "Importar usuários de LDAP"; $_['text_import_users_from_LDAP'] = "Importar usuários de LDAP";
$_['text_inbound'] = "interno"; $_['text_inbound'] = "interno";
$_['text_install_sudo_apply'] = "Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "interno"; $_['text_internal'] = "interno";
$_['text_invalid_data'] = "Dados inválidos"; $_['text_invalid_data'] = "Dados inválidos";
$_['text_invalid_email'] = "Email inválido"; $_['text_invalid_email'] = "Email inválido";

View File

@ -774,6 +774,18 @@ var Piler =
}, },
reload_piler:function()
{
Piler.log("[reload_piler]");
jQuery.ajax('index.php?route=policy/apply', { cache: true })
.done( function(a) {
$('#applyChangesOutput').html(a);
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
},
assemble_folder_restrictions: function() assemble_folder_restrictions: function()
{ {
Piler.log("[assemble_folder_restrictions]"); Piler.log("[assemble_folder_restrictions]");

View File

@ -59,7 +59,7 @@
</div> </div>
</div> </div>
<div class="form-actions"> <div class="form-actions">
<input type="submit" class="btn btn-primary" value="<?php print $text_add; ?>" /><input type="reset" class="btn" value="<?php print $text_cancel; ?>" /> <input type="submit" class="btn btn-primary" value="<?php print $text_add; ?>" /> <input type="reset" class="btn" value="<?php print $text_cancel; ?>" />
</div> </div>
</form> </form>
@ -105,3 +105,8 @@
</div> </div>
<?php } ?> <?php } ?>
<div>
<p><input type="button" class="btn btn-danger" onclick="Piler.reload_piler();" value="<?php print $text_apply_changes; ?>" /></p>
<span id="applyChangesOutput"></span>
</div>

View File

@ -110,3 +110,9 @@
<?php } ?> <?php } ?>
<div>
<p><input type="button" class="btn btn-danger" onclick="Piler.reload_piler();" value="<?php print $text_apply_changes; ?>" /></p>
<span id="applyChangesOutput"></span>
</div>

View File

@ -103,3 +103,9 @@
<?php print $text_not_found; ?> <?php print $text_not_found; ?>
<?php } ?> <?php } ?>
<div>
<p><input type="button" class="btn btn-danger" onclick="Piler.reload_piler();" value="<?php print $text_apply_changes; ?>" /></p>
<span id="applyChangesOutput"></span>
</div>

View File

@ -110,3 +110,10 @@
<?php } ?> <?php } ?>
<div>
<p><input type="button" class="btn btn-danger" onclick="Piler.reload_piler();" value="<?php print $text_apply_changes; ?>" /></p>
<span id="applyChangesOutput"></span>
</div>