From: friendica Date: Tue, 7 Feb 2012 08:13:16 +0000 (-0800) Subject: more fixes for textmode X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c6cdad946eac99ced15cd8fa294ab0fdaa05f3a5;p=friendica.git more fixes for textmode --- diff --git a/mod/parse_url.php b/mod/parse_url.php index 2df9de4763..e0b378f685 100755 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -12,6 +12,13 @@ function parse_url_content(&$a) { $text = null; $str_tags = ''; + $textmode = false; + if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) + $textmode = true; + + if($textmode) + $br = (($textmode) ? "\n" : '
'; + $str_tags = $br . implode(' ',$arr_tags) . $br; } } logger('parse_url: ' . $url); - $template = "
%s%s
"; + if($textmode) + $template = $br . '[bookmark=%s]%s[/bookmark]%s' . $br; + else + $template = "
%s%s
"; $arr = array('url' => $url, 'text' => ''); @@ -49,7 +59,11 @@ function parse_url_content(&$a) { if($url && $title && $text) { - $text = '

' . $text . '

'; + if($textmode) + $text = $br . $br . '[quote]' . $text . '[/quote]' . $br; + else + $text = '

' . $text . '

'; + $title = str_replace(array("\r","\n"),array('',''),$title); $result = sprintf($template,$url,($title) ? $title : $url,$text) . $str_tags; @@ -208,10 +222,17 @@ function parse_url_content(&$a) { $ph->scaleImage(300); $new_width = $ph->getWidth(); $new_height = $ph->getHeight(); - $image = '

photo'; + if($textmode) + $image = $br . $br . '[img=' . $new_width . 'x' . $new_height . ']' . $image . '[/img]'; + else + $image = '

photo'; + } + else { + if($textmode) + $image = $br . $br . '[img]' . $image . '[/img]'; + else + $image = '

photo'; } - else - $image = '

photo'; } else $image = ''; @@ -223,11 +244,14 @@ function parse_url_content(&$a) { } if(strlen($text)) { - $text = '

' . $text . '

'; + if($textmode) + $text = $br .$br . '[quote]' . $text . '[/quote]' . $br ; + else + $text = '

' . $text . '

'; } if($image) { - $text = $image . '
' . $text; + $text = $image . $br . $text; } $title = str_replace(array("\r","\n"),array('',''),$title); diff --git a/mod/wall_upload.php b/mod/wall_upload.php index b34f2cf6b0..278c213547 100755 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -100,7 +100,11 @@ function wall_upload_post(&$a) { } $basename = basename($filename); - echo '

\"$basename\"

"; + + if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) + echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.jpg[/img][/url]\n\n"; + else + echo '

\"$basename\"

"; killme(); // NOTREACHED diff --git a/view/theme/dispy/jot-header.tpl b/view/theme/dispy/jot-header.tpl index 79db0ec5ae..8dccf71ed0 100755 --- a/view/theme/dispy/jot-header.tpl +++ b/view/theme/dispy/jot-header.tpl @@ -9,6 +9,33 @@ function initEditor(cb) { if (editor==false) { $("#profile-jot-text-loading").show(); $("#jot-title-desc").show(); + if(plaintext == 'none') { + $("#profile-jot-text-loading").hide(); + $("#profile-jot-text").css({ 'height': 200, 'color': '#000' }); + $(".jothidden").show(); + editor = true; + $("a#jot-perms-icon").fancybox({ + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic' + }); + $("#profile-jot-submit-wrapper").show(); + {{ if $newpost }} + $("#profile-upload-wrapper").show(); + $("#profile-attach-wrapper").show(); + $("#profile-link-wrapper").show(); + $("#profile-video-wrapper").show(); + $("#profile-audio-wrapper").show(); + $("#profile-location-wrapper").show(); + $("#profile-nolocation-wrapper").show(); + $("#profile-title-wrapper").show(); + $("#profile-jot-plugin-wrapper").show(); + $("#jot-preview-link").show(); + {{ endif }} + + + if (typeof cb!="undefined") cb(); + return; + } tinyMCE.init({ theme : "advanced", mode : "specific_textareas", @@ -132,7 +159,7 @@ function initEditor(cb) { name: 'userfile', onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onComplete: function(file,response) { - tinyMCE.execCommand('mceInsertRawHTML',false,response); + addeditortext(response); $('#profile-rotator').hide(); } } @@ -143,7 +170,7 @@ function initEditor(cb) { name: 'userfile', onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onComplete: function(file,response) { - tinyMCE.execCommand('mceInsertRawHTML',false,response); + addeditortext(response); $('#profile-rotator').hide(); } } @@ -190,7 +217,7 @@ function initEditor(cb) { reply = bin2hex(reply); $('#profile-rotator').show(); $.get('parse_url?binurl=' + reply, function(data) { - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#profile-rotator').hide(); }); } @@ -199,21 +226,21 @@ function initEditor(cb) { function jotGetVideo() { reply = prompt("$utubeurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]'); + addeditortext('[youtube]' + reply + '[/youtube]'); } } function jotVideoURL() { reply = prompt("$vidurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]'); + addeditortext('[video]' + reply + '[/video]'); } } function jotAudioURL() { reply = prompt("$audurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]'); + addeditortext('[audio]' + reply + '[/audio]'); } } @@ -237,7 +264,7 @@ function initEditor(cb) { $.get('share/' + id, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#like-rotator-' + id).hide(); $(window).scrollTop(0); }); @@ -260,7 +287,7 @@ function initEditor(cb) { $.get('parse_url?binurl=' + reply, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#profile-rotator').hide(); }); }); @@ -272,6 +299,15 @@ function initEditor(cb) { $('#profile-nolocation-wrapper').hide(); } + function addeditortext(data) { + if(plaintext == 'none') { + var currentText = $("#profile-jot-text").val(); + $("#profile-jot-text").val(currentText + data); + } + else + tinyMCE.execCommand('mceInsertRawHTML',false,data); + } + $geotag diff --git a/view/theme/testbubble/jot-header.tpl b/view/theme/testbubble/jot-header.tpl index 0d9a824f75..b44ea78fdd 100755 --- a/view/theme/testbubble/jot-header.tpl +++ b/view/theme/testbubble/jot-header.tpl @@ -4,10 +4,38 @@ var editor=false; var textlen = 0; +var plaintext = '$editselect'; function initEditor(cb) { if (editor==false) { $("#profile-jot-text-loading").show(); + if(plaintext == 'none') { + $("#profile-jot-text-loading").hide(); + $("#profile-jot-text").css({ 'height': 200, 'color': '#000' }); + $(".jothidden").show(); + editor = true; + $("a#jot-perms-icon").fancybox({ + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic' + }); + $("#profile-jot-submit-wrapper").show(); + {{ if $newpost }} + $("#profile-upload-wrapper").show(); + $("#profile-attach-wrapper").show(); + $("#profile-link-wrapper").show(); + $("#profile-video-wrapper").show(); + $("#profile-audio-wrapper").show(); + $("#profile-location-wrapper").show(); + $("#profile-nolocation-wrapper").show(); + $("#profile-title-wrapper").show(); + $("#profile-jot-plugin-wrapper").show(); + $("#jot-preview-link").show(); + {{ endif }} + + + if (typeof cb!="undefined") cb(); + return; + } tinyMCE.init({ theme : "advanced", mode : "specific_textareas", @@ -132,7 +160,7 @@ function initEditor(cb) { name: 'userfile', onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onComplete: function(file,response) { - tinyMCE.execCommand('mceInsertRawHTML',false,response); + addeditortext(response); $('#profile-rotator').hide(); } } @@ -143,7 +171,7 @@ function initEditor(cb) { name: 'userfile', onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onComplete: function(file,response) { - tinyMCE.execCommand('mceInsertRawHTML',false,response); + addeditortext(response); $('#profile-rotator').hide(); } } @@ -190,7 +218,7 @@ function initEditor(cb) { reply = bin2hex(reply); $('#profile-rotator').show(); $.get('parse_url?binurl=' + reply, function(data) { - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#profile-rotator').hide(); }); } @@ -199,14 +227,14 @@ function initEditor(cb) { function jotVideoURL() { reply = prompt("$vidurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]'); + addeditortext('[video]' + reply + '[/video]'); } } function jotAudioURL() { reply = prompt("$audurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]'); + addeditortext('[audio]' + reply + '[/audio]'); } } @@ -230,7 +258,7 @@ function initEditor(cb) { $.get('share/' + id, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#like-rotator-' + id).hide(); $(window).scrollTop(0); }); @@ -253,7 +281,7 @@ function initEditor(cb) { $.get('parse_url?binurl=' + reply, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#profile-rotator').hide(); }); }); @@ -282,6 +310,16 @@ function initEditor(cb) { $('#profile-nolocation-wrapper').hide(); } + function addeditortext(data) { + if(plaintext == 'none') { + var currentText = $("#profile-jot-text").val(); + $("#profile-jot-text").val(currentText + data); + } + else + tinyMCE.execCommand('mceInsertRawHTML',false,data); + } + + $geotag