Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[livejournal] r19642: LJSUP-8974: RTE: Ability to add and disp...

Committer: vkurkin
LJSUP-8974: RTE: Ability to add and display lj-like buttons
U   trunk/cgi-bin/LJ/Widget/EntryForm.pm
U   trunk/cgi-bin/weblib.pl
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
U   trunk/htdocs/update.bml
Modified: trunk/cgi-bin/LJ/Widget/EntryForm.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryForm.pm	2011-08-08 14:35:26 UTC (rev 19641)
+++ trunk/cgi-bin/LJ/Widget/EntryForm.pm	2011-08-09 03:25:55 UTC (rev 19642)
@@ -1471,7 +1471,6 @@
             'LJLike_button_give' => 'ljlike.button.give',
             'LJLike_WizardNotice' => 'ljlike.wizardnotice',
             'LJLike_WizardNoticeLink' => 'ljlike.wizardnoticelink',
-            'LJLike_FAQ' => 'ljlike.faq',
             'LJUser_WizardNotice' => 'ljuser.wizardnotice',
             'LJUser_WizardNoticeLink' => 'ljuser.wizardnoticelink',
             'LJLink_WizardNotice' => 'ljlink.wizardnotice',

Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2011-08-08 14:35:26 UTC (rev 19641)
+++ trunk/cgi-bin/weblib.pl	2011-08-09 03:25:55 UTC (rev 19642)
@@ -260,8 +260,9 @@
     my $url = $LJ::HELPURL{$topic} or return "";
     my $pre = shift || "";
     my $post = shift || "";
+    my $title = shift || "";
     # FIXME: use LJ::img() here, not hard-coding width/height
-    return "$pre<a href=\"$url\" class=\"helplink\" target=\"_blank\"><img src=\"$LJ::IMGPREFIX/help.gif\" alt=\"Help\" title=\"Help\" width='14' height='14' border='0' /></a>$post";
+    return "$pre<a href=\"$url\" class=\"helplink\" target=\"_blank\"><img src=\"$LJ::IMGPREFIX/help.gif\" alt=\"Help\" title=\"Help\" width=\"14\" height=\"14\" border=\"0\" />$title</a>$post";
 }
 
 # <LJFUNC>
@@ -1394,9 +1395,6 @@
 
         my $site_params = LJ::js_dumper(\%site);
 
-        my $current_lang = eval { BML::get_language(); } || ($LJ::DEFAULT_LANG || $LJ::LANGS[0]);
-           $current_lang =~ s/^([^_]+)_.*/$1/; # en_LJ -> en
-
         my $journal_info_json = LJ::JSON->to_json(\%journal_info);
         my $jsml_out = LJ::JSON->to_json(\%LJ::JSML);
         $ret .= qq {
@@ -1408,7 +1406,6 @@
                     for (i in p) Site[i] = p[i];
                 })();
                 Site.current_journal = $journal_info_json;
-                Site.current_lang    = '$current_lang';
            </script>
         };
 

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-08 14:35:26 UTC (rev 19641)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-09 03:25:55 UTC (rev 19642)
@@ -476,7 +476,7 @@
 			//////////  LJ Image Button //////////////
 			editor.addCommand('LJImage', {
 				exec : function(editor){
-					if(ljphotoEnabled){
+					if(window.ljphotoEnabled){
 						// call LJImage
 					} else {
 						if(ljNoteData.LJImage.node){
@@ -775,7 +775,7 @@
 				dialogContent += button.htmlOpt;
 			}
 
-			dialogContent += '</ul><a href="/support/faqbrowse.bml?faqid=344" class="helplink" target="_blank"><img src="/img/help.gif" alt="Help" title="Help" width="14" height="14" border="0"> ' + top.CKLang.LJLike_FAQ + '</a>';
+			dialogContent += '</ul>' + window.faqLink;
 
 			var countChanges = 0, ljLikeDialog, ljLikeInputs;
 			
@@ -783,7 +783,7 @@
 				var command = editor.getCommand('LJLikeCommand');
 				if(command.state == CKEDITOR.TRISTATE_OFF){
 					this.$.checked ? countChanges++ : countChanges--;
-					ljLikeDialog.getButton('LJLike_Ok').getElement()[countChanges == 0 ? 'hide' : 'show']();
+					ljLikeDialog.getButton('LJLike_Ok').getElement()[countChanges == 0 ? 'addClass' : 'removeClass']('btn-disabled');
 				}
 			}
 
@@ -807,6 +807,10 @@
 						id : 'LJLike_Ok',
 						label : editor.lang.common.ok,
 						onClick : function(){
+							if(ljLikeDialog.getButton('LJLike_Ok').getElement().hasClass('btn-disabled')){
+								return false;
+							}
+
 							var attr = [],
 								likeHtml = '',
 								likeNode = ljNoteData.LJLikeCommand.node;
@@ -858,7 +862,7 @@
 						}
 
 						if(countChanges > 0){
-							ljLikeDialog.getButton('LJLike_Ok').getElement().show();
+							ljLikeDialog.getButton('LJLike_Ok').getElement().removeClass('btn-disabled');
 						}
 					},
 					onLoad: function(){
@@ -1084,4 +1088,4 @@
 		requires : [ 'fakeobjects' ]
 	});
 
-})();
\ No newline at end of file
+})();

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2011-08-08 14:35:26 UTC (rev 19641)
+++ trunk/htdocs/update.bml	2011-08-09 03:25:55 UTC (rev 19642)
@@ -366,6 +366,14 @@
         my $js = undef;
         $$body .= LJ::entry_form($entry, \$$head, $onload, $errors, \$js);
         $$body .= "</form><!-- end #updateForm -->\n";
+        my $like_faq_link = LJ::help_icon_html('like', undef, undef, BML::ml('fcklang.ljlike.faq'));
+        $$body .= <<LIKE_FAQ;
+        <script type="text/javascript">
+        // <![CDATA[
+            window.faqLink = '$like_faq_link';
+        // ]]>
+        </script>
+LIKE_FAQ
         $$body .= $js;
 	
         ## Show a new photoalbums interface only for logged-in users
@@ -808,7 +816,7 @@
 
         function init_update_bml() {
             window.isSupUser = $is_sup;
-            setTimeout(function(){ $initDraft }, 0)
+            $initDraft;
             $_[0]->{'onload'}
             $pageload
         }

Tags: b_vladi, bml, js, livejournal, pl, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments