summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bea18a6)
raw | patch | inline | side by side (parent: bea18a6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 23 Jun 2009 08:15:20 +0000 (08:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 23 Jun 2009 08:15:20 +0000 (08:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13766 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc | patch | blob | history | |
gosa-plugins/fai/admin/fai/faiTemplateEdit.tpl | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc b/gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc
index 7534e6c0d3ce089d4929f340ecd340e0e45f8250..05993911302fd287f6ad580ec8bd6ad43c8cc9d4 100644 (file)
// Encoding identification. Allows to warn the user.
var $enc_before_edit = "";
var $enc_after_edit = "";
- var $write_protect = false;
+ var $write_protect = FALSE;
+ var $mb_extension = TRUE;
function faiTemplateEdit (&$config, $dn, $value)
{
plugin::plugin ($config, $dn);
- $this->value = $value;
- $this->enc_before_edit = mb_detect_encoding($value);
- if($this->enc_before_edit != "ASCII"){
- $this->write_protect = TRUE;
+ if(!function_exists("mb_detect_encoding")){
+ $this->mb_extension = FALSE;
+ }else{
+ $this->value = $value;
+ $this->enc_before_edit = mb_detect_encoding($value);
+ if($this->enc_before_edit != "ASCII"){
+ $this->write_protect = TRUE;
+ }
}
}
$smarty = get_smarty();
$smarty->assign("templateValue",htmlspecialchars(($this->value)));
$smarty->assign("write_protect",$this->write_protect);
+ $smarty->assign("mb_extension",$this->mb_extension);
return($smarty->fetch(get_template_path('faiTemplateEdit.tpl', TRUE)));
}
/* Save data to object */
function save_object()
- {
+ {
+ if(!$this->mb_extension) return;
if(isset($_POST['templateValue']) && !$this->write_protect){
$this->value = get_post('templateValue');
$this->enc_after_edit = mb_detect_encoding($this->value);
function check()
{
$message = array();
- if(!$this->write_protect && $this->enc_after_edit !== $this->enc_before_edit ){
+ if($this->mb_extension && !$this->write_protect && $this->enc_after_edit !== $this->enc_before_edit ){
$msg = sprintf(_("The file encodig has changed from '%s' to '%s', do you really want to save?"),
"<i>".$this->enc_before_edit."</i>","<i>".$this->enc_after_edit."</i>");
$message[] = $msg;
diff --git a/gosa-plugins/fai/admin/fai/faiTemplateEdit.tpl b/gosa-plugins/fai/admin/fai/faiTemplateEdit.tpl
index a8b2526c84686864bc420efd6d2dd5494961ec3a..799d5fff217e01b937eb8de0bfe9416602b127c8 100644 (file)
<h2>Template entry</h2>
+{if !$mb_extension}
+
+{msgPool type=missingext param1='multi byte'}
+
+<p class='seperator'>
+ <div style='text-align:right;'>
+ <input type='submit' name='templateEditCancel' value='{msgPool type=cancelButton'}'>
+ </div>
+</p>
+
+{else}
+
{if $write_protect}
{t}This FAI template is write protected due to its character encoding, editing may brake this file!{/t}
<br><input type='submit' value='{t}Edit anyway{/t}' name='editAnyway'>
<input type='submit' name='templateEditCancel' value='{msgPool type=cancelButton'}'>
</div>
</p>
+
+{/if}