Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master:
  Hadn't merged fixed typo from upstream.
  EO translation fixes
  filebrowser: fix style, show 10 recent photos if not in an album
  filebrowser: more style, load min and max scale photos
  tinymce: add inlinepopups plugin
  tinymce: add filebrowser for photos and attached files

* master:
This commit is contained in:
Simon L'nu 2012-04-19 12:32:09 -04:00
commit caa6bc96f3
6 changed files with 237 additions and 27 deletions

View File

@ -17,6 +17,7 @@
}
var src = null;
var prev = null;
var livetime = null;
@ -558,12 +559,36 @@ function notifyMarkAll() {
}
// code from http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser
function fcFileBrowser (field_name, url, type, win) {
/* TODO: If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
var cmsURL = baseurl+"/fbrowser/"+type+"/";
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'File Browser',
width : 420, // Your dimensions may differ - toy around with them!
height : 400,
resizable : "yes",
inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"
}, {
window : win,
input : field_name
});
return false;
}
function setupFieldRichtext(){
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
editor_selector: "fieldRichtext",
plugins : "bbcode,paste",
plugins : "bbcode,paste, inlinepopups",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
@ -580,6 +605,7 @@ function setupFieldRichtext(){
convert_urls: false,
content_css: baseurl+"/view/custom_tinymce.css",
theme_advanced_path : false,
file_browser_callback : "fcFileBrowser",
});
}

99
mod/fbrowser.php Normal file
View File

@ -0,0 +1,99 @@
<?php
/**
* @package Friendica\modules
* @subpackage FileBrowser
* @author Fabio Comuni <fabrixxm@kirgroup.com>
*/
/**
* @param App $a
*/
function fbrowser_content($a){
if (!local_user())
killme();
if ($a->argc==1)
killme();
//echo "<pre>"; var_dump($a->argv); killme();
switch($a->argv[1]){
case "image":
$path = array( array($a->get_baseurl()."/fbrowser/image/", t("Photos")));
$albums = false;
$sql_extra = "";
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
if ($a->argc==2){
$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
intval(local_user())
);
// anon functions only from 5.3.0... meglio tardi che mai..
function folder1($el){return array(bin2hex($el['album']),$el['album']);}
$albums = array_map( "folder1" , $albums);
}
$album = "";
if ($a->argc==3){
$album = hex2bin($a->argv[2]);
$sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
$sql_extra2 = "";
$path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album);
}
$r = q("SELECT `resource-id`, `id`, `filename`, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
FROM `photo` WHERE `uid` = %d $sql_extra
GROUP BY `resource-id` $sql_extra2",
intval(local_user())
);
function files1($rr){ global $a; return array( $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['hiq'] . '.jpg', template_escape($rr['filename']), $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.jpg'); }
$files = array_map("files1", $r);
$tpl = get_markup_template("filebrowser.tpl");
echo replace_macros($tpl, array(
'$type' => 'image',
'$baseurl' => $a->get_baseurl(),
'$path' => $path,
'$folders' => $albums,
'$files' =>$files,
));
break;
case "file":
if ($a->argc==2){
$files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
intval(local_user())
);
function files2($rr){ global $a;
list($m1,$m2) = explode("/",$rr['filetype']);
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
return array( $a->get_baseurl() . '/attach/' . $rr['id'], template_escape($rr['filename']), $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png');
}
$files = array_map("files2", $files);
//echo "<pre>"; var_dump($files); killme();
$tpl = get_markup_template("filebrowser.tpl");
echo replace_macros($tpl, array(
'$type' => 'file',
'$baseurl' => $a->get_baseurl(),
'$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ),
'$folders' => false,
'$files' =>$files,
));
}
break;
}
killme();
}

View File

@ -10,7 +10,7 @@ msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: http://bugs.friendica.com/\n"
"POT-Creation-Date: 2012-04-16 10:00-0700\n"
"PO-Revision-Date: 2012-04-17 20:23+0000\n"
"PO-Revision-Date: 2012-04-18 17:16+0000\n"
"Last-Translator: Martin Schmitt <mas@scsy.de>\n"
"Language-Team: Esperanto (http://www.transifex.net/projects/p/friendica/language/eo/)\n"
"MIME-Version: 1.0\n"
@ -1360,7 +1360,7 @@ msgstr "%s kreis novan afiŝon"
#: ../../mod/notifications.php:497
#, php-format
msgid "%s commented on %s's post"
msgstr "%s komentis pri la afiŝon de %s"
msgstr "%s komentis pri la afiŝo de %s"
#: ../../mod/notifications.php:298
msgid "No more network notifications."
@ -2657,7 +2657,7 @@ msgstr "La retejo transiras la maksimuman kvanton da ĉiutagaj kontaj registrado
msgid ""
"You may (optionally) fill in this form via OpenID by supplying your OpenID "
"and clicking 'Register'."
msgstr "Vi ankaŭ (nedeviga) povas plenigi la formularo tra OpenID se vi provizas vian OpenID adreson kaj klakas 'Registri'."
msgstr "Vi ankaŭ (nedeviga) povas plenigi la formularon tra OpenID se vi provizas vian OpenID adreson kaj klakas 'Registri'."
#: ../../mod/register.php:514
msgid ""
@ -3470,7 +3470,7 @@ msgstr "{0} petis registradon"
#: ../../mod/ping.php:191
#, php-format
msgid "{0} commented %s's post"
msgstr "{0} komentis pri la afiŝon de %s"
msgstr "{0} komentis pri la afiŝo de %s"
#: ../../mod/ping.php:196
#, php-format
@ -5576,7 +5576,7 @@ msgstr "Hejmpaĝo:"
#: ../../include/profile_advanced.php:47
msgid "Tags:"
msgstr "Tags:"
msgstr "Markoj:"
#: ../../include/profile_advanced.php:51
msgid "Religion:"
@ -5860,7 +5860,7 @@ msgstr "Edziĝinta"
#: ../../include/profile_selectors.php:33
msgid "Imaginarily married"
msgstr "Image edziiĝinta"
msgstr "Image edziĝinta"
#: ../../include/profile_selectors.php:33
msgid "Partners"
@ -5904,7 +5904,7 @@ msgstr "Eksedziĝinta"
#: ../../include/profile_selectors.php:33
msgid "Imaginarily divorced"
msgstr "Image maledziiĝinta"
msgstr "Image eksedziĝinta"
#: ../../include/profile_selectors.php:33
msgid "Widowed"
@ -6490,7 +6490,7 @@ msgstr "Bonvolu viziti %s por vidi aŭ respondi viajn privatajn mesaĝojn."
#: ../../include/enotify.php:73
#, php-format
msgid "%s's"
msgstr "de %s"
msgstr "de %s verkita"
#: ../../include/enotify.php:77
msgid "your"
@ -6509,7 +6509,7 @@ msgstr "%s komentis pri elemento/konversacio kiun vi sekvas."
#: ../../include/enotify.php:86
#, php-format
msgid "%s commented on %s."
msgstr "%s komentis pri %s"
msgstr "%s komentis pri %s."
#: ../../include/enotify.php:88 ../../include/enotify.php:101
#: ../../include/enotify.php:112 ../../include/enotify.php:123
@ -6660,7 +6660,7 @@ msgstr "Bonvolu alŝuti profilbildon."
#: ../../include/security.php:25
msgid "Welcome back "
msgstr "Bonvenon"
msgstr "Bonvenon "
#: ../../include/security.php:329
msgid ""
@ -6923,7 +6923,7 @@ msgstr "Mesaĝo"
#: ../../boot.php:1151 ../../boot.php:1223
msgid "g A l F d"
msgstr "g A l F d"
msgstr "\\j\\e \\l\\a G\\a \\h\\o\\r\\o, l F d"
#: ../../boot.php:1152 ../../boot.php:1224
msgid "F d"
@ -6931,11 +6931,11 @@ msgstr "F d"
#: ../../boot.php:1177
msgid "Birthday Reminders"
msgstr "Memorigiloj por naskiĝtagoj"
msgstr "Memorigilo pri naskiĝtagoj"
#: ../../boot.php:1178
msgid "Birthdays this week:"
msgstr "Naskiĝtagoj ĉi-semajne"
msgstr "Naskiĝtagoj ĉi-semajne:"
#: ../../boot.php:1201 ../../boot.php:1266
msgid "[today]"

View File

@ -285,7 +285,7 @@ $a->strings["%s liked %s's post"] = "%s ŝatis la afiŝon de %s";
$a->strings["%s disliked %s's post"] = "%s malŝatis la afiŝon de %s";
$a->strings["%s is now friends with %s"] = "%s amikiĝis kun %s";
$a->strings["%s created a new post"] = "%s kreis novan afiŝon";
$a->strings["%s commented on %s's post"] = "%s komentis pri la afiŝon de %s";
$a->strings["%s commented on %s's post"] = "%s komentis pri la afiŝo de %s";
$a->strings["No more network notifications."] = "Ne pli da retaj atentigoj.";
$a->strings["Network Notifications"] = "Retaj Atentigoj";
$a->strings["No more system notifications."] = "Ne pli da sistemaj atentigoj.";
@ -585,7 +585,7 @@ $a->strings["Your registration can not be processed."] = "Mi ne povas prilabori
$a->strings["Registration request at %s"] = "Peto de registrado al %s";
$a->strings["Your registration is pending approval by the site owner."] = "Via registrado bezonas apropbon de la administranto.";
$a->strings["This site has exceeded the number of allowed daily account registrations. Please try again tomorrow."] = "La retejo transiras la maksimuman kvanton da ĉiutagaj kontaj registradoj. Bonvolu provi denove morgaŭ.";
$a->strings["You may (optionally) fill in this form via OpenID by supplying your OpenID and clicking 'Register'."] = "Vi ankaŭ (nedeviga) povas plenigi la formularo tra OpenID se vi provizas vian OpenID adreson kaj klakas 'Registri'.";
$a->strings["You may (optionally) fill in this form via OpenID by supplying your OpenID and clicking 'Register'."] = "Vi ankaŭ (nedeviga) povas plenigi la formularon tra OpenID se vi provizas vian OpenID adreson kaj klakas 'Registri'.";
$a->strings["If you are not familiar with OpenID, please leave that field blank and fill in the rest of the items."] = "Se vi ne konas OpenID, bonvolu lasi tiun kampon malplena kaj entajpu la aliajn elementojn.";
$a->strings["Your OpenID (optional): "] = "Via OpenID (nedeviga):";
$a->strings["Include your profile in member directory?"] = "Aldoni vian profilon al la membrokatalogo?";
@ -772,7 +772,7 @@ $a->strings["Tips for New Members"] = "Konsilo por novaj membroj";
$a->strings["{0} wants to be your friend"] = "{0} volas amikiĝi kun vi";
$a->strings["{0} sent you a message"] = "{0} sendis mesaĝon al vi";
$a->strings["{0} requested registration"] = "{0} petis registradon";
$a->strings["{0} commented %s's post"] = "{0} komentis pri la afiŝon de %s";
$a->strings["{0} commented %s's post"] = "{0} komentis pri la afiŝo de %s";
$a->strings["{0} liked %s's post"] = "{0} satis la afiŝon de %s";
$a->strings["{0} disliked %s's post"] = "{0} malŝatis la afiŝon de %s";
$a->strings["{0} is now friends with %s"] = "{0} amikiĝis kun %s";
@ -1238,7 +1238,7 @@ $a->strings["Birthday:"] = "Naskiĝtago:";
$a->strings["Age:"] = "Aĝo:";
$a->strings["Status:"] = "Stato:";
$a->strings["Homepage:"] = "Hejmpaĝo:";
$a->strings["Tags:"] = "Tags:";
$a->strings["Tags:"] = "Markoj:";
$a->strings["Religion:"] = "Religio:";
$a->strings["About:"] = "Pri:";
$a->strings["Hobbies/Interests:"] = "Ŝatokupoj/Interesoj:";
@ -1309,7 +1309,7 @@ $a->strings["Friends/Benefits"] = "Amikoj/Avantaĝoj";
$a->strings["Casual"] = "Neformala";
$a->strings["Engaged"] = "Fianĉiginta";
$a->strings["Married"] = "Edziĝinta";
$a->strings["Imaginarily married"] = "Image edziiĝinta";
$a->strings["Imaginarily married"] = "Image edziĝinta";
$a->strings["Partners"] = "Geparuloj";
$a->strings["Cohabiting"] = "Kunloĝanta";
$a->strings["Common law"] = "Registrita partnereco ";
@ -1320,7 +1320,7 @@ $a->strings["Betrayed"] = "Trompita";
$a->strings["Separated"] = "Disiĝinta";
$a->strings["Unstable"] = "Malfirma";
$a->strings["Divorced"] = "Eksedziĝinta";
$a->strings["Imaginarily divorced"] = "Image maledziiĝinta";
$a->strings["Imaginarily divorced"] = "Image eksedziĝinta";
$a->strings["Widowed"] = "Vidva";
$a->strings["Uncertain"] = "Ne certa";
$a->strings["It's complicated"] = "Estas komplika";
@ -1467,11 +1467,11 @@ $a->strings["%s sent you a new private message at %s."] = "%s sendis novan mesa
$a->strings["%s sent you %s."] = "%s sendis al vi %s.";
$a->strings["a private message"] = "privatan mesaĝon";
$a->strings["Please visit %s to view and/or reply to your private messages."] = "Bonvolu viziti %s por vidi aŭ respondi viajn privatajn mesaĝojn.";
$a->strings["%s's"] = "de %s";
$a->strings["%s's"] = "de %s verkita";
$a->strings["your"] = "via";
$a->strings["[Friendica:Notify] Comment to conversation #%d by %s"] = "[Friendica:Atentigo] Komento pri konversacio #%d de %s";
$a->strings["%s commented on an item/conversation you have been following."] = "%s komentis pri elemento/konversacio kiun vi sekvas.";
$a->strings["%s commented on %s."] = "%s komentis pri %s";
$a->strings["%s commented on %s."] = "%s komentis pri %s.";
$a->strings["Please visit %s to view and/or reply to the conversation."] = "Bonvolu viziti %s por vidi aŭ respondi la konversacion.";
$a->strings["[Friendica:Notify] %s posted to your profile wall"] = "[Friendica:Atentigo] %s afiŝis al via profilmuro";
$a->strings["%s posted to your profile wall at %s"] = "%s skribis al via profila muro ĉe %s";
@ -1504,7 +1504,7 @@ $a->strings["image/photo"] = "bildo";
$a->strings["link"] = "ligilo";
$a->strings["Welcome "] = "Bonvenon ";
$a->strings["Please upload a profile photo."] = "Bonvolu alŝuti profilbildon.";
$a->strings["Welcome back "] = "Bonvenon";
$a->strings["Welcome back "] = "Bonvenon ";
$a->strings["The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before submitting it."] = "La sekuriga ĵetono de la formo estis malĝusta. Tio verŝajne okazis ĉar la formo estis malfermita dum tro longa tempo (>3 horoj) antaŭ la sendado.";
$a->strings["View Status"] = "Vidi Staton";
$a->strings["View Profile"] = "Vidi Profilon";
@ -1568,10 +1568,10 @@ $a->strings["Or login using OpenID: "] = "Aŭ ensaluti per OpenID:";
$a->strings["Forgot your password?"] = "Ĉu vi vorgesis vian pasvorton?";
$a->strings["Edit profile"] = "Redakti profilon";
$a->strings["Message"] = "Mesaĝo";
$a->strings["g A l F d"] = "g A l F d";
$a->strings["g A l F d"] = "\\j\\e \\l\\a G\\a \\h\\o\\r\\o, l F d";
$a->strings["F d"] = "F d";
$a->strings["Birthday Reminders"] = "Memorigiloj por naskiĝtagoj";
$a->strings["Birthdays this week:"] = "Naskiĝtagoj ĉi-semajne";
$a->strings["Birthday Reminders"] = "Memorigilo pri naskiĝtagoj";
$a->strings["Birthdays this week:"] = "Naskiĝtagoj ĉi-semajne:";
$a->strings["[today]"] = "[hodiaŭ]";
$a->strings["Event Reminders"] = "Memorigiloj pri Okazoj";
$a->strings["Events this week:"] = "Okazoj ĉi-semajne:";

84
view/filebrowser.tpl Normal file
View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce_popup.js"></script>
<style>
.panel_wrapper div.current{.overflow: auto; height: auto!important; }
.filebrowser.path { font-family: fixed; font-size: 10px; background-color: #f0f0ee; height:auto; overflow:auto;}
.filebrowser.path a { border-left: 1px solid #C0C0AA; background-color: #E0E0DD; display: block; float:left; padding: 0.3em 1em;}
.filebrowser ul{ list-style-type: none; padding:0px; }
.filebrowser.folders a { display: block; padding: 0.3em }
.filebrowser.folders a:hover { background-color: #f0f0ee; }
.filebrowser.files.image { overflow: auto; height: auto; }
.filebrowser.files.image img { height:50px;}
.filebrowser.files.image li { display: block; padding: 5px; float: left; }
.filebrowser.files.image span { display: none;}
.filebrowser.files.file img { height:16px; vertical-align: bottom;}
.filebrowser.files a { display: block; padding: 0.3em}
.filebrowser.files a:hover { background-color: #f0f0ee; }
.filebrowser a { text-decoration: none; }
</style>
<script>
var FileBrowserDialogue = {
init : function () {
// Here goes your code for setting your custom things onLoad.
},
mySubmit : function (URL) {
//var URL = document.my_form.my_field.value;
var win = tinyMCEPopup.getWindowArg("window");
// insert information now
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = URL;
// are we an image browser
if (typeof(win.ImageDialog) != "undefined") {
// we are, so update image dimensions...
if (win.ImageDialog.getImageData)
win.ImageDialog.getImageData();
// ... and preview if necessary
if (win.ImageDialog.showPreviewImage)
win.ImageDialog.showPreviewImage(URL);
}
// close popup window
tinyMCEPopup.close();
}
}
tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
</script>
</head>
<body>
<div class="tabs">
<ul >
<li class="current"><span>FileBrowser</span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<div class="filebrowser path">
{{ for $path as $p }}<a href="$p.0">$p.1</a>{{ endfor }}
</div>
<div class="filebrowser folders">
<ul>
{{ for $folders as $f }}<li><a href="$f.0/">$f.1</a></li>{{ endfor }}
</ul>
</div>
<div class="filebrowser files $type">
<ul>
{{ for $files as $f }}
<li><a href="#" onclick="FileBrowserDialogue.mySubmit('$f.0'); return false;"><img src="$f.2"><span>$f.1</span></a></li>
{{ endfor }}
</ul>
</div>
</div>
</div>
<div class="mceActionPanel">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</body>
</html>

View File

@ -26,7 +26,7 @@ function initEditor(cb){
mode : "specific_textareas",
editor_selector: $editselect,
auto_focus: "profile-jot-text",
plugins : "bbcode,paste,autoresize",
plugins : "bbcode,paste,autoresize, inlinepopups",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
@ -44,6 +44,7 @@ function initEditor(cb){
convert_urls: false,
content_css: "$baseurl/view/custom_tinymce.css",
theme_advanced_path : false,
file_browser_callback : "fcFileBrowser",
setup : function(ed) {
cPopup = null;
ed.onKeyDown.add(function(ed,e) {