- Timestamp:
- Sep 5, 2010, 6:01:37 AM (13 years ago)
- Location:
- en
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
en/dev/translation/editor.css
r188 r189 82 82 #tr-editor.success { background-color: #ACDCA1; } 83 83 #tr-editor.success .buttons { visibility:hidden; } 84 #tr-editor.error { background-color: #dca1a1; } 85 #tr-editor.error p { color: black; background-color: red; display: inline; } 84 86 #tr-editor .response { 85 87 font-size: 154%; … … 114 116 } 115 117 118 /* body.tr-enabled shows only .tr-enabled elements, and vice versa */ 116 119 body.tr-enabled .tr-disabled, body.tr-disabled .tr-enabled { display: none; } 117 120 body.tr-enabled .tr-enabled, body.tr-disabled .tr-disabled { display: block; } 121 /* default value, if no body.tr-* present: same state as .tr-disabled! */ 122 body .tr-enabled { display: none; } 123 body .tr-disabled { display: block; } 118 124 119 125 #sidebar-tr .tr-disabled h3 { margin: 0; font-size: 100%; } … … 148 154 text-decoration: none; 149 155 } 156 157 /* For an optional message at the top */ 158 #tr-topnotice { 159 background-color: #ACDCA1; 160 padding: 0.1em 1em; margin-bottom: 1em; 161 -moz-box-shadow: 1px 0 8px #999999; 162 } 163 164 body.tr-disabled #tr-topnotice { display: none; } 150 165 151 166 /* -
en/dev/translation/editor.js
r188 r189 14 14 t29.tr.settings = { 15 15 disable_img_license_system: true, // when tr system enabled, disable img licenses for more cleareness 16 editable_elements: function(){ return $("#content").find("p, ul, blockquote, h2, h3"); },16 editable_elements: function(){ return $("#content").find("p, ul, ol, blockquote, h2, h3"); }, 17 17 infobox_default: "<b>Click</b> to contribute a better translation", 18 18 infobox_corrected: "<span class='thanks'>Thank you for your correction.</span> Click to improve your text again.", 19 editorbox_heading: "Contribute a better translation" 19 editorbox_heading: "Contribute a better translation", 20 top_notice_text: "<h3>Thank you for improving this page</h3><p>Simply hover the text with your mouse and edit a paragraph by clicking on it.</p>" 20 21 }; 21 22 … … 34 35 if(!t29.tr.is_enabled()) $("body").addClass("tr-disabled"); // prepare 35 36 t29.tr.sidebar = $("#sidebar-tr"); 36 t29.tr.sidebar.find(".tr-disabled a").click(function() {37 t29.tr.set_enabled(true);38 return false;39 }).attr('href', '#help_with_mistakes'); // href for nicer look40 41 37 t29.tr.sidebar.find(".tr-enabled .button").click(t29.tr.call("set_enabled",false)); 42 38 … … 96 92 } else { 97 93 // system powered off 98 // t29.tr.set_editing(false) already called. 99 // so we can safely remove any handlers 100 t29.tr.editables.unbind(); 94 t29.tr.set_editing(false); // for safety, just another time 95 t29.tr.editables.unbind(); // safely remove *all* hovering handlers 96 // remove any old trash: 97 $(".tr-inspecting").removeClass("tr-inspecting"); 98 t29.tr.mouseout_editables(); // falls noch was uebrig ist 101 99 } 102 100 return true; // success … … 108 106 **/ 109 107 t29.tr.mouseover_editables = function() { 110 if(t29.tr.is_editing()) return; // disable while editing 108 if(!t29.tr.is_enabled() || t29.tr.is_editing()) return; // disable while editing 109 if(t29.tr.current_editable) { 110 // this is weird and should not be - cleanup missed! 111 t29.tr.current_editable.removeClass("tr-inspecting"); 112 } 111 113 t29.tr.current_editable = $(this).addClass('tr-inspecting'); 112 114 … … 224 226 // stop editing 225 227 t29.tr.initial_editor = null; 226 old_editor.attr("contenteditable", "false").removeClass("tr-editing"); 228 // v- falls es noch irgendeinen anderen Muell geben sollte 229 old_editor.add(".tr-editing").attr("contenteditable", "false").removeClass("tr-editing"); 227 230 t29.tr.editorbox.hide(); 228 231 } … … 252 255 // button submitting 253 256 if(!t29.tr.is_really_editing()) { 254 alert("You didn't make any changes to the text. Where's the improvement? :-)"); 255 return false; 257 // funktioniert nicht zuverlaessig. 258 //alert("You didn't make any changes to the text. Where's the improvement? :-)"); 259 //return false; 256 260 } 257 261 … … 261 265 success: t29.tr.submit_successful, 262 266 error: function(req, textStatus) { 263 alert("I'm sorry, submitting the text failed due to "+textStatus 264 +"\nPlease mail your text to "+"ed.92mukinhcet@ved".split("").reverse().join("")); 265 t29.tr.editorbox.removeClass('loading'); 267 t29.tr.editorbox.removeClass('loading').addClass('error'); 268 t29.tr.editorbox.find('h3').html("Sending your improved text failed!"); 269 t29.tr.editorbox.find('p').html("Please consult the <span class='button small red'>Help</span>") 270 .find('.button').click(t29.tr.help); 271 if(req.responseText) 272 t29.tr.editorbox.find('p').prepend("<b>"+req.responseText+"</b> "); 273 alert("Submitting your text failed!"); 266 274 }, 267 275 data: { … … 269 277 page: location.href, 270 278 node: "foobar", // t29.tr.editor XQUERY PATH 271 initial_text: t29.tr.initial_editor.html(), 272 new_text: t29.tr.editor.html() 279 initial_text: t29.tr.initial_editor.text().replace(/\s+/g,' '), 280 initial_html: t29.tr.initial_editor.html(), 281 new_text: t29.tr.editor.text().replace(/\s+/g,' '), 282 new_html: t29.tr.editor.html() 273 283 } 274 284 }); … … 323 333 t29.tr.editorbox.find(".cancel").click(t29.tr.stop_editing); 324 334 t29.tr.editorbox.find(".submit").click(t29.tr.submit_editing); 335 t29.tr.editorbox.find(".help").click(t29.tr.help); 325 336 326 337 t29.tr.editorbox.css({ … … 329 340 width: t29.tr.editor.width() 330 341 }).show(); 342 }; 343 344 /** 345 * Open a nice help window 346 **/ 347 t29.tr.help = function() { 348 window.open("http://dev.technikum29.de/wiki/%dcbersetzung/Help"); 349 331 350 }; 332 351 … … 353 372 } 354 373 374 t29.tr.display_top_notice = function() { 375 $("<div id='tr-topnotice'/>").html(t29.tr.settings.top_notice_text).prependTo("#content"); 376 }; 377 355 378 // Master entry point: Load onload handler at startup. 356 379 $(t29.tr.onload); -
en/dev/translation/submit.php
r187 r189 1 Thank you 1 <?php 2 /** 3 * technikum29 translation system submission for AJAX calls. 4 * September 2010, Quick and dirty 5 **/ 6 7 function get($var, $default=false, $valids=null, $do_not_check_for_bad_input=false) { 8 $value = isset($_POST[$var]) ? $_POST[$var] : $default; 9 if(isset($valids) && !in_array($value, $valids)) $value = $default; 10 if(preg_match('/<(\s*)(script|style)|php|javascript|on[a-z]=/i', $value)) { 11 // bad content! Exit immediately. 12 header("HTTP/1.1 400 Bad Request"); 13 print "Illegal value for '$var'. Please contact the staff."; 14 exit(); 15 } 16 return $value; 17 } 18 19 $source = get("source", false, array('ajax')); 20 $page = get("page"); 21 $node = get("node"); 22 $initial_text = get("initial_text"); 23 $initial_html = get("initial_html"); 24 $new_text = get("new_text"); 25 $new_html = get("new_html"); 26 27 // spamschutz 28 if(!$source) { 29 header("HTTP/1.1 400 Bad Request"); 30 print "Only AJAX driven calls are allowed."; 31 exit; 32 } 33 34 // some intermediates 35 $pagename = preg_match("#/([^/]+?)(\.[a-z]+)?$#i", $page, $pageparts) ? $pageparts[1] : false; 36 37 // setup mail 38 $to = "sven"; 39 $to .= "@technikum29.de"; // spamschutz (svn!) 40 $subject = "t29 translation submission"; 41 if($pagename) $subject .= " for $pagename"; 42 $message = <<<HERE 43 This ist technikum29 translation system at /en/dev/translation/submit.php form mailer. 44 A user translated, using $source, 45 Page: $page 46 Node: $node 47 48 New Plain Text is: 49 50 ----------------------- START OF USER TEXT ------------------------------------ 51 $new_text 52 ------------------------ END OF USER TEXT ------------------------------------- 53 54 Versus old Plaintext was: 55 56 ----------------------- START OF OLD TEXT ------------------------------------ 57 $initial_text 58 ------------------------ END OF OLD TEXT ------------------------------------- 59 60 New HTML is: 61 62 ------------------------ START OF USER HTML ----------------------------------- 63 $new_html 64 ------------------------ END OF USER HTML ------------------------------------- 65 66 Old HTML was: 67 68 ------------------------ START OF OLD HTML ----------------------------------- 69 $initial_html 70 ------------------------ END OF OLD HTML ------------------------------------- 71 72 Something about the user: 73 74 Referer: $_SERVER[HTTP_REFERER] 75 Agent: $_SERVER[HTTP_USER_AGENT] 76 IP: $_SERVER[REMOTE_ADDR] 77 HERE; 78 79 // Send mail right now 80 81 if(mail($to, $subject, $message, "From: t29-translation-www"."@technikum29.de")) { 82 // mail successfully sent 83 print "Mail successfully sent :)"; 84 } else { 85 // error at mail sending!!! 86 header("HTTP/1.1 500 Internal Server Error"); 87 print "I'm sorry, I could not mail your text to the developer team."; 88 } 89 90 -
en/inc/head.inc.shtm
r187 r189 22 22 <script type="text/javascript" src="/shared/js/common.js"></script> 23 23 <!-- translation system --> 24 < script type="text/javascript" src="/en/dev/translation/editor.js"></script>24 <!--<script type="text/javascript" src="/en/dev/translation/editor.js"></script>--> 25 25 <link rel="stylesheet" type="text/css" href="/en/dev/translation/editor.css" /> 26 26 <!-- translation end --> -
en/inc/menu.inc.shtm
r187 r189 81 81 <p>This site was voluntarily trans­lated by project collab­orators. 82 82 We'ld love to get your help!</p> 83 <a class="button white medium" href="/en/dev/translation/ traditional.php?page=<!--#echo var="DOCUMENT_URI" -->"83 <a class="button white medium" href="/en/dev/translation/editor.php?page=<!--#echo var="DOCUMENT_URI" -->" 84 84 title="Edit sentences directly inline!">Improve this page</a> 85 85 </div>
Note: See TracChangeset
for help on using the changeset viewer.