Make WordPress Core


Ignore:
Timestamp:
11/08/2006 09:23:41 PM (20 years ago)
Author:
ryan
Message:

Ajax plugin tweakage from mdawaffe. fixes #3334

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/list-manipulation-js.php

    r4424 r4458  
    1 <?php
    2 @require_once('../../wp-config.php');
    3 cache_javascript_headers();
    4 $handler =  get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php';
    5 ?>
     1<?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?>
    62addLoadEvent(function(){theList=new listMan();});
    73function deleteSomething(what,id,message,obj){if(!obj)obj=theList;if(!message)message="<?php printf(__('Are you sure you want to delete this %s?'),"'+what+'"); ?>";if(confirm(message))return obj.ajaxDelete(what,id);else return false;}
     
    117Object.extend(listMan.prototype, {
    128    ajaxRespEl: 'ajax-response',
    13     ajaxHandler: '<?php echo $handler; ?>',
     9    ajaxHandler: false,
    1410    inputData: '',
    1511    clearInputs: [],
     
    5248                        tempObj.showLink = id;
    5349                });
     50                ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "<div id='jumplink' class='updated fade'><p><a href='#" + what + '-' + tempObj.showLink + "'><?php _e('Jump to new item'); ?></a></p></div>" ) : '');
    5451            }
    55             ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "<div id='jumplink' class='updated fade'><p><a href='#" + what + '-' + tempObj.showLink + "'><?php _e('Jump to new item'); ?></a></p></div>" ) : '');
    5652            if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' )
    5753                tempObj.addComplete( what, where, update, transport );
     
    5955            ajaxAdd.restoreInputs = null;
    6056        });
    61         ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); });
     57        if ( !update )
     58            ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); });
    6259        ajaxAdd.request(ajaxAdd.url);
    63         this.clear();
     60        if ( !update )
     61            this.clear();
    6462        return false;
    6563    },
     
    263261    }
    264262}
    265 //Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax
    266 function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; }
    267263//Generic but lame JS closure
    268264function encloseFunc(f){var a=arguments[1];return function(){return f(a);}}
Note: See TracChangeset for help on using the changeset viewer.