Plugin Directory

Changeset 936127


Ignore:
Timestamp:
06/21/2014 02:17:36 PM (12 years ago)
Author:
lynton_reed
Message:

updating for release 2.2.2

Location:
work-the-flow-file-upload/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • work-the-flow-file-upload/trunk/README.txt

    r920715 r936127  
    55Requires at least: 3.5.1
    66Tested up to: 3.9.1
    7 Stable tag: 2.1.1
     7Stable tag: 2.2.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    136136Use `[wtf_fu_show_files]` to display already upload files
    137137e.g.
    138 `[wtf_fu_show_files file_type="image" wtf_upload_dir="main_dir" wtf_upload_subdir="images" reorder="true" gallery="true"]`
    139 
    140 The attribute file_type may currently be set to 'image' or 'music', if set to image then a thumbnail will be displayed if available and if
    141 'music' then audio controls to allow playback will be displayed.
    142 
    143 The `reorder=true` attribute here allows users to change the order of their uploaded image files by dragging and dropping thumbnail images.
    144 When submitted the final order will then be written to in a text file along with the other files in the users upload directory.
    145 
    146 The `gallery` attribute will display the full sized images in a lightbox slideshow when an image file thumbnail is clicked.
    147 
    148 The wtf_fu_show_files short_code may also be called manually inside hooked functions (see the example file `examples/wtf-fu_hooks_example.php`)
    149 so that files can be generated for display inside emails.
    150 
    151 In this case you can use the attribute `"email_format" = "true"` to cause the styles to be converted to inline css.
    152 
    153 e.g.
    154 `    $shortcode_instance = Wtf_Fu_Show_Files_Shortcode::get_instance();
    155     $shortcode_instance->set_options(array(
    156         'wtf_upload_dir' => "demofiles",
    157         'file_type' => "image",
    158         'email_format' => true
    159     ));   
    160     $files_content = $shortcode_instance->generate_content();`
    161 
    162 
    163 = What other short codes can I use inside the workflows ? =
    164 
    165 Other workflow details can be retrieved using the `type='get' value='value_name'` attribute these are useful for
    166 embedding the workflow name or stage title inside your workflow stages content.
    167 
    168 e.g.
    169 Welcome `[wtf_fu type="get" value="display_name"], // display the current users name`,
    170 
    171 `[wtf_fu type="get" value="workflow" id="1" key="name"] // display the title name for workflow 1.`
     138`[wtf_fu_show_files wtf_upload_dir="main_dir" wtf_upload_subdir="images" reorder="true" gallery="true"]`
     139
     140Note : The wtf_fu_show_files short_code can use the attribute `"email_format" = "true"` to cause the styles to be converted to inline css, making the output suitable for including in emails.
     141
     142See the plugin's admin page `documentation tab` for the complete list of available shortcode attributes and their meanings.
     143
     144= What other shortcuts can I use inside the workflows ? =
     145
     146Shortcut placeholder fields can be used in the form %%XXXX%% and can be placed inside the workflow fields to represent various values at runtime.
     147e.g.
     148`%%USER_NAME%%  The current users display name.
     149%%USER_EMAIL%%  The current users email address.
     150%%ADMIN_NAME%%  The site administrators display name.
     151%%ADMIN_EMAIL%% The site administrators email address.
     152%%SITE_URL%%    The url link for this web site.
     153%%SITE_NAME%%   The name of this web site.
     154%%WORKFLOW_NAME%%   The name of the current workflow.
     155%%WORKFLOW_STAGE_TITLE%%    The current workflow stage title.
     156%%WORKFLOW_STAGE_NUMBER%%   The current stage number.
     157%%WORKFLOW_STAGE_HEADER%%   The current workflow stage header content (Workflow Templates only)
     158%%WORKFLOW_BUTTON_BAR%% The button bar with PREV and NEXT buttons (Workflow Templates only)
     159%%WORKFLOW_STAGE_CONTENT%%  The current workflow stage main content (Workflow Templates only)
     160%%WORKFLOW_STAGE_FOOTER%%   The current workflow stage footer content (Workflow Templates only)
     161%%WTF_FU_POWERED_BY_LINK%%  Includes a WFT-FU Powered by link to wtf-fu.com. (If allowed on the Plugin System Options page.)
     162%%ALL_WORKFLOW_USERS_EMAILS%%   A list of users emails addresses that have commenced using the curent workflow.
     163%%ALL_SITE_USERS_EMAILS%%   A list of all the sites registered users emails addresses.
     164%%USER_GROUP_XXXX_EMAILS%%  A list of all the users of group XXXX emails addresses. Substitute XXXX with the required user group.
     165%%ARCHIVE_USERS_FILES%% Causes all of a users files to be auto archived into a zip file and returns a download link to the zip file.
     166`
     167
     168See the plugins admin page `documentation tab` for a complete up to date list of available shortcut codes and their meanings.
    172169
    173170= Do I need to create a workflow just to enable file upload features ? =
    174171
    175172No, the workflow and file upload capabilities are completely separate entities.
    176 You can add file uploads to a page by embedding the `[wtf_fu_upload]` shortcode directly to a page.
     173You can add file uploads to a page or ppst just by embedding the `[wtf_fu_upload]` shortcode directly to a page or post.
     174
    177175There is no need to use a workflow at all if standalone file uploads are all you need.
    178176
    179 However it is often useful to embed this short code inside a workflow stage so that uploading is then part of a defined workflow.
     177However it is often useful to embed this shortcode inside a workflow stage so that uploading is then part of a defined workflow.
     178Both ways will work.
    180179
    181180= Will the css styles used by the plugin conflict with my themes css ? =
     
    235234You may override as many or as few of these as you require.
    236235
     236See the Documentation tab on the plugins settings page for an up to date listing of all shortcode attributes.
     237
    237238= Can a user change the order of their uploaded files ? =
    238239
    239240File uploads are handled asynchronously via ajax, so the initial order in which they arrive cannot be determined.
    240241
    241 However you can use the `[wtf_fu_show_files reorder="true"]` short-code to give users a list of their uploaded image thumbnails that
     242However you can use the `[wtf_fu_show_files reorder="1"]` short-code to give users a list of their uploaded image thumbnails that
    242243they can drag into their desired order. When the reorder is submitted file modified timestamps are adjusted to reflect the new order and a text file detailing the desired order
    243244is added to the users upload directory.
    244245
    245 e.g. `[wtf_fu_show_files file_type="image" wtf_upload_dir="mypackagename" wtf_upload_subdir="images" reorder="true"]`
     246e.g. `[wtf_fu_show_files wtf_upload_dir="demofiles" wtf_upload_subdir="images" reorder="1"]`
    246247
    247248= Can I configure the plugin to use different upload directories per shortcode instance ? =
     
    324325
    325326== Changelog ==
     327= 2.2.0 =
     328* Added extra shortcut field %%USER_ID%%.
     329* Added extra shortcut field %%USER_GROUP_XXXX_EMAILS%%.
     330A list of all the users of group XXXX emails addresses. Substitute XXXX with the required user group.
     331* Added extra shortcut field %%ARCHIVE_USERS_FILES%%
     332Triggers auto archiving of users upload directory and returns a download link for the file. Useful in automated email templates.
     333* Added ability to attach multiple email templates to workflow stages (PRO Feature).
     334* Fixed PHP Warnings with page redirects after deleting or cloning.
     335* Fixed improper reordering of stages when there are 10 or more stages in a workflow and a stage is deleted.
     336* Documentation updates.
     337
    326338= 2.1.1 =
    327339* Fix issue with the 2.1.0 upgrade which could cause the PRO license key field to need re-entering under some circumstances.
     
    405417generated emails.
    406418* Additional actions and filters added to process email templates (PRO only feature).
     419* Documentation updates.
    407420
    408421= 1.2.1 =
     
    435448
    436449== Upgrade Notice ==
     450= 2.2.0 =
     451* Extra shortcut fields %%USER_ID%%, %%USER_GROUP_XXXX_EMAILS%%, %%ARCHIVE_USERS_FILES%%.
     452* Multiple automated emails templates can now be attached to workflow stages (PRO Feature).
     453* Bug fixes. See changelog for full details.
     454* README file updates.
     455
    437456= 2.1.1 =
    438457* Fix issue with the 2.1.0 upgrade which could cause the PRO license key field to need re-entering under some circumstances.
  • work-the-flow-file-upload/trunk/admin/class-wtf-fu-admin.php

    r920619 r936127  
    8888        switch ($_REQUEST['operation']) {
    8989            case 'add_new_empty_workflow' :
    90                 $response_message = Wtf_Fu_Options_Admin::add_new_workflow();
     90                $wf_index = Wtf_Fu_Options_Admin::add_new_workflow();
     91                $response_message = "A new empty workflow with id = $wf_index has been added.";
    9192                //Wtf_Fu_Pro_Options_Admin::add_new_email_template();
    9293                break;
    9394            case 'add_new_demo_workflow' :
    94                 $response_message = Wtf_Fu_Options_Admin::add_new_demo_workflow();
     95                $wf_index = Wtf_Fu_Options_Admin::add_new_demo_workflow();
     96                $response_message = "A new copy of the demo workflow with id = $wf_index has been added.";
    9597                break;
    9698            case 'add_new_default_email_template' :
    97                 if (has_action('wtf_fu_add_new_default_email_template_action')) {
    98                     do_action('wtf_fu_add_new_default_email_template_action');
     99                if (has_filter('wtf_fu_add_new_default_email_template_filter')) {
     100                    $index = apply_filters('wtf_fu_add_new_default_email_template_filter', null);
     101                    $response_message = "A new email template with id = $index has been added.";                 
    99102                } else {
    100103                    log_me(" operation action not found for : {$_REQUEST['operation']}");
     
    102105                break;
    103106            case 'add_new_default_workflow_template' :
    104                 if (has_action('wtf_fu_add_new_default_workflow_template_action')) {
    105                     do_action('wtf_fu_add_new_default_workflow_template_action');
     107                if (has_filter('wtf_fu_add_new_default_workflow_template_filter')) {
     108                    $index = apply_filters('wtf_fu_add_new_default_workflow_template_filter', null);
     109                    $response_message = "A new workflow template with id = $index has been added.";
    106110                } else {
    107111                    log_me(" operation action not found for : {$_REQUEST['operation']}");
     
    465469                // documentation page does not require options setup.               
    466470                || ( $init_args['tab'] && $init_args['tab'] === wtf_fu_PAGE_DOCUMENATION_KEY )
    467                 // Workflows list page has not options to set up unless
    468                 // the 'wftab' sub page is defined.
    469                 || ( $init_args['tab'] && $init_args['tab'] === wtf_fu_PAGE_WORKFLOWS_KEY && !$init_args['wftab'] )
    470                 // Templates list page has not options to set up unless
    471                 // the 'template-type' is defined.                       
    472                 || ( $init_args['tab'] && $init_args['tab'] === wtf_fu_PAGE_TEMPLATES_KEY && !$init_args['template-type'] )
    473471        ) {
    474472            return; // no options init required, or not a page for us.
    475473        }
     474       
     475        // if workflow list then check if we need to do any clones or deletes.
     476        if ( $init_args['tab'] && $init_args['tab'] === wtf_fu_PAGE_WORKFLOWS_KEY && !$init_args['wftab'] ) {
     477            $this->do_bulk_workflow_actions();  // will re-direct and exit if any delete or clone actions are done.
     478            // Workflows list page has no options to set up unless the 'wftab' sub page is defined.
     479            // there is nothing more to do;
     480            return;
     481        }
     482       
     483        if (isset($_REQUEST['delete_stage']) && isset($_GET['wf_id'])) {
     484            Wtf_Fu_Options_Admin::delete_stage_and_reorder($_GET['wf_id'], $_REQUEST['delete_stage']);
     485            // remove the delete tab and redirect back to page.
     486            wp_redirect( remove_query_arg('delete_stage', $_SERVER['REQUEST_URI']));
     487            exit;
     488        }
     489                       
     490        // Templates list page has not options to set up unless
     491        // the 'template-type' is defined.                       
     492        if ( $init_args['tab'] && $init_args['tab'] === wtf_fu_PAGE_TEMPLATES_KEY && $init_args['wtf-fu-action'] !== 'edit') {
     493            if ( has_action('wtf_fu_process_templates_bulk_actions_action') ) {
     494                do_action('wtf_fu_process_templates_bulk_actions_action');
     495            }
     496            return;
     497        }       
     498       
     499       
    476500
    477501        $returning_from_submit = false;
     
    567591        $this->wtf_fu_initialize_options($init_args);
    568592    }
     593   
     594    /*
     595     * check if any delete or clone actions are required in the request.
     596     */
     597    public function do_bulk_workflow_actions() {
     598        // log_me('in bulk workflow');
     599        $redirect = false;
     600        // One of possibly many requests for a bulk action.
     601        if (isset($_REQUEST['workflow'])) {
     602
     603            foreach ($_REQUEST['workflow'] as $wf_id) {
     604
     605                /* process bulk action ... */
     606                switch ($this->current_bulk_action()) {
     607                    case 'delete' :
     608                        Wtf_Fu_Options_Admin::delete_workflow($wf_id);
     609                        $redirect = true;
     610                        break;
     611                    case 'clone' :
     612                        Wtf_Fu_Options_Admin::clone_workflow($wf_id);
     613                        $redirect = true;
     614                        break;
     615                    default :
     616                }
     617            }
     618        }
     619
     620        /* Check if any single action links have been clicked. */
     621        if (isset($_REQUEST['wtf-fu-action']) && isset($_REQUEST['wf_id'])) {
     622            switch ($_REQUEST['wtf-fu-action']) {
     623                case 'delete' :
     624                    Wtf_Fu_Options_Admin::delete_workflow($_REQUEST['wf_id']);
     625                    $redirect = true;
     626                    break;
     627                case 'clone' :
     628                    Wtf_Fu_Options_Admin::clone_workflow($_REQUEST['wf_id']);
     629                    $redirect = true;
     630                    break;
     631                default :
     632            }
     633        }
     634
     635        //log_me($_SERVER['REQUEST_URI']);
     636
     637        if ($redirect) {
     638            $redirect_uri = sprintf("?page=%s&tab=%s", $_REQUEST['page'], $_REQUEST['tab']);
     639            //log_me( array('redirect url' => $redirect_uri) );
     640            wp_safe_redirect($redirect_uri);
     641            exit;
     642        }   
     643    }
     644   
     645    /**
     646     * returns the bulk action request var.
     647     * @return boolean
     648     */
     649    function current_bulk_action() {
     650        if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
     651            return $_REQUEST['action'];
     652
     653        if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
     654            return $_REQUEST['action2'];
     655
     656        return false;
     657    }
    569658
    570659    /**
     
    587676
    588677        if (get_option($init_args['option_data_key']) == false) {
    589             log_me("adding option for **{$init_args['option_data_key']}**");
     678            //log_me("adding option for **{$init_args['option_data_key']}**");
    590679            add_option($init_args['option_data_key'], apply_filters($init_args['option_data_key'], $option_defaults));
    591680        }
     
    632721
    633722        $ret = add_options_page($page_title, $menu_title, $capability, $menu_slug, $callback);
    634         log_me(array(
    635             'add_options_page ret=' => $ret,
    636             'page_title' => $page_title,
    637             'menu_title' => $menu_title,
    638             'capability' => $capability,
    639             'menu_slug' => $menu_slug,
    640                 // 'callback' => $callback 
    641         ));
     723//        log_me(array(
     724//            'add_options_page ret=' => $ret,
     725//            'page_title' => $page_title,
     726//            'menu_title' => $menu_title,
     727//            'capability' => $capability,
     728//            'menu_slug' => $menu_slug,
     729//                // 'callback' => $callback 
     730//        ));
    642731        return $ret;
    643732    }
  • work-the-flow-file-upload/trunk/admin/includes/class-wtf-fu-options-admin.php

    r920619 r936127  
    141141     * and updated to the new stage.
    142142     *
    143      * returns true if any reordering was required false otherwise.
     143     * returns true if any reordering was done or false otherwise.
    144144     *
    145145     * @param type $wfid the numeric workflow id.
     
    147147    public static function reorder_stages($wfid) {
    148148
    149         $stages = Wtf_Fu_Options::get_workflow_stages($wfid, true);
     149        $stages = Wtf_Fu_Options::get_stage_ids_in_order($wfid);
    150150        $count = count($stages);
    151151
     
    157157        $i = -1;
    158158
    159         foreach ($stages as $k => $v) {
     159        //log_me(array('stages' => $stages));
     160        foreach ($stages as $v) {
    160161
    161162            $i++;
    162             if ($v['key_id'] == $i) {
     163           
     164            // log_me("i=$i, v['key_id'] ={$v['key_id']}");
     165           
     166            if ($v == $i) {
    163167                continue;
    164168            }
     
    170174             * move this stage to stage $i
    171175             */
    172             $stage_options = get_option($k);
     176            $stage_key = Wtf_Fu_Option_Definitions::get_workflow_stage_key($wfid, $v);
     177            $stage_options = get_option($stage_key);
    173178
    174179            $new_key = Wtf_Fu_Option_Definitions::get_workflow_stage_key($wfid, $i);
     
    178183            add_option($new_key, $stage_options);
    179184
    180             if (false === delete_option($k)) {
    181                 log_me("REORDER ERROR : could not delete old option key $k");
     185            if (false === delete_option($stage_key)) {
     186                log_me("ERROR reordering stages, could not remove the relocated stage with key $stage_key when moving from stage $v to $i");
    182187            }
    183188
     
    186191             * value.
    187192             */
    188             Wtf_Fu_Options_Admin::update_all_users_workflow_stage_settings($wfid, $v['key_id'], $i);
     193            Wtf_Fu_Options_Admin::update_all_users_workflow_stage_settings($wfid, $v, $i);
    189194            $ret = true; // modification has occurred.
    190             break;
    191195        }
    192196
     
    209213
    210214
    211         $wf_users = Wtf_Fu_Options_Admin::get_workflow_users($wfid);
     215        $wf_users = Wtf_Fu_Options::get_workflow_users($wfid);
    212216
    213217        // log_me(array( '$wf_users' => $wf_users));
     
    492496            }
    493497        }
    494         return ("A new copy of the demo workflow with id = $wf_index has been added.");
     498        return ($wf_index);
    495499    }
    496500
     
    567571    public static function add_new_workflow_stage_options($wf_index, $stage) {
    568572
    569         log_me(array("adding stage key-id = {$stage['key_id']} to workflow $wf_index" => $stage));
     573        //log_me(array("adding stage key-id = {$stage['key_id']} to workflow $wf_index" => $stage));
    570574
    571575        if (!array_key_exists('key_id', $stage)) {
  • work-the-flow-file-upload/trunk/admin/includes/class-wtf-fu-workflow-list-table.php

    r920619 r936127  
    242242    }
    243243
    244     /**
    245      * process bulk action delete or clone.
    246      * also doess single actions as well.
    247      */
    248     function process_bulk_action() {
    249 
    250         $redirect = false;
    251         // One of possibly many requests for a bulk action.
    252         if (isset($_REQUEST['workflow'])) {
    253 
    254             foreach ($_REQUEST['workflow'] as $wf_id) {
    255 
    256                 /* process bulk action ... */
    257                 switch ($this->current_action()) {
    258                     case 'delete' :
    259                         Wtf_Fu_Options_Admin::delete_workflow($wf_id);
    260                         $redirect = true;
    261                         break;
    262                     case 'clone' :
    263                         Wtf_Fu_Options_Admin::clone_workflow($wf_id);
    264                         $redirect = true;
    265                         break;
    266                //     case 'export' :
    267                //         Wtf_Fu_Options_Admin::export_workflow($wf_id);
    268                //         $redirect = true;
    269                //         break;
    270                     default :
    271                 }
    272             }
    273         }
    274 
    275         /* Check if any single action links have been clicked. */
    276         if (isset($_REQUEST['wtf-fu-action']) && isset($_REQUEST['wf_id'])) {
    277             switch ($_REQUEST['wtf-fu-action']) {
    278                 case 'delete' :
    279                     Wtf_Fu_Options_Admin::delete_workflow($_REQUEST['wf_id']);
    280                     $redirect = true;
    281                     break;
    282                 case 'clone' :
    283                     Wtf_Fu_Options_Admin::clone_workflow($_REQUEST['wf_id']);
    284                     $redirect = true;
    285                     break;
    286              //   case 'export' :
    287              //       Wtf_Fu_Options_Admin::export_workflow($_REQUEST['wf_id']);
    288              //       $redirect = true;
    289              //       break;
    290                 default :
    291             }
    292         }
    293 
    294         log_me($_SERVER['REQUEST_URI']);
    295 
    296         if ($redirect) {
    297             // redirect back to the base page so we remoce the bulk actions from the url.
    298             //$remove_args = array('wtf-fu-action');
    299             //$redirect_uri = remove_query_arg($remove_args, $_SERVER['REQUEST_URI']);
    300 
    301             $redirect_uri = sprintf("?page=%s&tab=%s", $_REQUEST['page'], $_REQUEST['tab']);
    302             log_me(array('redirect url' => $redirect_uri));
    303             wp_safe_redirect($redirect_uri);
    304             exit;
    305         }
    306     }
    307244
    308245    /**
     
    355292         * case, we'll handle them within our package just to keep things clean.
    356293         */
    357         $this->process_bulk_action();
     294        //$this->process_bulk_action();
    358295
    359296
  • work-the-flow-file-upload/trunk/admin/views/admin-templates-nonpro.php

    r913912 r936127  
    6767            This will then automatically generate and send an email whenever a user passes through the stage that the email is attached to.<br/>
    6868            Similarly you can attach Workflow page templates to a Workflow on the Workflow option tab, in this way you can create different layouts for different workflows.</p>
    69         <p>Templates also support embedding of <strong>shortcut fields</strong> and the <code>[wtf_fu_showfiles]</code> shortcode.</p>
     69        <p>Templates also support embedding of <strong>shortcut fields</strong> and the <code>[wtf_fu_show_files]</code> shortcode. See the documentation tab for more details on available template shortcuts.</p>
    7070        <p>You can see some screenshots of the PRO version of the relevant page tabs below.</p>       
    7171    </div>
  • work-the-flow-file-upload/trunk/admin/views/admin-workflow-edit.php

    r913912 r936127  
    3232}
    3333
    34 if (isset($_REQUEST['delete_stage'])) {
    35     Wtf_Fu_Options_Admin::delete_stage_and_reorder($wfid, $_REQUEST['delete_stage']);
    36     // remove the delete tab and redirect back to page.
    37     wp_redirect( remove_query_arg('delete_stage', $_SERVER['REQUEST_URI']));
    38 }
    39 
    4034if (isset($_GET['wftab'])) {
    4135    $active_tab = $_GET['wftab'];
    42     $stages = Wtf_Fu_Options::getWorkFlowStageIDs($wfid);
     36    $stages = Wtf_Fu_Options::get_stage_ids_in_order($wfid);
    4337}
    4438
  • work-the-flow-file-upload/trunk/admin/views/admin-workflows.php

    r920619 r936127  
    1616 */
    1717
     18/*
     19 * Handle any bulk actions first then redirect to remove the actions from the url.
     20 */
     21
    1822require_once plugin_dir_path(__FILE__)
    1923        . '../../admin/includes/class-wtf-fu-workflow-list-table.php';
    2024
    2125
    22         if (class_exists('Wtf_fu_Pro')) {
    23             $import_nonce = wp_nonce_field('wtf_fu_import_nonce', 'wtf_fu_import_nonce', true);
    24             $import_submit_button = get_submit_button(__('Import'), 'secondary', 'submit', true);
    25            
    26             $import_section = "
     26if (class_exists('Wtf_fu_Pro')) {
     27    $import_nonce = wp_nonce_field('wtf_fu_import_nonce', 'wtf_fu_import_nonce', true);
     28    $import_submit_button = get_submit_button(__('Import'), 'secondary', 'submit', true);
     29
     30    $import_section = "
    2731                <div class='postbox'><h3><span>Import Settings</span></h3>
    2832        <div class='inside'>
     
    3842        </div>
    3943    </div>";
    40         } else {
    41             $import_section = "
     44} else {
     45    $import_section = "
    4246                <div class='postbox'><h3><span>Import Settings</span></h3>
    4347        <div class='inside'>
    4448            <p>Import and Export of workflows requires the PRO extension to be installed and activated.</p>
    4549        </div>
    46     </div>";           
    47            
    48         }
     50    </div>";
     51}
    4952/*
    5053 * Add new workflow link.
     
    7174                <ol><li>Workflows are always created with an id equal to the first available number starting at 1. <br/> If a workflow is deleted then its number will be reused for the next added workflow. <br/>
    7275                        Any embedded workflow shortcodes that were using this workflow id will then reference the new workflow.</li>
    73                     <li>Importing of any exported json files is not yet implemented.<br/></li>
    7476                </ol>
    7577            </small>   
     
    7880        <button name='add_new_empty_workflow' id='wtf_fu_operation_button' value="1"><span>Add New Empty Workflow</span></button>
    7981        <button name='add_new_demo_workflow' id='wtf_fu_operation_button' value="1"><span>Add New Cloned Demo Workflow</span></button>
    80         <?php echo $import_section; ?>
    81 
    82        
    83        
    84        
    85        
    86 </p>
    87 <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
    88 <form id="workflows-filter" method="get">
    89     <!-- For plugins, we also need to ensure that the form posts back to our current page -->
    90     <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
    91     <input type="hidden" name="tab" value="<?php echo $_REQUEST['tab'] ?>" />
    92     <input type="hidden" name="wtf-fu-action" value="<?php echo wtf_fu_get_value($_REQUEST, 'wtf-fu-action'); ?>" />
    93     <!-- Now we can render the completed list table -->
    94     <?php $workflowListTable->display() ?>
    95 </form>
     82        <?php echo $import_section; ?>   
     83    </p>
     84    <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
     85    <form id="workflows-filter" method="get">
     86        <!-- For plugins, we also need to ensure that the form posts back to our current page -->
     87        <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
     88        <input type="hidden" name="tab" value="<?php echo $_REQUEST['tab'] ?>" />
     89        <input type="hidden" name="wtf-fu-action" value="<?php echo wtf_fu_get_value($_REQUEST, 'wtf-fu-action'); ?>" />
     90        <!-- Now we can render the completed list table -->
     91        <?php $workflowListTable->display() ?>
     92    </form>
    9693</div>
  • work-the-flow-file-upload/trunk/admin/views/documentation.php

    r920619 r936127  
    6161            <p>Email Templates may also contain the <code><strong>[wtf_fu_show_files email_format='1']</strong></code> shortcode if desired to include a show_files display inside an email.<br/>
    6262            The email_format option is used here to cause the html output to inline the css for use inside an email.</p>
    63             <p>The default email template is below, this can be edited or cloned as desired for your own emails in the <code>Emails tab</code> where you can add your own html to the message as well as
     63            <p>The default email template is below, this can be edited or cloned as desired for your own emails in the <code>Templates tab</code> You can add your own html to the message as well as
    6464                modify the TO: CC: BCC: and FROM: fields.</p>
    6565            <p>After that you will be able to select the template to be emailed from a drop down list in the workflow stage options and the email will be automatically sent once the stage is completed by a user.</p>
  • work-the-flow-file-upload/trunk/includes/class-wtf-fu-option-definitions.php

    r920619 r936127  
    337337                ), 
    338338            wtf_fu_DEFAULTS_TEMPLATE_FIELDS_KEY => array(         
     339                '%%USER_ID%%' => 'The current users user ID.',
    339340                '%%USER_NAME%%' => 'The current users display name.',
    340341                '%%USER_EMAIL%%' => 'The current users email address.',
     
    352353                '%%WTF_FU_POWERED_BY_LINK%%' => 'Includes a WFT-FU Powered by link to wtf-fu.com. (If allowed on the Plugin System Options page.)',
    353354                '%%ALL_WORKFLOW_USERS_EMAILS%%' => 'A list of users emails addresses that have commenced using the curent workflow.',
    354                 '%%ALL_SITE_USERS_EMAILS%%' => 'A list of all the sites registered users emails addresses.'
    355                 )                           
     355                '%%ALL_SITE_USERS_EMAILS%%' => 'A list of all the sites registered users emails addresses.',
     356                '%%USER_GROUP_XXXX_EMAILS%%' => 'A list of all the users of group XXXX emails addresses. Substitute XXXX with the required user group.',
     357                '%%ARCHIVE_USERS_FILES%%' => 'Causes all of a users files to be auto archived into a zip file and returns a download link to the zip file. WARNING this will cause delays while archiving completes, only use this if the delay time is acceptable. Intended to allow templated emails to automatically archive and email an admin users uploaded files. Files can be manually archived from the admin pages which may be a better solution to avoid delays to the user.'
     358               )                           
    356359        );
    357360       
  • work-the-flow-file-upload/trunk/includes/class-wtf-fu-options.php

    r920715 r936127  
    302302     * sorted in numerical order.
    303303     */
    304     static function getWorkFlowStageIDs($wf_index) {
     304    static function get_stage_ids_in_order($wf_index) {
    305305        $ids = array();
    306306        $stage_keys = self::get_workflow_stages($wf_index);
     
    311311        asort($ids, SORT_NUMERIC);
    312312
    313       //  log_me(array('getWorkFlowStageIDs' => $ids));
     313        //log_me(array('getWorkFlowStageIDs' => $ids));
    314314        return $ids;
    315315    } 
     
    425425    }   
    426426   
     427   
     428    static function get_all_group_user_emails($group = '') {     
     429        $args = array('role' => $group);
     430        $users = get_users($args); 
     431        return Wtf_Fu_Options::get_users_email_list($users);
     432    }
     433   
    427434    /**
    428435     * return string of all emails for users in a workflow
     
    432439    static function get_all_user_emails($workflow_id = 0) {
    433440       
    434         $users = Wtf_Fu_Options::get_workflow_users($workflow_id);
     441        $wf_users = Wtf_Fu_Options::get_workflow_users($workflow_id);
     442        $users = array();
     443       
     444        foreach ($wf_users as $wf_user) {
     445            $users[] = $wf_user['user'];
     446        }
     447       
     448        return Wtf_Fu_Options::get_users_email_list($users);     
     449    }
     450       
     451    static function get_users_email_list($users) {
     452       
     453       // log_me($users);
    435454        $emails = array();
    436 
    437         //log_me($users);
    438455       
    439456        foreach ($users as $user) {
    440             $emails[] = $user['user']->user_email;
     457            $emails[] = $user->user_email;
    441458        }
    442459
    443460        $email_list = implode(',', $emails);
    444         
     461       // log_me($emails);
    445462        return $email_list;
    446463    }   
  • work-the-flow-file-upload/trunk/includes/wtf-fu-common-utils.php

    r920619 r936127  
    461461}
    462462
     463function wtf_fu_multiple_list_box($id, $option_name, $val, $label, $values) {
     464   
     465    $option_name .= '[]'; // append array so options.php will know to store as multiple values.
     466    $size = count($values);
     467    $html = "<select id=\"$id\" name=\"$option_name\" multiple size=\"$size\">";
     468   
     469    // if value is not set or legacy string then force to an array.
     470    if (!is_array($val)) {
     471        $val = array($val);
     472    }
     473    foreach ($values as $v) {
     474        $html .= "<option ";
     475        if (in_array($v['value'], $val)) {
     476            $html .= "selected=\"selected\" ";
     477        }
     478        $html .= "value=\"{$v['value']}\">{$v['name']}</option>";
     479    }
     480    $html .= '</select>&nbsp;';
     481    $html .= '<label for="' . $id . '">' . $label . '</label>';
     482
     483    return $html;
     484}
     485
    463486/**
    464487 * Returns a table of all the available template fields.
    465488 */
    466489function wtf_fu_get_template_fields_table($ignore = false) {
    467     $table = "<table><tr><th>TEMPLATE SHORTCUT</th><th>ACTION</th></tr>";
     490    $table = "<table class='table'><tr><th>TEMPLATE SHORTCUT</th><th>ACTION</th></tr>";
    468491
    469492    $arr = Wtf_Fu_Option_Definitions::get_instance()->get_page_option_fields_default_labels(wtf_fu_DEFAULTS_TEMPLATE_FIELDS_KEY);
     
    600623
    601624    foreach ($shortcuts as $shortcut) {
     625        if ($shortcut === '%%USER_GROUP_XXXX_EMAILS%%') {
     626            continue; //handled separately
     627        }
    602628        foreach ($field_values as $value) {
    603629            if (strstr($value, $shortcut)) {
     
    608634    }
    609635   
     636   
    610637    //log_me(array('shortcuts required' => $shortcuts_required ));
    611638
     
    618645                $replace[$shortcut] = $wp_user->display_name;
    619646                break;
     647           
     648            case '%%USER_ID%%' :
     649                $wp_user = wp_get_current_user();
     650                $replace[$shortcut] = $wp_user->ID;
     651                break;     
    620652
    621653            case '%%USER_EMAIL%%' :
     
    682714                $replace[$shortcut] = wtf_fu_get_value($stage_options, 'footer');
    683715                break;
    684 
     716           
     717            case '%%ARCHIVE_USERS_FILES%%' :
     718                $wp_user = wp_get_current_user();
     719                $zipname = 'auto_' . wtf_fu_create_archive_name($wp_user->ID, '', '.zip', false);
     720                $replace[$shortcut] = wtf_fu_do_archive_user_files($wp_user->ID, $zipname);
     721                break;
     722           
    685723            default :
    686724                //log_me("Shortcut replacement key not found for $shortcut");
    687725        }
    688726    }
     727   
     728   
     729    // Handle USER_GROUP_XXXX_EMAILS
     730    $pattern = '/%%USER_GROUP_([^%]*)_EMAILS%%/';
     731    foreach ($field_values as $value) {
     732        $matches = array();
     733        $num = preg_match_all($pattern, $value, $matches);
     734        if ( $num >= 1 ) {
     735            //log_me($matches);
     736            for ( $i=0; $i < $num; $i++) {
     737                $replace[$matches[0][$i]]
     738                    = Wtf_Fu_Options::get_all_group_user_emails($matches[1][$i]);
     739            }
     740        }
     741    }   
    689742
    690743    $fields = str_replace(array_keys($replace), array_values($replace), $fields);
  • work-the-flow-file-upload/trunk/public/class-wtf-fu.php

    r920715 r936127  
    4444     * @var     string
    4545     */
    46     const VERSION = '2.1.1';
     46    const VERSION = '2.2.0';
    4747
    4848    /**
     
    433433
    434434            if (!wp_script_is($fileupload_handle, 'enqueued')) {
    435                 log_me('class-wtf-fu registering and enqueuing ' . $fileupload_handle);
     435                //log_me('class-wtf-fu registering and enqueuing ' . $fileupload_handle);
    436436                wp_register_script($fileupload_handle, plugin_dir_url(__FILE__) . 'assets/js/wtf-fu-file-upload.js', array('jquery', 'wp-ajax-response'), Wtf_Fu::VERSION, true);
    437437                wp_enqueue_script($fileupload_handle);
     
    441441                ));
    442442
    443                 log_me("uploadFilesHtml  wp_localize_script for $fileupload_handle = $ret");
     443                //log_me("uploadFilesHtml  wp_localize_script for $fileupload_handle = $ret");
    444444            } else {
    445                 log_me("$fileupload_handle is already enqueued");
     445                //log_me("$fileupload_handle is already enqueued");
    446446            }
    447447           
  • work-the-flow-file-upload/trunk/public/includes/class-wtf-fu-show-files-shortcode.php

    r920619 r936127  
    4848    public function set_options($attr) {
    4949
    50         log_me(array("set_options passed in " => $attr));
     50        //log_me(array("set_options passed in " => $attr));
    5151
    5252        /*
     
    114114     */
    115115    public function __construct() {
    116         log_me('__construct  Wtf_Fu_Filereorder_Shortcode ');
     116        // log_me('__construct  Wtf_Fu_Filereorder_Shortcode ');
    117117    }
    118118
     
    126126        if (null == self::$instance) {
    127127            self::$instance = new self;
    128             log_me("new " . __CLASS__ . " instance created.");
     128            //log_me("new " . __CLASS__ . " instance created.");
    129129            return self::$instance;
    130130        }
    131131
    132         log_me("existing  " . __CLASS__ . " instance returned.");
     132        //log_me("existing  " . __CLASS__ . " instance returned.");
    133133        return self::$instance;
    134134    }
  • work-the-flow-file-upload/trunk/work-the-flow-file-upload.php

    r920715 r936127  
    55 * Plugin URI:        http://wtf-fu.com
    66 * Description:       Front end Html5 File Upload and configurable Workflow steps. Multiple file drag and drop, gallery image display, file reordering and archiving.
    7  * Version:           2.1.1
     7 * Version:           2.2.0
    88 * Author:            Lynton Reed
    99 * Author URI:        http://wtf-fu.com
Note: See TracChangeset for help on using the changeset viewer.