Send file page

    • # 1 year, 6 months ago

      Is it possible to have the “Send file” procedure all in one page, without multiple steps and NEXT/PREVIOUS buttons?

    • Thomas
      Keymaster
      # 1 year, 6 months ago

      Hi,

      That won’t be easy. There is no out-of-he-box way to disable that. Not sure it is even possible.

      The only way I see for you would be to edit templates and maybe remove the HTML tags rendering the steps wizard. However, I think you’ll be facing an issue. If I remember correctly, the advanced rich-editor will be waiting for the wizard steps component to be completely displayed to start initializing the advanced rich-editor. If you simply remove the HTML tags, I think the page won’t be able to fully load.

      cuar-wizard

      If you look at the screenshot below, you’ll see many calls like:

      $('#cuar-js-content-container').on('cuar:wizard:initialized', function(){
          $('.cuar-js-classic-uploader').classicUploader();
      });

      If you remove the Wizard HTML tags, cuar:wizard:initialized will never be called, and you’ll miss some functions (there, the upload features won’t be active)

      So, you’ll also need to fake this call.
      You can do this by simply a JS code on every page load, like this:

      (function ($) {
          "use strict";
          $(document).ready(function ($) {
              $('#cuar-js-content-container').trigger('cuar:wizard:initialized');
          });
      })(jQuery);

      You can find the wizard HTML tags for private files in wp-plugins/customer-area-collaboration/src/php/customer-new-private-file/templates/customer-new-private-file-content.template.php

      Basically, you would need to rename all classes named cuar-js-wizard-section, remove the JS code at the end of the file which is initializing the wizard, and replace it with the trigger code I gave above (this will simulate wizard activation and tells WPCA the wizard is initialized so others components can start initializing).

      Best regards.

    • Thomas
      Keymaster
      # 1 year, 6 months ago

      Try to create file wp-content/customer-area/templates/customer-new-private-file-content.template.php and paste this inside (not tried, but that might probably work).

      <?php /** Template version: 3.3.1
       * 
       * -= 3.3.1 =-
       * - Custom modification: deleting steps wizard
       *
       * -= 3.3.0 =-
       * - Deactivate key navigation for wizard
       *
       * -= 3.2.0 =-
       * - Hide the owner tab if current user has no permission to select an owner
       *
       * -= 3.1.0 =-
       * - Replace clearfix CSS classes with cuar-clearfix
       *
       * -=3.0.0=-
       * - Added support for the new master-skin
       * - Added wizard
       *
       * -=1.1.0=-
       * - Added support for the new file manager
       *
       */
      
      /** @var CUAR_CustomerNewFileAddOn $this */
      
      // DATAS
      // ---------------------------------------------------------------------------------------------------------------------
      // Get all the wizard steps | Array
      $steps = $this->get_wizard_steps();
      
      // Has the current user permission to select an owner ? | Bool
      $is_owner_selectable = $this->current_user_can_select_owner();
      
      // Get the defaults owners | Array
      $default_owners = $this->get_default_owners();
      
      // Get the current post ID | Int
      $current_post_id = $this->get_current_post_id();
      ?>
      
      <?php if ( $this->should_print_form() ) : ?>
      
         <?php $this->print_form_header(); ?>
      
          <div class="cuar-title cuar-section-title"><?php _e( 'Details', 'cuarco' ); ?></div>
          <div class="cuar-section">
            <?php if ( ! $is_owner_selectable && empty( $default_owners ) ) { ?>
                  <div class="alert alert-danger">
                  <?php _e( 'You are not allowed to pick an owner and there are no default owners for this type of content. Please contact your website administrator!', 'cuarco' ); ?>
                  </div>
            <?php } ?>
      
            <?php
            $this->print_title_field( __( 'Title', 'cuarco' ) );
            $this->print_content_field( __( 'Content', 'cuarco' ) );
            $this->print_category_field( __( 'Category', 'cuarco' ) );
      
            if ( ! $is_owner_selectable ) {
               $this->print_owner_field( __( 'Owner', 'cuarco' ) );
               $label = __( 'Save and add attachments', 'cuarco' );
               $this->print_submit_button( $label, 0 );
            } else {
               $label = $this->get_current_wizard_step() !== 1 ? __( 'Next step', 'cuarco' ) : __( 'Done', 'cuarco' );
               $this->print_submit_button( $label, 0 );
            }
            ?>
          </div>
      
         <?php if ( $is_owner_selectable ) { ?>
              <div class="cuar-title cuar-section-title"><?php _e( 'Owner', 'cuarco' ); ?></div>
              <div class="cuar-section">
               <?php
               $this->print_owner_field( __( 'Owner', 'cuarco' ) );
               /** @noinspection TernaryOperatorSimplifyInspection */
               $label = $this->get_current_wizard_step() !== 1 ? __( 'Save and add attachments', 'cuarco' ) : __( 'Done', 'cuarco' );
               $this->print_submit_button( $label, 1 );
               ?>
              </div>
         <?php } ?>
      
          <div class="cuar-title cuar-section-title"><?php _e( 'Attachments', 'cuarco' ); ?></div>
          <div class="cuar-section">
            <?php if ( $current_post_id > 0 && $this->get_current_wizard_step() === 1 ) : ?>
                  <div class="row cuar-clearfix">
                      <div class="col-sm-5">
                     <?php $this->print_add_attachment_method_browser( $current_post_id ); ?>
                      </div>
                      <div class="col-sm-7">
                     <?php
                     $this->print_current_attachments_manager( $current_post_id );
                     $this->print_attachment_manager_scripts();
                     ?>
                      </div>
                  </div>
               <?php $this->print_submit_button( __( 'Done', 'cuarco' ), 2 ); ?>
      
            <?php else : ?>
      
                  <div class="alert alert-default pastel">
                  <?php _e( 'You must save the post before you can upload attachments', 'cuarco' ); ?>
                  </div>
      
               <?php $this->print_submit_button( __( 'Save and add attachments', 'cuarco' ), 2 ); ?>
      
            <?php endif; ?>
          </div>
      
         <?php $this->print_form_footer(); ?>
          <script type="text/javascript">
              <!--
              (function ($) {
                  "use strict";
                  $(document).ready(function ($) {
                      $('#cuar-js-content-container').trigger('cuar:wizard:initialized');
                  });
              })(jQuery);
              //-->
          </script>
      
      <?php endif; ?>

      Regards.

    • # 1 year, 6 months ago

      Thank you,

      would it be possible to remove the Content field form File create page?

    • Thomas
      Keymaster
      # 1 year, 6 months ago

      Hi,

      The post_content field is required by WP to work, and must not be empty.

      However, if you really need to remove that, you can edit our templates (for instance customer-area-collaboration/src/php/customer-new-private-file/templates/customer-new-private-file-content.template.php) and replace the field call

      $this->print_content_field( __( 'Content', 'cuarco' ) );

      with a hidden field, like this

      printf('<input type="hidden" name="cuar_content" id="cuar_content" value="%1$s">', '&nbsp;');

      You are going to need to do that for each template in the collaboration add-on.

      Regards.

       

    • Thomas
      Keymaster
      # 1 year, 6 months ago

      Don’t forget to check our template system documentation to know how to edit templates.

      Regards.

Viewing 5 reply threads

The topic ‘Send file page’ is closed to new replies.