]> git.mxchange.org Git - friendica.git/commitdiff
Add javascript var "baseurl"
authorFabio Comuni <fabrix.xm@gmail.com>
Thu, 30 Jun 2011 14:42:27 +0000 (16:42 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Thu, 30 Jun 2011 14:42:27 +0000 (16:42 +0200)
Add field_richtext template

view/default.php
view/field_richtext.tpl [new file with mode: 0644]

index 60bda26695bc634672094d384cdebe6b4ea13ba6..0d4a690541c09b406789a736de82c751d12e6fd7 100644 (file)
@@ -2,6 +2,7 @@
 <html>\r
 <head>\r
   <title><?php if(x($page,'title')) echo $page['title'] ?></title>\r
+  <script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>\r
   <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>\r
 </head>\r
 <body>\r
diff --git a/view/field_richtext.tpl b/view/field_richtext.tpl
new file mode 100644 (file)
index 0000000..a5a453d
--- /dev/null
@@ -0,0 +1,44 @@
+       
+       <div class='field richtext'>
+               <label for='id_$field.0'>$field.1</label>
+               <textarea name='$field.0' id='id_$field.0' class="fieldRichtext">$field.2</textarea>
+               <span class='field_help'>$field.3</span>
+               <script>
+                       console.log(typeof tinyMCE);
+                       if(typeof tinyMCE == "undefined") {
+                               tinyMCE="loading";
+                               window.tinyMCEPreInit = {
+                                       suffix:"",
+                                       base: baseurl+"/library/tinymce/jscripts/tiny_mce/",
+                                       query:"",
+                               };
+                               $(function(){
+                                       $.getScript(baseurl     +"/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js", function(){
+                                               tinyMCE.init({
+                                                       theme : "advanced",
+                                                       mode : "specific_textareas",
+                                                       editor_selector: "fieldRichtext",
+                                                       plugins : "bbcode,paste",
+                                                       theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
+                                                       theme_advanced_buttons2 : "",
+                                                       theme_advanced_buttons3 : "",
+                                                       theme_advanced_toolbar_location : "top",
+                                                       theme_advanced_toolbar_align : "center",
+                                                       theme_advanced_blockformats : "blockquote,code",
+                                                       paste_text_sticky : true,
+                                                       entity_encoding : "raw",
+                                                       add_unload_trigger : false,
+                                                       remove_linebreaks : false,
+                                                       force_p_newlines : false,
+                                                       force_br_newlines : true,
+                                                       forced_root_block : '',
+                                                       convert_urls: false,
+                                                       content_css: baseurl+"/view/custom_tinymce.css",
+                                                       theme_advanced_path : false,
+                                               });
+                                       });
+                               });
+                       }
+               </script>
+               
+       </div>