<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[2342] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments: WordCamp Budgets: Centralize file uploads for all modules.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/2342">2342</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/2342","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-01-20 21:49:51 +0000 (Wed, 20 Jan 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp Budgets: Centralize file uploads for all modules.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentscsswordcampbudgetscss">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludespaymentrequestphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludeswordcampbudgetsphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptattachedfilesjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptwordcampbudgetsjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestinputfilesphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestmetaboxfilesphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-files.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/</li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewswordcampbudgetsfieldattachedfilesphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/field-attached-files.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentscsswordcampbudgetscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css        2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css  2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        display: table-row;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.wcb-form li label {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.wcb-form li > label {
</ins><span class="cx" style="display: block; padding: 0 10px">         display: table-cell;
</span><span class="cx" style="display: block; padding: 0 10px">        margin-bottom: 1em;
</span><span class="cx" style="display: block; padding: 0 10px">        vertical-align: top;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,14 +36,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">        padding-bottom: 1em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* Files */
+.wcb_no_files_uploaded.active {
+       display: block;
+}
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#wcb_files .description {
+       margin-bottom: 1em;
+}
+
+.wcb_files_list li {
+       list-style-type: disc;
+       margin-left: 15px;
+}
+
+.form-table td p.wcb_no_files_uploaded {
+       margin-bottom: 1em;
+}
+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px">  * Payment Requests
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /* Payment methods */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.payment_method_fields.active,
-.wcp_no_files_uploaded.active {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.payment_method_fields.active {
</ins><span class="cx" style="display: block; padding: 0 10px">         display: block;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,20 +68,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin-right: 20px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* Files */
-#wcp_files .description {
-       margin-bottom: 1em;
-}
-
-.wcp_files_list li {
-       list-style-type: disc;
-       margin-left: 15px;
-}
-
-.form-table td p.wcp_no_files_uploaded {
-       margin-bottom: 1em;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> /* Log */
</span><span class="cx" style="display: block; padding: 0 10px"> #wcp_log .inside {
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 0;
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludespaymentrequestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php    2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php      2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -386,18 +386,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $description
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected function render_files_input( $post, $label, $name, $description = '' ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $files = get_posts( array(
-                       'post_parent'    => $post->ID,
-                       'post_type'      => 'attachment',
-                       'posts_per_page' => -1,
-                       'orderby'        => 'title',
-                       'order'          => 'ASC',
-               ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $files = WordCamp_Budgets::get_attached_files( $post );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ( $files as &$file ) {
-                       $file->filename = wp_basename( $file->guid );
-                       $file->url      = wp_get_attachment_url( $file->ID );
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         wp_localize_script( 'wcb-attached-files', 'wcbAttachedFiles', $files ); // todo merge into wordcampBudgets var
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                require( dirname( __DIR__ ) . '/views/payment-request/input-files.php' );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -764,9 +755,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Attach existing files
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->attach_existing_files( $post_id, $_POST );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         remove_action( 'save_post', array( $this, 'save_payment' ), 10 ); // avoid infinite recursion
+               WordCamp_Budgets::attach_existing_files( $post_id, $_POST );
+               add_action( 'save_post', array( $this, 'save_payment' ), 10, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Add log entries when the post status changes
+        *
+        * @param string  $new
+        * @param string  $old
+        * @param WP_Post $post
+        */
</ins><span class="cx" style="display: block; padding: 0 10px">         public function transition_post_status( $new, $old, $post ) {
</span><span class="cx" style="display: block; padding: 0 10px">                if ( $post->post_type != self::POST_TYPE )
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -802,36 +802,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Attach unattached files to the payment request post
-        *
-        * Sometimes users will upload the files manually to the Media Library, instead of using the Add Files button,
-        * and we need to attach them to the request so that they show up in the metabox.
-        *
-        * @param int   $post_id
-        * @param array $request
-        */
-       protected function attach_existing_files( $post_id, $request ) {
-               if ( empty( $request['wcp_existing_files_to_attach'] ) ) {
-                       return;
-               }
-
-               if ( ! $files = json_decode( $request['wcp_existing_files_to_attach'] ) ) {
-                       return;
-               }
-
-               remove_action( 'save_post', array( $this, 'save_payment' ), 10 ); // avoid infinite recursion
-
-               foreach( $files as $file_id ) {
-                       wp_update_post( array(
-                               'ID'          => $file_id,
-                               'post_parent' => $post_id,
-                       ) );
-               }
-
-               add_action( 'save_post', array( $this, 'save_payment' ), 10, 2 );
-       }
-
-       /**
</del><span class="cx" style="display: block; padding: 0 10px">          * Define columns for the Payment Requests screen.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param array $_columns
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludeswordcampbudgetsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php   2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php     2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -274,6 +274,59 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Get the files attached to a post
+        *
+        * @param WP_Post $post
+        *
+        * @return array
+        */
+       public static function get_attached_files( $post ) {
+               $files = get_posts( array(
+                       'post_parent'    => $post->ID,
+                       'post_type'      => 'attachment',
+                       'posts_per_page' => 100,
+                       'orderby'        => 'title',
+                       'order'          => 'ASC',
+               ) );
+
+               foreach ( $files as &$file ) {
+                       $file->filename = wp_basename( $file->guid );
+                       $file->url      = wp_get_attachment_url( $file->ID );
+               }
+
+               return $files;
+       }
+
+       /**
+        * Attach unattached files to the payment request post
+        *
+        * Sometimes users will upload the files manually to the Media Library, instead of using the Add Files button,
+        * and we need to attach them to the request so that they show up in the metabox.
+        *
+        * NOTE: The calling function must remove any of its save_post callbacks before calling this, in order to
+        * avoid infinite recursion
+        *
+        * @param int   $post_id
+        * @param array $request
+        */
+       public static function attach_existing_files( $post_id, $request ) {
+               if ( empty( $request['wcb_existing_files_to_attach'] ) ) {
+                       return;
+               }
+
+               if ( ! $files = json_decode( $request['wcb_existing_files_to_attach'] ) ) {
+                       return;
+               }
+
+               foreach( $files as $file_id ) {
+                       wp_update_post( array(
+                               'ID'          => $file_id,
+                               'post_parent' => $post_id,
+                       ) );
+               }
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Insert an entry into a log for one of the custom post types
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param int    $post_id The post ID.
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptattachedfilesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js    2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js      2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,7 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        app.AttachedFileView = Backbone.View.extend( {
</span><span class="cx" style="display: block; padding: 0 10px">                tagName: 'li',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                template: wp.template( 'wcp-attached-file' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         template: wp.template( 'wcb-attached-file' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                initialize: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        _.bindAll( this, 'render' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,8 +43,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * View for a collection of attached files
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        app.AttachedFilesView = Backbone.View.extend( {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                el: $( '#wcp_files' ),
-
</del><span class="cx" style="display: block; padding: 0 10px">                 initialize: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        _.bindAll( this, 'render', 'appendFile' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -63,10 +61,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                appendFile: function( file ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var noFilesUploaded  = $( '.wcp_no_files_uploaded' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var noFilesUploaded  = $( '.wcb_no_files_uploaded' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         var attachedFileView = new app.AttachedFileView( { model: file } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $( '.wcp_files_list' ).append( attachedFileView.render().el );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $( '.wcb_files_list' ).append( attachedFileView.render().el );
</ins><span class="cx" style="display: block; padding: 0 10px">                         noFilesUploaded.removeClass( 'active' );
</span><span class="cx" style="display: block; padding: 0 10px">                        noFilesUploaded.addClass( 'hidden' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -85,7 +83,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                attachExistingFile: function( file ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var fileIDsToAttach,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                existingFilesToAttach = $( '#wcp_existing_files_to_attach' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         existingFilesToAttach = $( '#wcb_existing_files_to_attach' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        try {
</span><span class="cx" style="display: block; padding: 0 10px">                                fileIDsToAttach = JSON.parse( existingFilesToAttach.val() );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js  2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js    2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                init: function () {
</span><span class="cx" style="display: block; padding: 0 10px">                        try {
</span><span class="cx" style="display: block; padding: 0 10px">                                app.registerEventHandlers();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                wcb.attachedFilesView = new wcb.AttachedFilesView();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wcb.attachedFilesView = new wcb.AttachedFilesView( { el: $( '#wcp_files' ) } );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wcb.setupDatePicker( '#wcp_general_info' );
</span><span class="cx" style="display: block; padding: 0 10px">                        } catch ( exception ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                wcb.log( exception );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,7 +26,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( wcb.togglePaymentMethodFields );
</span><span class="cx" style="display: block; padding: 0 10px">                        paymentCategory.change( app.toggleOtherCategoryDescription );
</span><span class="cx" style="display: block; padding: 0 10px">                        paymentCategory.trigger( 'change' );   // Set the initial state
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( wcb.showUploadModal );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $( '#wcp_files' ).find( 'a.wcb-insert-media' ).click( wcb.showUploadModal );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $( '#wcp_mark_incomplete_checkbox' ).click( app.requireNotes );
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptwordcampbudgetsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js  2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js    2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,8 +48,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * Add files selected from the Media Picker to the current collection of files
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                addSelectedFilesToCollection : function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // app var needs to point to caller?
-
</del><span class="cx" style="display: block; padding: 0 10px">                         var attachments = app.fileUploadFrame.state().get( 'selection' ).toJSON();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $.each( attachments, function( index, attachment ) {
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestinputfilesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php   2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php     2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,25 +8,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </p>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php // todo move to centralized view file ?>
-               <p>
-                       <a class="button wcp-insert-media" role="button">
-                               <?php _e( 'Add files', 'wordcamporg' ); ?>
-                       </a>
-               </p>
-
-               <h4><?php _e( 'Attached files:', 'wordcamporg' ); ?></h4>
-
-               <ul class="wcp_files_list"></ul>
-
-               <p class="wcp_no_files_uploaded <?php echo $files ? 'hidden' : 'active'; ?>">
-                       <?php _e( "You haven't uploaded any files yet.", 'wordcamporg' ); ?>
-               </p>
-
-               <script type="text/html" id="tmpl-wcp-attached-file">
-                       <a href="{{ data.url }}">{{ data.filename }}</a>
-               </script>
-
-               <?php wp_localize_script( 'wcb-attached-files', 'wcbAttachedFiles', $files ); // todo merge into wordcampBudgets var ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <?php require_once( dirname( __DIR__ ) . '/wordcamp-budgets/field-attached-files.php' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">         </td>
</span><span class="cx" style="display: block; padding: 0 10px"> </tr>
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestmetaboxfilesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-files.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-files.php 2016-01-20 21:23:33 UTC (rev 2341)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-files.php   2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <table class="form-table">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <input id="wcp_existing_files_to_attach" name="wcp_existing_files_to_attach" type="hidden" value="" />
-
</del><span class="cx" style="display: block; padding: 0 10px">         <?php $this->render_files_input( $post, 'Files', 'files', __( 'Attach supporting documentation including invoices, contracts, or other vendor correspondence. If no supporting documentation is available, please indicate the reason in the notes below.', 'wordcamporg' ) ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <?php $this->render_textarea_input( $post, 'Notes', 'file_notes' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </table>
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewswordcampbudgetsfieldattachedfilesphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/field-attached-files.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/field-attached-files.php                         (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/field-attached-files.php   2016-01-20 21:49:51 UTC (rev 2342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,25 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php defined( 'WPINC' ) or die();
+
+?>
+
+<input id="wcb_existing_files_to_attach" name="wcb_existing_files_to_attach" type="hidden" value="" />
+
+<p>
+       <a class="button wcb-insert-media" role="button">
+               <?php _e( 'Add files', 'wordcamporg' ); ?>
+       </a>
+</p>
+
+<h4>
+       <?php _e( 'Attached files:', 'wordcamporg' ); ?>
+</h4>
+
+<ul class="wcb_files_list"></ul>    <?php // Populated dynamically ?>
+
+<p class="wcb_no_files_uploaded <?php echo esc_attr( $files ? 'hidden' : 'active' ); ?>">
+       <?php _e( "You haven't uploaded any files yet.", 'wordcamporg' ); ?>
+</p>
+
+<script type="text/html" id="tmpl-wcb-attached-file">
+       <a href="{{ data.url }}">{{ data.filename }}</a>
+</script>
</ins></span></pre>
</div>
</div>

</body>
</html>