Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 19:51

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 5 posts ] 
Author Message
PostPosted: 10 Oct 2011, 00:29 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Post Crash Protection

MOD-Title: Post Crash Protection
MOD-Version: 0.0.2
MOD-Author: 4seven

Credit: BNa

phpBB-Version: phpBB 3.0.x
phpBB-Languages: en
phpBB-Styles: prosilver

License: GNU General Public License v2

MOD-Description: This Mod saves the last Post and PM of each User, if Browser or Os crashes

Features: (v.0.0.2)
- Saving post and pm in adjustable interval for each reg. user
- Post/PM is saved, no matter if your browser/os crashes or you closing browser/tab
- Additions for genuine phpBB QR and Prime Quick Reply

Screens:
- post: http://www.loaditup.de/files/619571_2ttey4wwrw.jpg
- pm: http://www.loaditup.de/files/619572_b97tw4mfak.jpg

Quote:
Demo:
- http://4seven.bplaced.net/forum/media/postin ... e=post&f=9 (un: tester | pw: testuser)

- Write or copy a text to postbox and close the browser (currently the post is saved each 3 sec.)
- Then start the browser, may logg in again and click on button [Insert Saved Post] (posting) / [Insert Saved PM] (pm)
- Note: Write nothing in postbox, before u insert the saved text, bcs. the saving of post start again.


Download:
Attachment:
Post_Crash_Protection_v.0.0.2.zip [34.08 KiB]
Downloaded 542 times

Image

Image

Requirements: Javascript enabled

Quote:
Addition #1 for genuine phpBB3 QR for v.0.0.2
Instruction: viewtopic.php?p=174#p174

Demo: http://4seven.bplaced.net/forum/3/viewtopic.php?f=3&t=6 (un:tester | pw: tester)

Quote:
Addition #2 for Prime Quick Reply for v.0.0.2
Instruction: viewtopic.php?p=175#p175

Demo: viewtopic.php?f=2&t=79&p=173#p173 (un:test| pw: testuser)

Screen: http://www.loaditup.de/files/624116_pnm275urmb.jpg

Quote:
Fixed/Optimized: (v.0.0.2)
- Independent Posting- and PM-Save
- Linebreak bug on js insert is fixed
- Main code reviewed and corrected
- Reduce Spoiler to discrete Insert-Button
- Move Template-Code to posting_buttons.html
- More decent look and feel

Quote:
Updates/Fixes: (v.0.0.2)
Very Long Post Chars Allowed Fix I for v.0.0.2
viewtopic.php?p=176#p176

Very Long Post Chars Allowed Fix II for v.0.0.2
viewtopic.php?p=177#p177

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 18 Oct 2011, 19:11 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Addition #1 for genuine phpBB3 QR for v.0.0.2

open

viewtopic.php

find


Code:
            ($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true;


after add

Code:
    //Post Crash Protection /  Addition #1 / 4seven / 2011
    $sql_last_sel    = 'SELECT last_post_text 
                        FROM '
 . USERS_TABLE . "
                        WHERE user_id = "
 . (int) $user->data['user_id'];
    $result_last_sel = $db->sql_query_limit($sql_last_sel, 1);
    $last_sel        = $db->sql_fetchrowset($result_last_sel);
    $db->sql_freeresult($result_last_sel);
    //Post Crash Protection /  Addition #1 / 4seven / 2011        


find

Code:
                'S_QUICK_REPLY'            => true,


after add

Code:
                //Post Crash Protection / Addition #1 / 4seven / 2011
                'POST_SAVE_INSERT'        => (!empty($last_sel[0]['last_post_text'])) ? $last_sel[0]['last_post_text'] : '',    
                
//Post Crash Protection / Addition #1 / 4seven / 2011           


open

styles/prosilver/tenplate/quickreply_editor.html

find (the second find)

Code:
    <form method="post" action="{U_QR_ACTION}">


replace with

Code:
    <form method="post" id="qr_protection" action="{U_QR_ACTION}">


find (the second find)

Code:
                            <dd><input type="text" name="subject" id="subject" size="45" maxlength="64" tabindex="2" value="{SUBJECT}" class="inputbox autowidth" />


after add

Code:
    <!-- Post Crash Protection / Addition #1 / 4seven / 2011 -->
    <!-- IF S_USER_LOGGED_IN && (SCRIPT_NAME eq 'viewtopic') -->
    <script type="text/javascript">
    // <![CDATA[ 
    !window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery-latest.min.js"><\/script>');
    // ]]> 
    </script>
    <input type="hidden" id="content" value="{POST_SAVE_INSERT}" />
    <script type="text/javascript">
    // <![CDATA[
    function imgcopy(){
    var copy = $('#content').val();
    document.forms['qr_protection'].message.value += copy;
    document.forms['qr_protection'].message.focus();
    return false;
    }
    $(document).ready(function(){
    var refreshId = setInterval(function() {
    $('#post_save').load('post_crash_protection.php?text=' +encodeURIComponent($('#message').val()));
    }, 12000);
    });
    // ]]>    
    </script>
    <input type="button" class="button2" value="{L_INSR_SAVED_POST_TEXT}" onclick="imgcopy();" />
    <div id="post_save" style="display: none;"></div>     
    <!-- ENDIF -->
    <!-- Post Crash Protection / Addition #1 / 4seven / 2011 -->


If you dont find an

id="message" before/after name="message"

in the second find of

Code:
                <div id="message-box">
                    <textarea style="height: 9em;" name="message" rows="7" cols="76" tabindex="3" class="inputbox"></textarea>
                </div

than change it to

Code:
                <div id="message-box">
                    <textarea style="height: 9em;" name="message" id="message" rows="7" cols="76" tabindex="3" class="inputbox"></textarea>
                </div

- Clear all Board- and Browser-Caches

- Adjust this Code-Part

Code:
12000


in styles/prosilver/template/quickreply_editor.html

to set the Intervall of Saving in Milliseconds.

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 18 Oct 2011, 19:13 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Addition #2 for Prime Quick Reply for v.0.0.2

open

viewtopic.php

find

Code:
    // Output the page
    
page_header($user->lang['VIEW_TOPIC'] . ' - ' $topic_data['topic_title'], true$forum_id); 


before add

Code:
    //Post Crash Protection /  Addition #2 / 4seven / 2011
    
$sql_last_sel    'SELECT last_post_text 
                        FROM ' 
USERS_TABLE "
                        WHERE user_id = " 
. (int) $user->data['user_id'];
    
$result_last_sel $db->sql_query_limit($sql_last_sel1);
    
$last_sel        $db->sql_fetchrowset($result_last_sel);
    
$db->sql_freeresult($result_last_sel);
            
$template->assign_vars(array(
                
'POST_SAVE_INSERT'        => (!empty($last_sel[0]['last_post_text'])) ? $last_sel[0]['last_post_text'] : '' 
                
));
    
//Post Crash Protection /  Addition #2 / 4seven / 2011   


open

styles/prosilver/tenplate/prime_quick_reply.html

find

Code:
                </dl>
            </
div>
            <
fieldset class="fields1" style="margin-bottom:0.5em;"


before add

Code:
        <!-- Post Crash Protection Addition #2 / 4seven / 2011 -->
        
<!-- IF S_USER_LOGGED_IN && (SCRIPT_NAME eq 'viewtopic') -->
        <
dd><hr /></dd>
        <
dd>
        <
script type="text/javascript">
        
// <![CDATA[ 
        
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery-latest.min.js"><\/script>');
        
// ]]> 
        
</script>
        <input type="hidden" id="content" value="{POST_SAVE_INSERT}" />
        <script type="text/javascript">
        // <![CDATA[
        function imgcopy(){
        var copy = $('#content').val();
        document.forms['postform'].message.value += copy;
        document.forms['postform'].message.focus();
        return false;
        }
        $(document).ready(function(){
        var refreshId = setInterval(function() {
        $('#post_save').load('post_crash_protection.php?text=' +encodeURIComponent($('#message').val()));
        }, 12000);
        });
        // ]]>    
        </script>
        <input type="button" class="button2" value="{L_INSR_SAVED_POST_TEXT}" onclick="imgcopy();" />
        <div id="post_save" style="display: none;"></div> 
        </dd>   
        <!-- ENDIF -->
        <!-- Post Crash Protection / Addition #2 / 4seven / 2011 -->


- Clear all Board- and Browser-Caches

- Adjust this Code-Part

Code:
12000


in styles/prosilver/template/prime_quick_reply.html

to set the Intervall of Saving in Milliseconds.

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 18 Oct 2011, 19:20 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Very Long Post Chars Allowed Fix I for v.0.0.2

If you have much more digits allowed as the most boards, change in the template-parts of edits

find (in mod edits)

Code:
$('#post_save').load('post_crash_protection.php?text=' +encodeURIComponent($('#message').val()));


change to

Code:
$('#post_save').load('post_crash_protection.php?sid={SESSION_ID}', {text : encodeURIComponent($('#message').val())});


clear all board-, template-, style- and browsercaches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 18 Oct 2011, 19:22 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Very Long Post Chars Allowed Fix II for v.0.0.2

If any UTF-8 issue, you can try

  • change posting_buttons.html to utf8 without bom via notepad++
  • and change

    Code:
    $('#post_save').load('post_crash_protection.php?sid={SESSION_ID}', {text : encodeURIComponent($('#message').val())});

  • to

    Code:
    $('#post_save').load('post_crash_protection.php?sid={SESSION_ID}', {text : $('#message').val()});
which is my favorite version, even if there are no errors. more pure.

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.069s | 24 Queries | GZIP : Off ]