00001 <?php
00002 namespace Habari;
00003 if ( !defined( 'HABARI_PATH' ) ) { die('No direct access'); }
00004 ?>
00005 <?php include('header.php'); ?>
00006
00007 <?php $form->out(); ?>
00008
00009
00010 <script type="text/javascript">
00011 $(document).ready(function(){
00012
00013
00014
00015 $('#publish').click( function() {
00016 $('#create_content').submit();
00017 });
00018
00019 $('#create_content').submit(function(){
00020 $('.check-change').each(function() {
00021 $(this).data('checksum', crc32($(this).val()));
00022 });
00023 });
00024
00025 $('.check-change').each(function() {
00026 $(this).data('checksum', crc32($(this).val()));
00027 $(this).data('oldvalue', $(this).val());
00028 });
00029
00030 window.onbeforeunload = function(){
00031 changed = false;
00032 $('.check-change').each(function() {
00033 if ($(this).data('checksum') != crc32($(this).val())) {
00034 console.log([$(this).data('oldvalue'), $(this).val()]);
00035 changed = true;
00036 }
00037 });
00038 if (changed) {
00039 spinner.start(); spinner.stop();
00040 return '<?php
00041 // Note to translators: the 'new-line character' is an actual "\n" not a new-line character
00042 _e('You did not save the changes you made. \nLeaving this page will result in the loss of data.');
00043 ?>';
00044 }
00045 };
00046
00047 });
00048 </script>
00049
00050 <?php include('footer.php'); ?>