merge r10309 from trunk to branch 2.2

Always load codemirror


git-svn-id: http://piwigo.org/svn/branches/2.2@10311 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2011-04-12 11:41:57 +00:00
parent cf4e2c81f9
commit 5a3fc07ba4
31 changed files with 12 additions and 192 deletions

View file

@ -360,7 +360,6 @@ if (!empty($edited_file))
$template->assign(array(
'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin-LocalFilesEditor-'.$page['tab'],
'LOCALEDIT_PATH' => LOCALEDIT_PATH,
'LOAD_CODEMIRROR' => isset($conf['LocalFilesEditor']) ? $conf['LocalFilesEditor'] : 'off',
'CODEMIRROR_MODE' => @$codemirror_mode
)
);

View file

@ -14,25 +14,11 @@
{combine_css path="plugins/LocalFilesEditor/locfiledit.css"}
{footer_script}
function loadCodemirror() {ldelim}
editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim}
matchBrackets: true,
mode: "{$CODEMIRROR_MODE}",
tabMode: "shift"
});
jQuery("#showedit, #hideedit").toggle();
jQuery.post("plugins/LocalFilesEditor/update_config.php", {ldelim} editarea: "on"});
}
function unloadCodemirror() {ldelim}
editor.toTextArea();
jQuery("#showedit, #hideedit").toggle();
jQuery.post("plugins/LocalFilesEditor/update_config.php", {ldelim} editarea: "off"});
}
{if $LOAD_CODEMIRROR == 'on'}
if (document.getElementById("text") != null) loadCodemirror();
{/if}
var editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim}
matchBrackets: true,
mode: "{$CODEMIRROR_MODE}",
tabMode: "shift"
});
{/footer_script}
<div class="titrePage">
@ -91,10 +77,6 @@ if (document.getElementById("text") != null) loadCodemirror();
</div> {* top bar buttons *}
<textarea rows="30" cols="90" name="text" id="text">{$zone_edit.CONTENT_FILE}</textarea>
<div id="editarea_buttons">
<a href="javascript:loadCodemirror();" id="showedit">[{'locfiledit_enable_codemirror'|@translate}]</a>
<a href="javascript:unloadCodemirror();" id="hideedit">[{'locfiledit_disable_codemirror'|@translate}]</a>
</div>
<br>

View file

@ -50,7 +50,4 @@ $lang['locfiledit_file_already_exists'] = 'الملف الموجود';
$lang['locfiledit_model_error'] = 'يجب أختيار نموذج';
$lang['locfiledit_empty_filename'] = 'يجب كتابة أسم الملف';
$lang['locfiledit_webmaster_only'] = 'فقط مدير الموقع يمكن استخدام محرر الملفات المحلي';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Soubor už existuje.';
$lang['locfiledit_model_error'] = 'Musíte zvolit model.';
$lang['locfiledit_empty_filename'] = 'Musíte vyplnit název souboru.';
$lang['locfiledit_webmaster_only'] = 'Pouze webmaster může vytvářet nebo měnit lokální soubory.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Datei ist bereits vorhanden.';
$lang['locfiledit_model_error'] = 'Sie müssen ein Modell wählen.';
$lang['locfiledit_empty_filename'] = 'Sie müssen einen Dateiname eingeben.';
/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'File already exists.';
$lang['locfiledit_model_error'] = 'You must choose a model.';
$lang['locfiledit_empty_filename'] = 'You must fill file name.';
$lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.';
$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'El archivo ya existe.';
$lang['locfiledit_model_error'] = 'Por favor, seleccione un modelo.';
$lang['locfiledit_empty_filename'] = 'Por favor, indique un nombre de archivo.';
$lang['locfiledit_webmaster_only'] = 'Sólo los administradores pueden crear o modificar fichero locales.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Le fichier existe déjà.';
$lang['locfiledit_model_error'] = 'Veuillez sélectionner un modèle.';
$lang['locfiledit_empty_filename'] = 'Veuillez indiquer un nom de fichier.';
$lang['locfiledit_webmaster_only'] = 'Seuls les webmasters sont autorisés à créer ou modifier les fichiers locaux.';
$lang['locfiledit_enable_codemirror'] = 'Activer Codemirror';
$lang['locfiledit_disable_codemirror'] = 'Désactiver Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_model_error'] = 'אתה חייב לחבחור דגם.';
$lang['locfiledit_empty_filename'] = 'אתה חייב למלא את שם הקובץ.';
$lang['locfiledit_webmaster_only'] = 'רק מנהל האתר יכול ליצור או לשנות קבצים מקומיים.';
$lang['locfiledit_filename_error'] = 'אסור להשתמש בתווים מסויימים בשם הקובץ.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -49,7 +49,4 @@ $lang['locfiledit_file_already_exists'] = 'Datoteka vec postoji.';
$lang['locfiledit_model_error'] = 'Morate odabrati model.';
$lang['locfiledit_empty_filename'] = 'Morate popuniti naziv datoteke.';
$lang['locfiledit_webmaster_only'] = 'Samo webmasteri mogu kreirati ili mijenjati lokalne datoteke.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Ilyen fájl már létezik.';
$lang['locfiledit_model_error'] = 'A típust ki kell választani.';
$lang['locfiledit_empty_filename'] = 'A fájlnevet ki kell tölteni.';
/* TODO */ $lang['locfiledit_webmaster_only'] = 'Csak a webmesterek hozhatnak létre, vagy módosíthatnak helyi fájlokat.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Il file esiste già.';
$lang['locfiledit_model_error'] = 'Selezionare un modello.';
$lang['locfiledit_empty_filename'] = 'Indicate un nome di file.';
$lang['locfiledit_webmaster_only'] = 'Solo i webmasters sono autorizzati a creare o modificare i file locali.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'ファイルは既に存在してい
$lang['locfiledit_model_error'] = 'モデルを選択する必要があります。';
$lang['locfiledit_empty_filename'] = 'ファイル名を記入する必要があります。';
$lang['locfiledit_webmaster_only'] = 'ローカルファイルはウェブマスターのみ作成するか、変更できます。';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'ფაილი უკვე არ
$lang['locfiledit_model_error'] = 'თქვენ უნდა აირჩიოთ მოდელი.';
$lang['locfiledit_empty_filename'] = 'თქვენ უნდა შეავსოთ ფაილის სახელი.';
$lang['locfiledit_webmaster_only'] = 'მხოლოდ ვებოსტატებს შეუძლიათ შექმნან ან გადააკეთონ ლოკალური ფაილები.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Fails jau eksiste.';
$lang['locfiledit_model_error'] = 'Jums jaizvelas modelis.';
$lang['locfiledit_empty_filename'] = 'Jums jaieraksta faila nosaukums.';
$lang['locfiledit_webmaster_only'] = 'Tikai webmasters var izveidot un modificet lokalos failus.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Bestand bestaat reeds.';
$lang['locfiledit_model_error'] = 'U moet een model kiezen.';
$lang['locfiledit_empty_filename'] = 'U moet een bestandsnaam opgeven.';
$lang['locfiledit_webmaster_only'] = 'Alleen webbeheerders kunnen lokale bestanden aanmaken of wijzigen.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -48,7 +48,4 @@ $lang['locfiledit_file_already_exists'] = 'Filen eksisterer allerede.';
$lang['locfiledit_model_error'] = 'Du må velge en modell.';
$lang['locfiledit_empty_filename'] = 'Du må fylle inn fil navnet.';
$lang['locfiledit_webmaster_only'] = 'Kun webmaster kan lage eller endre lokale filer.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Plik już istnieje.';
$lang['locfiledit_model_error'] = 'Musisz wybrać model.';
$lang['locfiledit_empty_filename'] = 'Musisz wpisać nazwę pliku.';
/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'O ficheiro já existe.';
$lang['locfiledit_model_error'] = 'Tem que escolher um Modelo.';
$lang['locfiledit_empty_filename'] = 'Tem que preencher o Nome do ficheiro.';
$lang['locfiledit_webmaster_only'] = 'Apenas webmasters podem criar ou modificar ficheiros locais.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -50,7 +50,4 @@ $lang['locfiledit_file_already_exists'] = 'Файл уже существует.
$lang['locfiledit_model_error'] = 'Выберите модель.';
$lang['locfiledit_empty_filename'] = 'Заполните поле "Имя файла".';
$lang['locfiledit_webmaster_only'] = 'Только вэбмастеры могут создавать или редактировать локальные файлы.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Súbor už existuje.';
$lang['locfiledit_model_error'] = 'Musíte vybrať model.';
$lang['locfiledit_empty_filename'] = 'Musíte zadať meno súboru.';
$lang['locfiledit_webmaster_only'] = 'Len webmasteri môžu vytvoriť alebo modifikovať lokálne súbory.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -50,7 +50,4 @@ $lang['locfiledit_file_already_exists'] = 'Датотека већ постој
$lang['locfiledit_model_error'] = 'Морате изабрати модел.';
$lang['locfiledit_empty_filename'] = 'Морате уписати име датотеке.';
$lang['locfiledit_webmaster_only'] = 'Само уредник интернет страница може да направи или уреди локалне датотеке.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -50,7 +50,4 @@ $lang['locfiledit_file_already_exists'] = 'Filen existerar redan.';
$lang['locfiledit_model_error'] = 'Du måste välja en modell.';
$lang['locfiledit_empty_filename'] = 'Du måste välja ett filnamn.';
$lang['locfiledit_webmaster_only'] = 'Endast webmasters kan skapa eller ändra lokala filer.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -51,7 +51,4 @@ $lang['locfiledit_file_already_exists'] = 'Bu dosya zaten var.';
$lang['locfiledit_model_error'] = 'Model seçmek zorundasin.';
$lang['locfiledit_empty_filename'] = 'Adi doldurmak zorundasin.';
$lang['locfiledit_webmaster_only'] = 'Sadece yöneticiler dosyalari degistirebilir .';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -50,7 +50,4 @@ $lang['locfiledit_file_already_exists'] = 'Tệp tin đã có.';
$lang['locfiledit_model_error'] = 'Bạn phải chọn một mô hình.';
$lang['locfiledit_empty_filename'] = 'Bạn phải điền đủ tên tệp tin.';
$lang['locfiledit_webmaster_only'] = 'Chỉ có webmasters mới có thể tạo hoặc biên tập tệp tin trên máy.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -50,7 +50,4 @@ $lang['locfiledit_file_already_exists'] = '文件已存在.';
$lang['locfiledit_model_error'] = '您必须选择一个模块.';
$lang['locfiledit_empty_filename'] = '您必须填写文件名.';
$lang['locfiledit_webmaster_only'] = '只有网站管理员才能创建或者修改本地文件.';
/*TODO*/$lang['locfiledit_enable_codemirror'] = 'Enable Codemirror';
/*TODO*/$lang['locfiledit_disable_codemirror'] = 'Disable Codemirror';
?>

View file

@ -19,22 +19,12 @@
float: left;
}
#LocalFilesEditor #editarea_buttons {
width: 100%;
float: left;
text-align: left;
}
#LocalFilesEditor #hideedit {
display: none;
}
#LocalFilesEditor TD {
padding: 0.5em;
}
.CodeMirror {
background-color: #DDDDDD;
background-color: #EEEEEE;
font-size: 1.3em;
border: 1px solid #999999;
margin: 0.5em 0;

View file

@ -21,17 +21,6 @@
// | USA. |
// +-----------------------------------------------------------------------+
function plugin_install()
{
global $prefixeTable;
$query = '
INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
VALUES (\'LocalFilesEditor\' , \'off\' , \'LocalFiles Editor plugin parameters\');';
pwg_query($query);
}
function plugin_uninstall()
{
global $prefixeTable;

View file

@ -45,7 +45,6 @@ if (isset($_GET['file']))
'TITLE' => $title,
'DEFAULT_CONTENT' => $file,
'LOCALEDIT_PATH' => LOCALEDIT_PATH,
'LOAD_CODEMIRROR' => isset($conf['LocalFilesEditor']) ? $conf['LocalFilesEditor'] : 'on',
'CODEMIRROR_MODE' => 'application/x-httpd-php'
)
);

View file

@ -19,28 +19,12 @@
{combine_css path="plugins/LocalFilesEditor/locfiledit.css"}
{footer_script}
function loadCodemirror() {ldelim}
editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim}
matchBrackets: true,
readOnly: true,
mode: "{$CODEMIRROR_MODE}",
tabMode: "shift"
});
jQuery("#showedit").hide();
jQuery("#hideedit").show();
jQuery.post("update_config.php", {ldelim} editarea: "on"});
}
function unloadCodemirror() {ldelim}
editor.toTextArea();
jQuery("#hideedit").hide();
jQuery("#showedit").show();
jQuery.post("update_config.php", {ldelim} editarea: "off"});
}
{if $LOAD_CODEMIRROR == 'on'}
if (document.getElementById("text") != null) loadCodemirror();
{/if}
var editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim}
matchBrackets: true,
readOnly: true,
mode: "{$CODEMIRROR_MODE}",
tabMode: "shift"
});
{/footer_script}
<div id="LocalFilesEditor">
@ -48,9 +32,4 @@ if (document.getElementById("text") != null) loadCodemirror();
<textarea id="text" rows="30" cols="90">{$DEFAULT_CONTENT}</textarea>
<div id="editarea_buttons">
<a href="javascript:loadCodemirror();" id="showedit">[{'locfiledit_enable_codemirror'|@translate}]</a>
<a href="javascript:unloadCodemirror();" id="hideedit">[{'locfiledit_disable_codemirror'|@translate}]</a>
</div>
</div>

View file

@ -1,46 +0,0 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
define('PHPWG_ROOT_PATH', '../../');
include_once(PHPWG_ROOT_PATH . 'include/common.inc.php');
include_once(LOCALEDIT_PATH.'functions.inc.php');
check_status(ACCESS_ADMINISTRATOR);
$possible_values = array('on', 'off');
if (isset($_POST['editarea']) and in_array($_POST['editarea'], $possible_values))
{
if (!isset($conf['LocalFilesEditor']))
{
include_once(LOCALEDIT_PATH.'maintain.inc.php');
plugin_install();
}
$query = '
UPDATE ' . CONFIG_TABLE . '
SET value = \'' . $_POST['editarea'] . '\'
WHERE param=\'LocalFilesEditor\'
LIMIT 1';
pwg_query($query);
}
?>