Making WordPress.org

Changeset 2272


Ignore:
Timestamp:
01/11/2016 10:15:37 PM (11 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Reorganize to make room for additional modules.

Soon we'll be adding modules for Budgets and Sponsor Invoices, in addition to the existing one for Payment Requests.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
Files:
1 deleted
4 edited
1 copied
3 moved

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/bootstrap.php

    r1947 r2272  
    11<?php
    22/*
    3 Plugin Name: WordCamp Payments
     3Plugin Name: WordCamp Budgets
    44Plugin URI:  http://wordcamp.org/
    5 Description: Provides tools for collecting and processing payment requests from WordCamp organizers.
    6 Author:      tellyworth, iandunn
     5Description: Provides tools for managing WordCamp budgets, sponsor invoices, and payment requests.
     6Author:      WordCamp.org
     7Author URI:  https://wordcamp.org
    78Version:     0.1
    89*/
    … …  
    1314
    1415if ( is_admin() ) {
    15         require_once( __DIR__ . '/classes/wordcamp-payments.php' );
    16         require_once( __DIR__ . '/classes/payment-request.php' );
    17         require_once( __DIR__ . '/classes/encryption.php' );
     16        require_once( __DIR__ . '/includes/wordcamp-budgets.php' );
     17        require_once( __DIR__ . '/includes/payment-request.php' );
     18        require_once( __DIR__ . '/includes/encryption.php' );
    1819
    19         $GLOBALS['wordcamp_payments']   = new WordCamp_Payments();
     20        $GLOBALS['wordcamp_budgets']    = new WordCamp_Budgets();
    2021        $GLOBALS['wcp_payment_request'] = new WCP_Payment_Request();
    2122}
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css

    r2255 r2272  
    2828}
    2929
     30
     31/*
     32 * Log
     33 */
    3034#wcp_log .inside {
    3135        margin: 0;
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php

    r2201 r2272  
    941941                        $incomplete_text = get_post_meta( $post->ID, '_wcp_incomplete_notes', true );
    942942                        $incomplete_text = preg_replace( '#\.$#', '', $incomplete_text ); // trailing-undot-it.
    943                         WordCamp_Payments::log( $post->ID, sprintf( 'Marked as incomplete by %s: %s.', $user->display_name, $incomplete_text ), array(
     943                        WordCamp_Budgets::log( $post->ID, sprintf( 'Marked as incomplete by %s: %s.', $user->display_name, $incomplete_text ), array(
    944944                                'user_id' => $user->ID,
    945945                                'action' => 'marked-incomplete',
    … …  
    947947                        ) );
    948948                } elseif ( $new == 'paid' && $old != 'paid' ) {
    949                         WordCamp_Payments::log( $post->ID, sprintf( 'Marked as paid by %s.', $user->display_name ), array(
     949                        WordCamp_Budgets::log( $post->ID, sprintf( 'Marked as paid by %s.', $user->display_name ), array(
    950950                                'user_id' => $user->ID,
    951951                                'action' => 'marked-paid',
    952952                        ) );
    953953                } elseif ( $old == 'auto-draft' && $new != 'auto-draft' ) {
    954                         WordCamp_Payments::log( $post->ID, sprintf( 'Request created by %s.', $user->display_name ), array(
     954                        WordCamp_Budgets::log( $post->ID, sprintf( 'Request created by %s.', $user->display_name ), array(
    955955                                'user_id' => $user->ID,
    956956                                'action' => 'updated',
    957957                        ) );
    958958                } else {
    959                         WordCamp_Payments::log( $post->ID, sprintf( 'Request updated by %s.', $user->display_name ), array(
     959                        WordCamp_Budgets::log( $post->ID, sprintf( 'Request updated by %s.', $user->display_name ), array(
    960960                                'user_id' => $user->ID,
    961961                                'action' => 'updated',
    … …  
    982982                }
    983983
    984                 remove_action( 'save_post', array( $this, 'save_payment' ), 10, 2 ); // avoid infinite recursion
     984                remove_action( 'save_post', array( $this, 'save_payment' ), 10 ); // avoid infinite recursion
    985985
    986986                foreach( $files as $file_id ) {
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php

    r2270 r2272  
    44 * Main class to provide functionality common to all other classes
    55 */
    6 class WordCamp_Payments {
     6class WordCamp_Budgets {
    77        const VERSION = '0.1.1';
    88
    … …  
    2424                // Register our assets
    2525                wp_register_script(
    26                         'wordcamp-payments',
    27                         plugins_url( 'javascript/wordcamp-payments.js', __DIR__ ),
     26                        'wordcamp-budgets',
     27                        plugins_url( 'javascript/wordcamp-budgets.js', __DIR__ ),
    2828                        array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ),
    2929                        self::VERSION,
    … …  
    3434                        'wcp-attached-files',
    3535                        plugins_url( 'javascript/attached-files.js', __DIR__ ),
    36                         array( 'wordcamp-payments', 'backbone', 'wp-util' ),
     36                        array( 'wordcamp-budgets', 'backbone', 'wp-util' ),
    3737                        self::VERSION,
    3838                        true
    … …  
    4646
    4747                wp_register_style(
    48                         'wordcamp-payments',
    49                         plugins_url( 'css/wordcamp-payments.css', __DIR__ ),
     48                        'wordcamp-budgets',
     49                        plugins_url( 'css/wordcamp-budgets.css', __DIR__ ),
    5050                        $soft_deps,
    5151                        self::VERSION
    … …  
    5656
    5757                if ( in_array( $current_screen->id, array( 'edit-wcp_payment_request', 'wcp_payment_request' ) ) ) {
    58                         wp_enqueue_script( 'wordcamp-payments' );
    59                         wp_enqueue_style( 'wordcamp-payments' );
     58                        wp_enqueue_script( 'wordcamp-budgets' );
     59                        wp_enqueue_style( 'wordcamp-budgets' );
    6060
    6161                        if ( in_array( $current_screen->id, array( 'wcp_payment_request' ) ) && isset( $post->ID ) ) {
    … …  
    6565
    6666                        wp_localize_script(
    67                                 'wordcamp-payments',
    68                                 'wcpLocalizedStrings',          // todo merge into wordcampPayments var
     67                                'wordcamp-budgets',
     68                                'wcpLocalizedStrings',          // todo merge into wordcampBudgets var
    6969                                array(
    7070                                        'uploadModalTitle'  => __( 'Attach Supporting Documentation', 'wordcamporg' ),
    … …  
    7676
    7777        /**
    78          * Log something with a payment request.
     78         * Insert an entry into a log for one of the custom post types
    7979         *
    80          * @param int $post_id The payment requset ID.
     80         * @param int    $post_id The post ID.
    8181         * @param string $message A log message.
    82          * @param array $data Optional data.
     82         * @param array  $data    Optional data.
    8383         */
    8484        public static function log( $post_id, $message, $data = array() ) {
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js

    r1940 r2272  
    44         * Model for an attached file
    55         */
    6         $.wordcampPayments.AttachedFile = Backbone.Model.extend( {
     6        $.wordcampBudgets.AttachedFile = Backbone.Model.extend( {
    77                defaults: {
    88                        'ID':          0,
    … …  
    1616         * Collection of attached files
    1717         */
    18         $.wordcampPayments.AttachedFiles = Backbone.Collection.extend( {
    19                 model: $.wordcampPayments.AttachedFile
     18        $.wordcampBudgets.AttachedFiles = Backbone.Collection.extend( {
     19                model: $.wordcampBudgets.AttachedFile
    2020        } );
    2121
    … …  
    2323         * View for a single attached file
    2424         */
    25         $.wordcampPayments.AttachedFileView = Backbone.View.extend( {
     25        $.wordcampBudgets.AttachedFileView = Backbone.View.extend( {
    2626                tagName: 'li',
    2727                template: wp.template( 'wcp-attached-file' ),
    … …  
    4040         * View for a collection of attached files
    4141         */
    42         $.wordcampPayments.AttachedFilesView = Backbone.View.extend( {
     42        $.wordcampBudgets.AttachedFilesView = Backbone.View.extend( {
    4343                el: $( '#wcp_files' ),
    4444
    … …  
    4646                        _.bindAll( this, 'render', 'appendFile' );
    4747
    48                         this.collection = new $.wordcampPayments.AttachedFiles( wcpAttachedFiles );
     48                        this.collection = new $.wordcampBudgets.AttachedFiles( wcpAttachedFiles );
    4949                        this.collection.bind( 'add', this.appendFile );
    5050
    … …  
    6262                appendFile: function( file ) {
    6363                        var noFilesUploaded  = $( '.wcp_no_files_uploaded' );
    64                         var attachedFileView = new $.wordcampPayments.AttachedFileView( { model: file } );
     64                        var attachedFileView = new $.wordcampBudgets.AttachedFileView( { model: file } );
    6565
    6666                        $( '.wcp_files_list' ).append( attachedFileView.render().el );
    … …  
    7979                 * Files that are already attached to other posts are ignored.
    8080                 *
    81                  * @param {wordcampPayments.AttachedFile} file
     81                 * @param {wordcampBudgets.AttachedFile} file
    8282                 */
    8383                attachExistingFile: function( file ) {
    … …  
    9898        } );
    9999
    100         $.wordcampPayments.attachedFilesView = new $.wordcampPayments.AttachedFilesView();
     100        $.wordcampBudgets.attachedFilesView = new $.wordcampBudgets.AttachedFilesView();
    101101
    102102} );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js

    r2255 r2272  
    11jQuery( document ).ready( function( $ ) {
    22
    3         $.wordcampPayments = {
     3        $.wordcampBudgets = {
    44
    55                /**
    … …  
    77                 */
    88                init: function () {
    9                         $.wordcampPayments.registerEventHandlers();
    10                         $.wordcampPayments.setupDatePicker();
     9                        $.wordcampBudgets.registerEventHandlers();
     10                        $.wordcampBudgets.setupDatePicker();
    1111                },
    1212
    … …  
    1515                 */
    1616                registerEventHandlers : function() {
    17                         $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.wordcampPayments.togglePaymentMethodFields );
    18                         $( '#payment_category' ).change( $.wordcampPayments.toggleOtherCategoryDescription );
    19                         $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.wordcampPayments.showUploadModal );
    20                         $( '#wcp_mark_incomplete_checkbox' ).click( $.wordcampPayments.requireNotes );
     17                        $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.wordcampBudgets.togglePaymentMethodFields );
     18                        $( '#payment_category' ).change( $.wordcampBudgets.toggleOtherCategoryDescription );
     19                        $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.wordcampBudgets.showUploadModal );
     20                        $( '#wcp_mark_incomplete_checkbox' ).click( $.wordcampBudgets.requireNotes );
    2121                },
    2222
    … …  
    6161                 */
    6262                showUploadModal : function( event ) {
    63                         if ( 'undefined' == typeof $.wordcampPayments.fileUploadFrame ) {
     63                        if ( 'undefined' == typeof $.wordcampBudgets.fileUploadFrame ) {
    6464                                // Create the frame
    65                                 $.wordcampPayments.fileUploadFrame = wp.media( {
     65                                $.wordcampBudgets.fileUploadFrame = wp.media( {
    6666                                        title: wcpLocalizedStrings.uploadModalTitle,
    6767                                        multiple: true,
    … …  
    7272
    7373                                // Add models to the collection for each selected attachment
    74                                 $.wordcampPayments.fileUploadFrame.on( 'select', $.wordcampPayments.addSelectedFilesToCollection );
     74                                $.wordcampBudgets.fileUploadFrame.on( 'select', $.wordcampBudgets.addSelectedFilesToCollection );
    7575                        }
    7676
    77                         $.wordcampPayments.fileUploadFrame.open();
     77                        $.wordcampBudgets.fileUploadFrame.open();
    7878                        return false;
    7979                },
    … …  
    8383                 */
    8484                addSelectedFilesToCollection : function() {
    85                         var attachments = $.wordcampPayments.fileUploadFrame.state().get( 'selection' ).toJSON();
     85                        var attachments = $.wordcampBudgets.fileUploadFrame.state().get( 'selection' ).toJSON();
    8686
    8787                        $.each( attachments, function( index, attachment ) {
    88                                 var newFile = new $.wordcampPayments.AttachedFile( {
     88                                var newFile = new $.wordcampBudgets.AttachedFile( {
    8989                                        'ID':          attachment.id,
    9090                                        'post_parent': attachment.uploadedTo,
    … …  
    9393                                } );
    9494
    95                                 $.wordcampPayments.attachedFilesView.collection.add( newFile );
     95                                $.wordcampBudgets.attachedFilesView.collection.add( newFile );
    9696                        } );
    9797                },
    … …  
    127127        };
    128128
    129         $.wordcampPayments.init();
     129        $.wordcampBudgets.init();
    130130} );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php

    r995 r2272  
    2727                </script>
    2828
    29                 <?php wp_localize_script( 'wcp-attached-files', 'wcpAttachedFiles', $files ); // todo merge into wordcampPayments var ?>
     29                <?php wp_localize_script( 'wcp-attached-files', 'wcpAttachedFiles', $files ); // todo merge into wordcampBudgets var ?>
    3030        </td>
    3131</tr>
Note: See TracChangeset for help on using the changeset viewer.