Plugin Directory

Changeset 2157599


Ignore:
Timestamp:
09/17/2019 03:17:12 AM (6 years ago)
Author:
Will Brownsberger
Message:

4.5.3

Location:
wp-issues-crm
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • wp-issues-crm/tags/4.5.3/css/dashboard.css

    r2152005 r2157599  
    164164}
    165165
    166 /* maintain always open flexible height for dashboard summary */
    167 .wic-dashboard-flex .wic-inner-dashboard,
    168 .wic-dashboard-flex.wic-dashboard-tall .wic-inner-dashboard {
    169     height: auto;
    170     margin-bottom: 30px;
    171     max-height: calc( 100vh - 540px) ;
    172 }
    173 .wic-dashboard-flex .wic-inner-dashboard ul.wic-post-list,
    174 .wic-dashboard-flex.wic-dashboard-tall .wic-inner-dashboard ul.wic-post-list {
    175     height: auto ;
    176     max-height: calc( 100vh - 540px) ;
    177 }
    178 
    179 
    180166.dashboard-not-found {
    181167    margin: 20px;
  • wp-issues-crm/tags/4.5.3/js/ajax.js

    r2069459 r2157599  
    8787    }
    8888
     89    // note: this function invoked directly on loadDashboardPanel in dashboard.js
    8990     wpIssuesCRM.saveState = function ( currentEntity, currentAction ) {
    9091        var valuesObject = {};
  • wp-issues-crm/tags/4.5.3/js/dashboard.js

    r2145245 r2157599  
    4444             defaultDate: +0
    4545        });
    46         $( "#dashboard\\[end\\]\\[date_range\\]" ).datepicker( "setDate", "+0" )
    47         $( "#dashboard\\[start\\]\\[date_range\\]" ).datepicker( "setDate", "-30" )
    48         $( "#dashboard\\[end_t\\]\\[date_range\\]" ).datepicker( "setDate", "+0" )
    49         $( "#dashboard\\[start_t\\]\\[date_range\\]" ).datepicker( "setDate", "-30" )
     46        $( "#dashboard\\[end\\]\\[date_range\\]" ).attr( "placeholder", "Before?" )
     47        $( "#dashboard\\[start\\]\\[date_range\\]" ).attr( "placeholder", "After?" )
     48        $( "#dashboard\\[end_t\\]\\[date_range\\]" ).attr( "placeholder", "Before?" )
     49        $( "#dashboard\\[start_t\\]\\[date_range\\]" ).attr( "placeholder", "After?" )
    5050        $( "#dashboard\\[case_review_date\\]\\[date_range\\]" ).attr( "placeholder", "Due before?" )
    5151        $( "#dashboard\\[review_date\\]\\[date_range\\]" ).attr( "placeholder", "Due before?" )
    5252
    53 
    54         $( ".wic-dashboard" ).each( function () {
     53        // only open what has been set as tall
     54        $( ".wic-dashboard.wic-dashboard-tall" ).each( function () {
    5555            wpIssuesCRM.loadDashboardPanel ( $( this ).attr("id") );
    5656        });
     
    6161            if ( currentTile.hasClass("wic-dashboard-tall") ) {
    6262                 currentTile.removeClass( "wic-dashboard-tall" );
     63                 wpIssuesCRM.saveDashboardLayout();
    6364            } else {
    6465                $( ".wic-dashboard").removeClass ( "wic-dashboard-tall" );
    6566                currentTile.addClass ( "wic-dashboard-tall" );
     67                wpIssuesCRM.loadDashboardPanel ( currentTile.attr("id") );
    6668            }
    67             wpIssuesCRM.saveDashboardLayout();
    6869        });
    6970
     
    7475                $( ".wic-dashboard").removeClass ( "wic-dashboard-tall" );
    7576                currentTile.addClass ( "wic-dashboard-tall" );
    76                 wpIssuesCRM.saveDashboardLayout();
     77                wpIssuesCRM.loadDashboardPanel ( currentTile.attr("id") );
     78                // dashboard layout will be saved on load
    7779            }
    7880        });
     
    8486                $( ".wic-dashboard").removeClass ( "wic-dashboard-tall" );
    8587                currentTile.addClass ( "wic-dashboard-tall" );
    86                 wpIssuesCRM.saveDashboardLayout();
     88                wpIssuesCRM.loadDashboardPanel ( currentTile.attr("id") );
     89                // dashboard layout will be saved on load
    8790            }
    8891        });
     
    106109    }
    107110
     111    // includes same action as saveDashboardLayout on server side
    108112    wpIssuesCRM.loadDashboardPanel = function ( panel ) {
    109         var varPreID;
    110         var submittedData = '';
    111         if ( 'dashboard_activity' == panel ) {
    112             var includedTypes=[];
    113             $( "#filter-activities-menu .wic-input-checked" ).each ( function () {
    114                 if ( $( this ).prop("checked") ) {
    115                     varPreID =  $(this).attr("id").substr(14);
    116                     includedTypes.push ( varPreID.substr(0, varPreID.length -1 ) );
    117                 }
    118             });
    119             submittedData = {
    120                 start:      $( "#dashboard\\[start\\]\\[date_range\\]" ).val(),
    121                 end:        $( "#dashboard\\[end\\]\\[date_range\\]" ).val(),
    122                 included:   includedTypes
    123             }
    124         } else if ( 'dashboard_activity_type' == panel ) {
    125             submittedData = {
    126                 start:      $( "#dashboard\\[start_t\\]\\[date_range\\]" ).val(),
    127                 end:        $( "#dashboard\\[end_t\\]\\[date_range\\]" ).val(),
    128             }       
    129         } else if ( 'dashboard_cases' == panel ) {
    130             submittedData = {
    131                 case_assigned:      $( "#dashboard\\[case_assigned\\]\\[case_assigned\\]" ).val(),
    132                 case_review_date:   $( "#dashboard\\[case_review_date\\]\\[date_range\\]" ).val(),
    133                 case_status:        $( "#dashboard\\[case_status\\]\\[case_status\\]" ).val(),
    134             }           
    135         } else if ( 'dashboard_issues' == panel ) {
    136             submittedData = {
    137                 issue_staff:        $( "#dashboard\\[issue_staff\\]\\[issue_staff\\]" ).val(),
    138                 review_date:        $( "#dashboard\\[review_date\\]\\[date_range\\]" ).val(),
    139                 follow_up_status:   $( "#dashboard\\[follow_up_status\\]\\[follow_up_status\\]" ).val(),
    140             }               
    141         }
     113        wpIssuesCRM.ajaxPost(  'dashboard', panel, '', assembleDashboardStatus(), function( response ) {
     114            $( "#" + panel ).children( ".wic-inner-dashboard").html( response );
    142115
    143         wpIssuesCRM.ajaxPost(  'dashboard', panel, '', submittedData, function( response ) {
    144             $( "#" + panel ).children( ".wic-inner-dashboard").html( response );
    145116            // special initialization terms for particular panels
    146117            if ( 'dashboard_searches' == panel ) {
    147118                wpIssuesCRM.initializeSearchLogTooltips();
    148119            }
     120
     121            // save state to allow return to same panel
     122            wpIssuesCRM.saveState ( 'dashboard', 'dashboard' );
    149123           
    150124        });
     
    152126
    153127    wpIssuesCRM.saveDashboardLayout = function ()  {
    154         var varWide = [];
     128        wpIssuesCRM.ajaxPost(  'dashboard', 'save_dashboard_preferences', '', assembleDashboardStatus() ,  function( response ) {
     129        });
     130    }
     131
     132    assembleDashboardStatus = function() {
     133   
     134        // set open item
    155135        var varTall = [];
    156136            $( '.wic-dashboard-tall' ).each ( function () {
    157137            varTall.push ( $( this ).attr("id") );
    158138        });
     139       
     140        // set sort order
     141        var varSort =  $( "#dashboard-sortables" ).sortable( "toArray");
     142       
     143        // set activity vars
     144        var varPreID;
     145        var includedTypes=[];
     146        $( "#filter-activities-menu .wic-input-checked" ).each ( function () {
     147            if ( $( this ).prop("checked") ) {
     148                varPreID =  $(this).attr("id").substr(14);
     149                includedTypes.push ( varPreID.substr(0, varPreID.length -1 ) );
     150            }
     151        });
     152        var activityVars = {
     153            start:      $( "#dashboard\\[start\\]\\[date_range\\]" ).val(),
     154            end:        $( "#dashboard\\[end\\]\\[date_range\\]" ).val(),
     155            included:   includedTypes
     156        }       
     157       
     158        // set activity_type vars
     159        var activityTypeVars = {
     160            start:      $( "#dashboard\\[start_t\\]\\[date_range\\]" ).val(),
     161            end:        $( "#dashboard\\[end_t\\]\\[date_range\\]" ).val(),
     162        }
     163       
     164        // set cases vars
     165        var casesVars = {
     166            case_assigned:      $( "#dashboard\\[case_assigned\\]\\[case_assigned\\]" ).val(),
     167            case_review_date:   $( "#dashboard\\[case_review_date\\]\\[date_range\\]" ).val(),
     168            case_status:        $( "#dashboard\\[case_status\\]\\[case_status\\]" ).val(),
     169        }       
     170       
     171        // set issues vars
     172        var issuesVars = {
     173            issue_staff:        $( "#dashboard\\[issue_staff\\]\\[issue_staff\\]" ).val(),
     174            review_date:        $( "#dashboard\\[review_date\\]\\[date_range\\]" ).val(),
     175            follow_up_status:   $( "#dashboard\\[follow_up_status\\]\\[follow_up_status\\]" ).val(),
     176        }   
     177       
    159178        var dashboardConfig = {
    160             sort: $( "#dashboard-sortables" ).sortable( "toArray"),
    161             wide: varWide,
    162             tall: varTall
    163         }
    164         wpIssuesCRM.ajaxPost(  'dashboard', 'save_dashboard_preferences', '', dashboardConfig ,  function( response ) {
    165         });
     179            sort: varSort,
     180            tall: varTall,
     181            dashboard_activity: activityVars,
     182            dashboard_activity_type: activityTypeVars,
     183            dashboard_cases: casesVars,
     184            dashboard_issues: issuesVars
     185        }   
     186
     187        return dashboardConfig;
     188       
    166189    }
    167190
     191
    168192}( window.wpIssuesCRM = window.wpIssuesCRM || {}, jQuery )); // end anonymous namespace enclosure   
  • wp-issues-crm/tags/4.5.3/php/entity/class-wic-entity-dashboard.php

    r2152005 r2157599  
    1919    protected function dashboard () {
    2020
    21         // get sort order and wide display list
     21        // get sort order and what is open
    2222        $config = WIC_Entity_User::get_wic_user_preference ( 'wic_dashboard_config' );
    2323        if ( $config ) {
     
    6060        }
    6161        ksort ( $sorted_dashboard_divs );
     62        // identify which entity to start as open
     63        $open_div = isset ( $config->tall ) ? $config->tall[0] : 'dashboard_overview';
    6264        echo '<ul id="dashboard-sortables" >';
    6365        foreach ( $sorted_dashboard_divs as $key => $dashboard_div ) {
    64             $wide_class = ' wic-dashboard-full ';
    65             $tall_class = in_array( $dashboard_div[0], array ( 'dashboard_overview' ) ) ? ' wic-dashboard-flex ' : ''; // no longer controlled by user
     66            $tall_class = $open_div == $dashboard_div[0] ? ' wic-dashboard-tall ' : ''; // no longer controlled by user
    6667            echo
    67                 '<li id = "' . $dashboard_div[0] . '" class = "ui-state-default wic-dashboard ' . $wide_class . $tall_class . '">' .
     68                '<li id = "' . $dashboard_div[0] . '" class = "ui-state-default wic-dashboard  wic-dashboard-full  ' . $tall_class . '">' .
    6869                    '<div class="wic-dashboard-title wic-dashboard-drag-handle" title="Drag to reorder dashboard widgets"><span class="dashicons dashicons-move"></span>' . $dashboard_div[1] . '</div>' .
    69                     $this->special_buttons ( $dashboard_div[0] ) .
     70                    $this->special_buttons ( $dashboard_div[0], $config ) .
    7071                    '<button class="wic-dashboard-title wic-dashboard-refresh-button" type="button" title="Refresh"><span class="dashicons dashicons-update"></span></button>' .
    7172                    '<div class = "wic-inner-dashboard" id="wic-inner-dashboard-' . $dashboard_div[0] . '">' .
     
    7980
    8081
    81     public static function save_dashboard_preferences ( $dummy_id, $data ) {
     82    public static function save_dashboard_preferences ( $dummy_id, $data ) { 
    8283        return WIC_Entity_User::set_wic_user_preference ( 'wic_dashboard_config', $data );
    8384    }
    8485
    85     public static function dashboard_overview ( $dummy_id, $dummy_data ) {
     86    public static function dashboard_overview ( $dummy_id, $data ) {
     87   
     88        self::save_dashboard_preferences ( $dummy_id, $data );
    8689   
    8790        global $wpdb;
     
    213216   
    214217    // display a list of CASES assigned to user --  (SEE ONLY OWN, NO OPTIONS) 
    215     public static function dashboard_mycases( ) {
    216        
     218    public static function dashboard_mycases( $dummy_id, $data ) {
     219
     220        self::save_dashboard_preferences ( $dummy_id, $data );
     221
    217222        $user_ID = get_current_user_id();   
    218223       
     
    256261       
    257262    // display a list of issues assigned to user --  (SEE ONLY OWN, NO OPTIONS)
    258     public static function dashboard_myissues() {
     263    public static function dashboard_myissues( $dummy_id, $data ) {
     264   
     265        self::save_dashboard_preferences ( $dummy_id, $data );
    259266       
    260267        $user_ID = get_current_user_id();   
     
    299306
    300307    // display a list of assigned cases -- default is to current user
    301     public static function dashboard_cases( $dummy, $data) {
    302    
    303         extract ( (array) $data ); // case_assigned/case_review_date/case_status
     308    public static function dashboard_cases( $dummy_id, $data) {
     309   
     310        self::save_dashboard_preferences ( $dummy_id, $data );
     311   
     312        extract ( (array) $data->dashboard_cases ); // case_assigned/case_review_date/case_status
    304313
    305314        $wic_query = WIC_DB_Access_Factory::make_a_db_access_object( 'constituent' );
     
    369378       
    370379    // display a list of assigned issues -- default is to current user 
    371     public static function dashboard_issues( $dummy, $data ) {
    372    
    373         extract ( (array) $data ); // issue_staff/review_date/follow_up_status:     
     380    public static function dashboard_issues( $dummy_id, $data ) {
     381   
     382        self::save_dashboard_preferences ( $dummy_id, $data );
     383   
     384        extract ( (array) $data->dashboard_issues ); // issue_staff/review_date/follow_up_status:       
    374385        $wic_query = WIC_DB_Access_Factory::make_a_db_access_object( 'issue' );
    375386
     
    485496
    486497
    487     public static function dashboard_recent() {
     498    public static function dashboard_recent( $dummy_id, $data ) {
     499   
     500        self::save_dashboard_preferences ( $dummy_id, $data );
    488501   
    489502        $user_ID = get_current_user_id();   
     
    508521
    509522    // display user's search log ( which includes form searches, items selected from lists and also items saved )
    510     public static function dashboard_searches() {
     523    public static function dashboard_searches(  $dummy_id, $data ) {
     524   
     525        self::save_dashboard_preferences ( $dummy_id, $data );
    511526   
    512527        $wic_query = WIC_DB_Access_Factory::make_a_db_access_object( 'search_log' );
     
    523538    }
    524539
    525     public static function dashboard_uploads () {
     540    public static function dashboard_uploads (  $dummy_id, $data ) {
     541   
     542        self::save_dashboard_preferences ( $dummy_id, $data );
     543   
    526544        // table entry in the access factory will make this a standard WIC DB object
    527545        $wic_query =    WIC_DB_Access_Factory::make_a_db_access_object( 'upload' );
     
    549567    }
    550568   
    551     private function special_buttons ( $dashboard_div ) {
     569   
     570   
     571    private function special_buttons ( $dashboard_div, $config ) {
     572       
    552573        if ( 'dashboard_activity'  == $dashboard_div ) {
    553574            $start_control = WIC_Control_Factory::make_a_control ( 'date' );
     
    555576            $end_control = WIC_Control_Factory::make_a_control ( 'date' );
    556577            $end_control->initialize_default_values( 'dashboard', 'date_range', 'end' );
     578            if ( isset ( $config->dashboard_activity ) ) {
     579                $start_control->set_value( $config->dashboard_activity->start );
     580                $end_control->set_value( $config->dashboard_activity->end );
     581            }
    557582            return  $start_control->form_control() . $end_control->form_control() . WIC_Entity_Activity::make_activity_type_filter_button();
    558583        } elseif ( 'dashboard_activity_type'  == $dashboard_div ) {
     
    561586            $end_control = WIC_Control_Factory::make_a_control ( 'date' );
    562587            $end_control->initialize_default_values( 'dashboard', 'date_range', 'end_t' );
     588            if ( isset ( $config->dashboard_activity_type ) ) {
     589                $start_control->set_value( $config->dashboard_activity_type->start );
     590                $end_control->set_value( $config->dashboard_activity_type->end );
     591            }
    563592            return $start_control->form_control() . $end_control->form_control();
    564593        } elseif ( 'dashboard_cases'  == $dashboard_div ) {
     
    571600            $status_control->initialize_default_values( 'dashboard', 'case_status', 'case_status' );
    572601            $status_control->set_value ( '1' );
     602            if ( isset ( $config->dashboard_cases ) ) {
     603                $due_control->set_value( $config->dashboard_cases->case_review_date );
     604                $assigned_control->set_value( $config->dashboard_cases->case_assigned );
     605                $status_control->set_value( $config->dashboard_cases->case_status );
     606            }       
    573607            return  $assigned_control->form_control() . $status_control->form_control() . $due_control->form_control();
    574608        } elseif ( 'dashboard_issues'  == $dashboard_div ) {
     
    581615            $status_control->initialize_default_values( 'dashboard', 'follow_up_status', 'follow_up_status' );
    582616            $status_control->set_value ( 'open' );
     617            if ( isset ( $config->dashboard_issues ) ) {
     618                $due_control->set_value( $config->dashboard_issues->review_date );
     619                $assigned_control->set_value( $config->dashboard_issues->issue_staff );
     620                $status_control->set_value( $config->dashboard_issues->follow_up_status );
     621            }
    583622            return  $assigned_control->form_control() . $status_control->form_control() . $due_control->form_control();
    584623        } else {
     
    591630    public static function dashboard_activity ( $dummy_id, $data ) {
    592631
    593         extract ( (array) $data );
     632        self::save_dashboard_preferences ( $dummy_id, $data );
     633
     634        extract ( (array) $data->dashboard_activity );
    594635        $start = $start ? $start : '1900-01-01';
    595636        $end = $end ? $end : '2100-01-01';
     
    642683    public static function dashboard_activity_type ( $dummy_id, $data ) {
    643684
    644         extract ( (array) $data );
     685        self::save_dashboard_preferences ( $dummy_id, $data );
     686
     687        extract ( (array) $data->dashboard_activity_type );
    645688        $start = $start ? $start : '1900-01-01';
    646689        $end = $end ? $end : '2100-01-01';
  • wp-issues-crm/tags/4.5.3/readme.txt

    r2152009 r2157599  
    55Requires at least: 5
    66Tested up to: 5.2.1
    7 Stable tag: 4.5.2
     7Stable tag: 4.5.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    108108
    109109== Changelog ==
     110= 4.5.3 =
     111* Save state of dashboard to facilitate iterative select from dashboard and return to dashboard
    110112= 4.5.2 =
    111113* Revise security rules for template and issue creation from email -- allow to those with view_edit_unassigned
  • wp-issues-crm/tags/4.5.3/wp-issues-crm.php

    r2152009 r2157599  
    44 * Plugin URI: http://wp-issues-crm.com
    55 * Description: Constituent Relationship Management for organizations that respond to constituents.  Organizes constituent contacts ( calls, etc. ) around Wordpress posts and categories.
    6  * Version: 4.5.2
     6 * Version: 4.5.3
    77 * Author: Will Brownsberger
    88 * Author URI: http://willbrownsberger.com
     
    3939// set database version global;
    4040global $wp_issues_crm_db_version;
    41 $wp_issues_crm_db_version = '4.5.2';
     41$wp_issues_crm_db_version = '4.5.3';
    4242/*
    4343* set js_css version global -- three possibilities:
     
    4848*/
    4949global $wp_issues_crm_js_css_version;
    50 $wp_issues_crm_js_css_version = '4.5.2'; // may or not be set at release time
     50$wp_issues_crm_js_css_version = '4.5.3'; // may or not be set at release time
    5151if ( '' == $wp_issues_crm_js_css_version ) {
    5252    if ( strpos ( site_url(), 'localhost' ) > 0 ) {
  • wp-issues-crm/trunk/css/dashboard.css

    r2152005 r2157599  
    164164}
    165165
    166 /* maintain always open flexible height for dashboard summary */
    167 .wic-dashboard-flex .wic-inner-dashboard,
    168 .wic-dashboard-flex.wic-dashboard-tall .wic-inner-dashboard {
    169     height: auto;
    170     margin-bottom: 30px;
    171     max-height: calc( 100vh - 540px) ;
    172 }
    173 .wic-dashboard-flex .wic-inner-dashboard ul.wic-post-list,
    174 .wic-dashboard-flex.wic-dashboard-tall .wic-inner-dashboard ul.wic-post-list {
    175     height: auto ;
    176     max-height: calc( 100vh - 540px) ;
    177 }
    178 
    179 
    180166.dashboard-not-found {
    181167    margin: 20px;
  • wp-issues-crm/trunk/js/ajax.js

    r2069459 r2157599  
    8787    }
    8888
     89    // note: this function invoked directly on loadDashboardPanel in dashboard.js
    8990     wpIssuesCRM.saveState = function ( currentEntity, currentAction ) {
    9091        var valuesObject = {};
  • wp-issues-crm/trunk/js/dashboard.js

    r2145245 r2157599  
    4444             defaultDate: +0
    4545        });
    46         $( "#dashboard\\[end\\]\\[date_range\\]" ).datepicker( "setDate", "+0" )
    47         $( "#dashboard\\[start\\]\\[date_range\\]" ).datepicker( "setDate", "-30" )
    48         $( "#dashboard\\[end_t\\]\\[date_range\\]" ).datepicker( "setDate", "+0" )
    49         $( "#dashboard\\[start_t\\]\\[date_range\\]" ).datepicker( "setDate", "-30" )
     46        $( "#dashboard\\[end\\]\\[date_range\\]" ).attr( "placeholder", "Before?" )
     47        $( "#dashboard\\[start\\]\\[date_range\\]" ).attr( "placeholder", "After?" )
     48        $( "#dashboard\\[end_t\\]\\[date_range\\]" ).attr( "placeholder", "Before?" )
     49        $( "#dashboard\\[start_t\\]\\[date_range\\]" ).attr( "placeholder", "After?" )
    5050        $( "#dashboard\\[case_review_date\\]\\[date_range\\]" ).attr( "placeholder", "Due before?" )
    5151        $( "#dashboard\\[review_date\\]\\[date_range\\]" ).attr( "placeholder", "Due before?" )
    5252
    53 
    54         $( ".wic-dashboard" ).each( function () {
     53        // only open what has been set as tall
     54        $( ".wic-dashboard.wic-dashboard-tall" ).each( function () {
    5555            wpIssuesCRM.loadDashboardPanel ( $( this ).attr("id") );
    5656        });
     
    6161            if ( currentTile.hasClass("wic-dashboard-tall") ) {
    6262                 currentTile.removeClass( "wic-dashboard-tall" );
     63                 wpIssuesCRM.saveDashboardLayout();
    6364            } else {
    6465                $( ".wic-dashboard").removeClass ( "wic-dashboard-tall" );
    6566                currentTile.addClass ( "wic-dashboard-tall" );
     67                wpIssuesCRM.loadDashboardPanel ( currentTile.attr("id") );
    6668            }
    67             wpIssuesCRM.saveDashboardLayout();
    6869        });
    6970
     
    7475                $( ".wic-dashboard").removeClass ( "wic-dashboard-tall" );
    7576                currentTile.addClass ( "wic-dashboard-tall" );
    76                 wpIssuesCRM.saveDashboardLayout();
     77                wpIssuesCRM.loadDashboardPanel ( currentTile.attr("id") );
     78                // dashboard layout will be saved on load
    7779            }
    7880        });
     
    8486                $( ".wic-dashboard").removeClass ( "wic-dashboard-tall" );
    8587                currentTile.addClass ( "wic-dashboard-tall" );
    86                 wpIssuesCRM.saveDashboardLayout();
     88                wpIssuesCRM.loadDashboardPanel ( currentTile.attr("id") );
     89                // dashboard layout will be saved on load
    8790            }
    8891        });
     
    106109    }
    107110
     111    // includes same action as saveDashboardLayout on server side
    108112    wpIssuesCRM.loadDashboardPanel = function ( panel ) {
    109         var varPreID;
    110         var submittedData = '';
    111         if ( 'dashboard_activity' == panel ) {
    112             var includedTypes=[];
    113             $( "#filter-activities-menu .wic-input-checked" ).each ( function () {
    114                 if ( $( this ).prop("checked") ) {
    115                     varPreID =  $(this).attr("id").substr(14);
    116                     includedTypes.push ( varPreID.substr(0, varPreID.length -1 ) );
    117                 }
    118             });
    119             submittedData = {
    120                 start:      $( "#dashboard\\[start\\]\\[date_range\\]" ).val(),
    121                 end:        $( "#dashboard\\[end\\]\\[date_range\\]" ).val(),
    122                 included:   includedTypes
    123             }
    124         } else if ( 'dashboard_activity_type' == panel ) {
    125             submittedData = {
    126                 start:      $( "#dashboard\\[start_t\\]\\[date_range\\]" ).val(),
    127                 end:        $( "#dashboard\\[end_t\\]\\[date_range\\]" ).val(),
    128             }       
    129         } else if ( 'dashboard_cases' == panel ) {
    130             submittedData = {
    131                 case_assigned:      $( "#dashboard\\[case_assigned\\]\\[case_assigned\\]" ).val(),
    132                 case_review_date:   $( "#dashboard\\[case_review_date\\]\\[date_range\\]" ).val(),
    133                 case_status:        $( "#dashboard\\[case_status\\]\\[case_status\\]" ).val(),
    134             }           
    135         } else if ( 'dashboard_issues' == panel ) {
    136             submittedData = {
    137                 issue_staff:        $( "#dashboard\\[issue_staff\\]\\[issue_staff\\]" ).val(),
    138                 review_date:        $( "#dashboard\\[review_date\\]\\[date_range\\]" ).val(),
    139                 follow_up_status:   $( "#dashboard\\[follow_up_status\\]\\[follow_up_status\\]" ).val(),
    140             }               
    141         }
     113        wpIssuesCRM.ajaxPost(  'dashboard', panel, '', assembleDashboardStatus(), function( response ) {
     114            $( "#" + panel ).children( ".wic-inner-dashboard").html( response );
    142115
    143         wpIssuesCRM.ajaxPost(  'dashboard', panel, '', submittedData, function( response ) {
    144             $( "#" + panel ).children( ".wic-inner-dashboard").html( response );
    145116            // special initialization terms for particular panels
    146117            if ( 'dashboard_searches' == panel ) {
    147118                wpIssuesCRM.initializeSearchLogTooltips();
    148119            }
     120
     121            // save state to allow return to same panel
     122            wpIssuesCRM.saveState ( 'dashboard', 'dashboard' );
    149123           
    150124        });
     
    152126
    153127    wpIssuesCRM.saveDashboardLayout = function ()  {
    154         var varWide = [];
     128        wpIssuesCRM.ajaxPost(  'dashboard', 'save_dashboard_preferences', '', assembleDashboardStatus() ,  function( response ) {
     129        });
     130    }
     131
     132    assembleDashboardStatus = function() {
     133   
     134        // set open item
    155135        var varTall = [];
    156136            $( '.wic-dashboard-tall' ).each ( function () {
    157137            varTall.push ( $( this ).attr("id") );
    158138        });
     139       
     140        // set sort order
     141        var varSort =  $( "#dashboard-sortables" ).sortable( "toArray");
     142       
     143        // set activity vars
     144        var varPreID;
     145        var includedTypes=[];
     146        $( "#filter-activities-menu .wic-input-checked" ).each ( function () {
     147            if ( $( this ).prop("checked") ) {
     148                varPreID =  $(this).attr("id").substr(14);
     149                includedTypes.push ( varPreID.substr(0, varPreID.length -1 ) );
     150            }
     151        });
     152        var activityVars = {
     153            start:      $( "#dashboard\\[start\\]\\[date_range\\]" ).val(),
     154            end:        $( "#dashboard\\[end\\]\\[date_range\\]" ).val(),
     155            included:   includedTypes
     156        }       
     157       
     158        // set activity_type vars
     159        var activityTypeVars = {
     160            start:      $( "#dashboard\\[start_t\\]\\[date_range\\]" ).val(),
     161            end:        $( "#dashboard\\[end_t\\]\\[date_range\\]" ).val(),
     162        }
     163       
     164        // set cases vars
     165        var casesVars = {
     166            case_assigned:      $( "#dashboard\\[case_assigned\\]\\[case_assigned\\]" ).val(),
     167            case_review_date:   $( "#dashboard\\[case_review_date\\]\\[date_range\\]" ).val(),
     168            case_status:        $( "#dashboard\\[case_status\\]\\[case_status\\]" ).val(),
     169        }       
     170       
     171        // set issues vars
     172        var issuesVars = {
     173            issue_staff:        $( "#dashboard\\[issue_staff\\]\\[issue_staff\\]" ).val(),
     174            review_date:        $( "#dashboard\\[review_date\\]\\[date_range\\]" ).val(),
     175            follow_up_status:   $( "#dashboard\\[follow_up_status\\]\\[follow_up_status\\]" ).val(),
     176        }   
     177       
    159178        var dashboardConfig = {
    160             sort: $( "#dashboard-sortables" ).sortable( "toArray"),
    161             wide: varWide,
    162             tall: varTall
    163         }
    164         wpIssuesCRM.ajaxPost(  'dashboard', 'save_dashboard_preferences', '', dashboardConfig ,  function( response ) {
    165         });
     179            sort: varSort,
     180            tall: varTall,
     181            dashboard_activity: activityVars,
     182            dashboard_activity_type: activityTypeVars,
     183            dashboard_cases: casesVars,
     184            dashboard_issues: issuesVars
     185        }   
     186
     187        return dashboardConfig;
     188       
    166189    }
    167190
     191
    168192}( window.wpIssuesCRM = window.wpIssuesCRM || {}, jQuery )); // end anonymous namespace enclosure   
  • wp-issues-crm/trunk/php/entity/class-wic-entity-dashboard.php

    r2152005 r2157599  
    1919    protected function dashboard () {
    2020
    21         // get sort order and wide display list
     21        // get sort order and what is open
    2222        $config = WIC_Entity_User::get_wic_user_preference ( 'wic_dashboard_config' );
    2323        if ( $config ) {
     
    6060        }
    6161        ksort ( $sorted_dashboard_divs );
     62        // identify which entity to start as open
     63        $open_div = isset ( $config->tall ) ? $config->tall[0] : 'dashboard_overview';
    6264        echo '<ul id="dashboard-sortables" >';
    6365        foreach ( $sorted_dashboard_divs as $key => $dashboard_div ) {
    64             $wide_class = ' wic-dashboard-full ';
    65             $tall_class = in_array( $dashboard_div[0], array ( 'dashboard_overview' ) ) ? ' wic-dashboard-flex ' : ''; // no longer controlled by user
     66            $tall_class = $open_div == $dashboard_div[0] ? ' wic-dashboard-tall ' : ''; // no longer controlled by user
    6667            echo
    67                 '<li id = "' . $dashboard_div[0] . '" class = "ui-state-default wic-dashboard ' . $wide_class . $tall_class . '">' .
     68                '<li id = "' . $dashboard_div[0] . '" class = "ui-state-default wic-dashboard  wic-dashboard-full  ' . $tall_class . '">' .
    6869                    '<div class="wic-dashboard-title wic-dashboard-drag-handle" title="Drag to reorder dashboard widgets"><span class="dashicons dashicons-move"></span>' . $dashboard_div[1] . '</div>' .
    69                     $this->special_buttons ( $dashboard_div[0] ) .
     70                    $this->special_buttons ( $dashboard_div[0], $config ) .
    7071                    '<button class="wic-dashboard-title wic-dashboard-refresh-button" type="button" title="Refresh"><span class="dashicons dashicons-update"></span></button>' .
    7172                    '<div class = "wic-inner-dashboard" id="wic-inner-dashboard-' . $dashboard_div[0] . '">' .
     
    7980
    8081
    81     public static function save_dashboard_preferences ( $dummy_id, $data ) {
     82    public static function save_dashboard_preferences ( $dummy_id, $data ) { 
    8283        return WIC_Entity_User::set_wic_user_preference ( 'wic_dashboard_config', $data );
    8384    }
    8485
    85     public static function dashboard_overview ( $dummy_id, $dummy_data ) {
     86    public static function dashboard_overview ( $dummy_id, $data ) {
     87   
     88        self::save_dashboard_preferences ( $dummy_id, $data );
    8689   
    8790        global $wpdb;
     
    213216   
    214217    // display a list of CASES assigned to user --  (SEE ONLY OWN, NO OPTIONS) 
    215     public static function dashboard_mycases( ) {
    216        
     218    public static function dashboard_mycases( $dummy_id, $data ) {
     219
     220        self::save_dashboard_preferences ( $dummy_id, $data );
     221
    217222        $user_ID = get_current_user_id();   
    218223       
     
    256261       
    257262    // display a list of issues assigned to user --  (SEE ONLY OWN, NO OPTIONS)
    258     public static function dashboard_myissues() {
     263    public static function dashboard_myissues( $dummy_id, $data ) {
     264   
     265        self::save_dashboard_preferences ( $dummy_id, $data );
    259266       
    260267        $user_ID = get_current_user_id();   
     
    299306
    300307    // display a list of assigned cases -- default is to current user
    301     public static function dashboard_cases( $dummy, $data) {
    302    
    303         extract ( (array) $data ); // case_assigned/case_review_date/case_status
     308    public static function dashboard_cases( $dummy_id, $data) {
     309   
     310        self::save_dashboard_preferences ( $dummy_id, $data );
     311   
     312        extract ( (array) $data->dashboard_cases ); // case_assigned/case_review_date/case_status
    304313
    305314        $wic_query = WIC_DB_Access_Factory::make_a_db_access_object( 'constituent' );
     
    369378       
    370379    // display a list of assigned issues -- default is to current user 
    371     public static function dashboard_issues( $dummy, $data ) {
    372    
    373         extract ( (array) $data ); // issue_staff/review_date/follow_up_status:     
     380    public static function dashboard_issues( $dummy_id, $data ) {
     381   
     382        self::save_dashboard_preferences ( $dummy_id, $data );
     383   
     384        extract ( (array) $data->dashboard_issues ); // issue_staff/review_date/follow_up_status:       
    374385        $wic_query = WIC_DB_Access_Factory::make_a_db_access_object( 'issue' );
    375386
     
    485496
    486497
    487     public static function dashboard_recent() {
     498    public static function dashboard_recent( $dummy_id, $data ) {
     499   
     500        self::save_dashboard_preferences ( $dummy_id, $data );
    488501   
    489502        $user_ID = get_current_user_id();   
     
    508521
    509522    // display user's search log ( which includes form searches, items selected from lists and also items saved )
    510     public static function dashboard_searches() {
     523    public static function dashboard_searches(  $dummy_id, $data ) {
     524   
     525        self::save_dashboard_preferences ( $dummy_id, $data );
    511526   
    512527        $wic_query = WIC_DB_Access_Factory::make_a_db_access_object( 'search_log' );
     
    523538    }
    524539
    525     public static function dashboard_uploads () {
     540    public static function dashboard_uploads (  $dummy_id, $data ) {
     541   
     542        self::save_dashboard_preferences ( $dummy_id, $data );
     543   
    526544        // table entry in the access factory will make this a standard WIC DB object
    527545        $wic_query =    WIC_DB_Access_Factory::make_a_db_access_object( 'upload' );
     
    549567    }
    550568   
    551     private function special_buttons ( $dashboard_div ) {
     569   
     570   
     571    private function special_buttons ( $dashboard_div, $config ) {
     572       
    552573        if ( 'dashboard_activity'  == $dashboard_div ) {
    553574            $start_control = WIC_Control_Factory::make_a_control ( 'date' );
     
    555576            $end_control = WIC_Control_Factory::make_a_control ( 'date' );
    556577            $end_control->initialize_default_values( 'dashboard', 'date_range', 'end' );
     578            if ( isset ( $config->dashboard_activity ) ) {
     579                $start_control->set_value( $config->dashboard_activity->start );
     580                $end_control->set_value( $config->dashboard_activity->end );
     581            }
    557582            return  $start_control->form_control() . $end_control->form_control() . WIC_Entity_Activity::make_activity_type_filter_button();
    558583        } elseif ( 'dashboard_activity_type'  == $dashboard_div ) {
     
    561586            $end_control = WIC_Control_Factory::make_a_control ( 'date' );
    562587            $end_control->initialize_default_values( 'dashboard', 'date_range', 'end_t' );
     588            if ( isset ( $config->dashboard_activity_type ) ) {
     589                $start_control->set_value( $config->dashboard_activity_type->start );
     590                $end_control->set_value( $config->dashboard_activity_type->end );
     591            }
    563592            return $start_control->form_control() . $end_control->form_control();
    564593        } elseif ( 'dashboard_cases'  == $dashboard_div ) {
     
    571600            $status_control->initialize_default_values( 'dashboard', 'case_status', 'case_status' );
    572601            $status_control->set_value ( '1' );
     602            if ( isset ( $config->dashboard_cases ) ) {
     603                $due_control->set_value( $config->dashboard_cases->case_review_date );
     604                $assigned_control->set_value( $config->dashboard_cases->case_assigned );
     605                $status_control->set_value( $config->dashboard_cases->case_status );
     606            }       
    573607            return  $assigned_control->form_control() . $status_control->form_control() . $due_control->form_control();
    574608        } elseif ( 'dashboard_issues'  == $dashboard_div ) {
     
    581615            $status_control->initialize_default_values( 'dashboard', 'follow_up_status', 'follow_up_status' );
    582616            $status_control->set_value ( 'open' );
     617            if ( isset ( $config->dashboard_issues ) ) {
     618                $due_control->set_value( $config->dashboard_issues->review_date );
     619                $assigned_control->set_value( $config->dashboard_issues->issue_staff );
     620                $status_control->set_value( $config->dashboard_issues->follow_up_status );
     621            }
    583622            return  $assigned_control->form_control() . $status_control->form_control() . $due_control->form_control();
    584623        } else {
     
    591630    public static function dashboard_activity ( $dummy_id, $data ) {
    592631
    593         extract ( (array) $data );
     632        self::save_dashboard_preferences ( $dummy_id, $data );
     633
     634        extract ( (array) $data->dashboard_activity );
    594635        $start = $start ? $start : '1900-01-01';
    595636        $end = $end ? $end : '2100-01-01';
     
    642683    public static function dashboard_activity_type ( $dummy_id, $data ) {
    643684
    644         extract ( (array) $data );
     685        self::save_dashboard_preferences ( $dummy_id, $data );
     686
     687        extract ( (array) $data->dashboard_activity_type );
    645688        $start = $start ? $start : '1900-01-01';
    646689        $end = $end ? $end : '2100-01-01';
  • wp-issues-crm/trunk/readme.txt

    r2152009 r2157599  
    55Requires at least: 5
    66Tested up to: 5.2.1
    7 Stable tag: 4.5.2
     7Stable tag: 4.5.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    108108
    109109== Changelog ==
     110= 4.5.3 =
     111* Save state of dashboard to facilitate iterative select from dashboard and return to dashboard
    110112= 4.5.2 =
    111113* Revise security rules for template and issue creation from email -- allow to those with view_edit_unassigned
  • wp-issues-crm/trunk/wp-issues-crm.php

    r2152009 r2157599  
    44 * Plugin URI: http://wp-issues-crm.com
    55 * Description: Constituent Relationship Management for organizations that respond to constituents.  Organizes constituent contacts ( calls, etc. ) around Wordpress posts and categories.
    6  * Version: 4.5.2
     6 * Version: 4.5.3
    77 * Author: Will Brownsberger
    88 * Author URI: http://willbrownsberger.com
     
    3939// set database version global;
    4040global $wp_issues_crm_db_version;
    41 $wp_issues_crm_db_version = '4.5.2';
     41$wp_issues_crm_db_version = '4.5.3';
    4242/*
    4343* set js_css version global -- three possibilities:
     
    4848*/
    4949global $wp_issues_crm_js_css_version;
    50 $wp_issues_crm_js_css_version = '4.5.2'; // may or not be set at release time
     50$wp_issues_crm_js_css_version = '4.5.3'; // may or not be set at release time
    5151if ( '' == $wp_issues_crm_js_css_version ) {
    5252    if ( strpos ( site_url(), 'localhost' ) > 0 ) {
Note: See TracChangeset for help on using the changeset viewer.