Advertisement
Guest User

Untitled

a guest
May 22nd, 2012
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.17 KB | None | 0 0
  1.     function show_hide_aupload() {
  2.         $url = plugin_dir_url()."broker-uploader/amazon/";
  3.         ?>
  4.             <script type="text/javascript" src="<?php echo $url; ?>progress.js"></script>
  5.             <script type="text/javascript">
  6.                
  7.                 jQuery(document).ready(function(){
  8.                    
  9.                     jQuery('#amazon-upload').submit(function(){
  10.                        
  11. //                        jQuery(this).hide();
  12.                        
  13.                     });
  14.                    
  15.                     jQuery('#theTitle').keyup(function(){
  16.                        
  17.                         var count = $(this).val().length;
  18.                         var limit = 80; //must be amazon_file limit - 10
  19.                        
  20.                         if(count > limit) {
  21.                            
  22.                             jQuery(this).val(jQuery(this).val().substr(0, limit));
  23.                             jQuery('#amazon_title_char_count').css('color','red');
  24.                             jQuery('#excess_warning').html("You may only have up to "+limit+" characters in the title. Excess characters have been truncated");
  25.                             jQuery('#excess_warning').show('fast');
  26.                             var count = $(this).val().length;
  27.                            
  28.                         } else {
  29.                            
  30.                             jQuery('#amazon_title_char_count').css('color','inherit');
  31.                             jQuery('#excess_warning').hide('fast');
  32.                            
  33.                         }
  34.                        
  35.                         jQuery('#amazon_title_char_count').html(count+"/"+limit+" characters used");
  36.                        
  37.                     });
  38.                    
  39.                     jQuery('#message-ta').keyup(function(){
  40.                        
  41.                         var count = $(this).val().length;
  42.                         var limit = 5000;
  43.                        
  44.                         if(count > limit) {
  45.                            
  46.                             jQuery(this).val(jQuery(this).val().substr(0, limit));
  47.                             jQuery('#message_char_count').css('color','red');
  48.                             jQuery('#message_excess_warning').html("You may only have up to "+limit+" characters in the title. Excess characters have been truncated");
  49.                             jQuery('#message_excess_warning').show('fast');
  50.                             var count = $(this).val().length;
  51.                            
  52.                         } else {
  53.                            
  54.                             jQuery('#message_char_count').css('color','inherit');
  55.                             jQuery('#message_excess_warning').hide('fast');
  56.                            
  57.                         }
  58.                        
  59.                         jQuery('#message_char_count').html(count+"/"+limit+" characters used");
  60.                        
  61.                     });
  62.                    
  63.                     jQuery("input:checkbox").change(function(){
  64.                        
  65.                         var div = '#'+jQuery(this).attr('value');
  66.                        
  67.                         if( jQuery(this).is(":checked") ) {
  68.                            
  69.                             jQuery(div).show('fast');
  70.                            
  71.                         } else {
  72.                            
  73.                             jQuery(div).hide('fast');
  74.                            
  75.                         }
  76.                        
  77.                     });
  78.                    
  79.                 });
  80.                
  81.                 function showProgress() {
  82.                    
  83.                     var pb = document.getElementById("uploader");
  84.                     pb.innerHTML = '<img src="/wp-content/plugins/broker-uploader/amazon/uploading-1.gif" width="116" height ="119"/>';
  85.                     pb.style.display = '';
  86.                    
  87.                 }
  88.             </script>
  89. <script type="text/javascript">
  90.     function progress() {
  91. //    window.addEvent('domready',function() {
  92.         $$('form.upload').each(function(o_form) {
  93.             o_form.fileUpload = new uploadProgress(o_form, {
  94.                     's_actionHelper' : '<?php echo $url; ?>progress.php',
  95.                     'i_interval' : 500
  96.             });
  97.         });
  98. //    });
  99.     }
  100. </script>
  101. <script type="text/javascript">
  102.     jQuery(document).ready(function(){
  103.        
  104.         jQuery("form").submit(function(){
  105.        
  106.             var id = jQuery(this).attr('id');
  107.             jQuery(this).append("<input type=\"hidden\" name=\"APC_UPLOAD_PROGRESS\" value=\""+id+"\" />");
  108.            
  109.         });
  110.        
  111.     });
  112.  
  113.     function validate() {                
  114.             var id = jQuery("form").attr('id');
  115.             var formid = "#"+id;
  116.             jQuery(formid).add("<input type=\"hidden\" name=\"APC_UPLOAD_PROGRESS\" value=\""+id+"\" />");
  117.             jQuery("#validate").hide();
  118.             jQuery("#submitme").show();
  119.     }
  120. </script>
  121.         <?php
  122.     }
  123.     add_action('wp_footer','show_hide_aupload');
  124. ?>
  125.             <h3><a href="/broker-tools/amazon-upload/webinar-archive/">View Archive</a></h3>
  126.             <style type="text/css">
  127.                 .sec_name, label {
  128.                     display: block;
  129.                     clear: right;
  130.                 }
  131.                 .sec_name {
  132.                     font-style: italic;
  133.                 }
  134.                 .title {
  135.                     font-weight: bold;
  136.                     margin:10px 0;
  137.                 }
  138.                 .radio {
  139.                     font-weight: normal;
  140.                     float: left;
  141.                 }
  142.                 input[type="radio"], input[type="checkbox"] {
  143.                     display: block;
  144.                     float: left;
  145.                     margin-right: 5px;
  146.                 }
  147.                 .option {
  148.                     display: block;
  149.                     float:left;
  150.                     width: 100%;
  151.                 }
  152.                 .opt-cont {
  153.                     margin-left: 10px;
  154.                     float:left;
  155.                     width:100%;
  156.                 }
  157.             </style>
  158. <form action="<?php echo curPageURL(); ?>" method="post" class="upload" onSubmit="progress()" enctype="multipart/form-data">
  159.     <label class="title" for="theTitle">Email Title</label>
  160.     <input id="theTitle" type="text" name="theTitle" /><div id="amazon_title_char_count"></div><div id="excess_warning" style="display:none; font-weight: bold;color: red;"></div>
  161.    
  162.     <label class="title" for="theSite">Select Email From</label>
  163. <!--    <select id="theSite" name="theSite">-->
  164.         <?php
  165.         $sites = $wpdb->get_results($wpdb->prepare("SELECT * FROM bu_amazon_sections"));
  166.         foreach ($sites as $site) {
  167. //            echo '<option value="'.$site->amazon_section_id.'">'.$site->amazon_section_name.'</option>';
  168. //            echo '<input type="radio" id="primary_'.$site->amazon_section_id.'" name="theSite" value="p_'.$site->amazon_section_id.'" /><label for="primary_'.$site->amazon_section_id.'">'.$site->amazon_section_name.'</label>';
  169.             echo '<div class="option">';
  170.             echo '<span class="sec_name">'.$site->amazon_section_name.'</span>';
  171.             if ($site->has_secondary) {
  172.                 $secondaries = $wpdb->get_results($wpdb->prepare("SELECT * FROM bu_amazon_secondary_sections WHERE amazon_section_id = $site->amazon_section_id ORDER BY secondary_name ASC"));
  173.                 foreach($secondaries as $secondary) {
  174.                    
  175.                     $class = $secondary->secondary_name;
  176.                     $class = strtolower($class);
  177.                     $class = str_replace(" ","-",$class);
  178.                    
  179.                     echo '<div class="opt-cont">';
  180.                     echo '<input class="radio '.$class.'" type="radio" id="sec_'.$secondary->secondary_id.'" name="theSite" value="s_'.$secondary->secondary_id.'" /><label class="radio" for="sec_'.$secondary->secondary_id.'">'.$secondary->secondary_name.'</label>';
  181.                     echo '</div>';
  182.                 }
  183.             }
  184.             echo "</div>";
  185.         } ?>
  186.    
  187.     <label class="title" for="theFile">.mp4 Video to Upload</label>
  188.     <input id="theFile" name="theFile" type="file" accept="video/mp4" />
  189.    
  190.     <label class="title">Extras</label>
  191.    
  192.     <input type="checkbox" id="pdf" name="pdf" value="pdf-box"><label for="pdf">Include PDF</label>
  193.     <input type="checkbox" id="positons" name="positions" value="positions-box"><label for="positons">Include Positions</label>
  194.     <input type="checkbox" id="message" name="message" value="message-box"><label for="message">Include message</label>
  195.     <input type="checkbox" id="additional-webinar" name="additional-webinar" value="additional-webinar-box"><label for="additional-webinar">Include Additional Webinar</label>
  196.    
  197.     <div id="pdf-box" style="display:none;">
  198.         <label class="title" for="thePDF">.pdf File to Upload</label>
  199.         <input id="thePDF" name="thePDF" type="file" accept="application/pdf" />
  200.     </div>
  201.     <div id="positions-box" style="display:none;">
  202.         <label class="title">Positions Info</label>
  203.         <label>New/Potential Trades</label>
  204.         <input type="text" name="np-trades" />
  205.         <label>Current Trades</label>
  206.         <input type="text" name="cur-trades" />
  207.         <label>Updates</label>
  208.         <input type="text" name="update-trades" />
  209.     </div>
  210.     <div id="message-box" style="display:none;">
  211.         <label class="title">Email Message</label>
  212.         <textarea id="message-ta" name="message" cols="50" rows="10"></textarea>
  213.         <div id="message_char_count"></div>
  214.         <div id="message_excess_warning" style="display:none; font-weight: bold;color: red;"></div>
  215.     </div>
  216.     <div id="additional-webinar-box" style="display:none;">
  217.         <label class="title">Select Additional Webinar</label>
  218.         <select name="additional-webinar-selection">
  219.             <option value="0" selected>Please Select</option>
  220.             <?php
  221.             $additional_webinars = $wpdb->get_results($wpdb->prepare("SELECT aa.amazon_id, aa.amazon_title, ass.amazon_section_name FROM bu_amazon_archive AS aa LEFT OUTER JOIN bu_amazon_sections AS ass ON aa.amazon_section_id = ass.amazon_section_id WHERE amazon_file_type_id = 1 ORDER BY upload_date DESC  LIMIT 10"));
  222.             foreach($additional_webinars as $additional_webinar) {
  223.                 echo '<option value="'.$additional_webinar->amazon_id.'">'.$additional_webinar->amazon_title.'('.$additional_webinar->amazon_section_name.')</option>';
  224.             }
  225.             ?>
  226.         </select>
  227.     </div>
  228. <!--    </select>    -->
  229.  
  230.     <input type="hidden" value="elitetradersgroup" name="amazon_bucket" />
  231.     <button id="validate" onClick="validate()" type="button">Validate</button>
  232.     <input name="Submit" id="submitme" type="submit" style="display:none;" value="Upload"  />
  233.            <!---->
  234.      
  235.  
  236. </form>  
  237. <div id="uploader" style="display:none;">
  238.     <img src="/wp-content/plugins/broker-uploader/amazon/uploading-1.gif" width="116" height ="119"/>
  239. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement