Topic: Info-Messages are not shown on pages.php in case of delete

Hi,

have a strange problem with the error-messages on pages.php

If I try to delete the index-page, it shouldn't be deleted but an error-message should be displayed that the index-page can't be deleted. I am very sure I saw it on its first appearance, but now it won't display any more. The same is, if a page is deleted - after asking whether I'm sure, the page is being deleted, but no message appears at all.

The messages are displayed, if I disable javascript, so I guess it has something to do with that. Does anybody have a clue what could be wrong there?

To be sure that it don't affect on changes I made on the code, I installed a fresh 2.0 version and tried it also on opensourcecms-demo, all with the same effect .

Thanks for any advice
- Daniel

Re: Info-Messages are not shown on pages.php in case of delete

Interesting, this will need looking into. I thought to bump into this problem when I was developing a plugin as well. Thanks for bringing this up!

Re: Info-Messages are not shown on pages.php in case of delete

This is because i tried to remove the page-refresh after page deletion. The page is still moved into "Backups", so an undo is still possible... I just couldn't find a way to display the confirmation message via javascript. When you turn off JS, PHP takes over and the error message is displayed (and the page refreshes)

- Chris
Thanks for using GetSimple! | GetSimple Poll | My GetSimple 2.0 Plugins

Re: Info-Messages are not shown on pages.php in case of delete

Is this behaviour different to them of upload.php? I compared both php-files, but I didn't see the difference. At upload.php the messages are shown as expected...

Re: Info-Messages are not shown on pages.php in case of delete

puhhh, today I had some time to step into the jquery API and this javascript to get a solution for this. Somehow I figured out to get the error or update message from the response and place it onto the current page:

$(".delconfirm").live("click", function() {

        var message = $(this).attr("title");

        var dlink = $(this).attr("href");

        var answer = confirm(message);

        var id=$(this).parents("tr").attr("id");

        

        if (answer){

            $('#loader').show();

            $("#"+id).addClass('deletedrow');

            $("#"+id).fadeOut(500, function(){

                    $.ajax({

                   type: "GET",

                   url: dlink,

                   success: function(response){

                      $("#"+id).remove();

                      $("#page_counter").html("");

                      if($("#pg_counter").length) {

                          counter=$("#pg_counter").html();

                          $("#pg_counter").html(counter-1);

                      }

                      $('table.paginate tr').quickpaginate( { perpage: 15, showcounter: true, pager : $("#page_counter") } );

                      //return false;

                                  
//******* added by dniesel:

                      if($(response).find('div.error').html()) {

                        $('div.bodycontent').before('<div class="error">'+ $(response).find('div.error').html() + '</div>'); }

                      if($(response).find('div.updated').html()) {

                        $('div.bodycontent').before('<div class="updated">'+ $(response).find('div.updated').html() + '</div>'); }

//******

                     }

                  });

                    $('#loader').fadeOut(500);

                });

        } else {

            return false;

        }

        return false;

    });

Re: Info-Messages are not shown on pages.php in case of delete

That worked perfectly... thank you very much!!

- Chris
Thanks for using GetSimple! | GetSimple Poll | My GetSimple 2.0 Plugins