Changeset 2149004
- Timestamp:
- 08/31/2019 05:29:28 PM (7 years ago)
- Location:
- wp-issues-crm/trunk
- Files:
-
- 12 edited
-
js/email-deliver.js (modified) (3 diffs)
-
js/email-inbox.js (modified) (1 diff)
-
js/email-message.js (modified) (1 diff)
-
js/email-settings.js (modified) (2 diffs)
-
php/admin/class-wic-admin-access.php (modified) (2 diffs)
-
php/admin/class-wic-admin-settings.php (modified) (3 diffs)
-
php/admin/class-wic-admin-setup.php (modified) (1 diff)
-
php/entity/class-wic-entity-email-deliver-activesync.php (modified) (1 diff)
-
php/entity/class-wic-entity-email-deliver.php (modified) (2 diffs)
-
php/entity/class-wic-entity-email-inbox.php (modified) (5 diffs)
-
sql/wic_data_dictionary_and_field_groups.sql (modified) (2 diffs)
-
wp-issues-crm.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-issues-crm/trunk/js/email-deliver.js
r2008825 r2149004 11 11 wpIssuesCRM.loadOutboxListeners = function() { 12 12 // bind listener for queue hold button (already loaded ); 13 $( "#control-process-email-button" ).on ( "click", function() { 14 var newMailerStatus = $( this ).hasClass ( "mailer_held" ) ; // if held, new status is true, mailer_ok13 $( "#control-process-email-button" ).on ( "click", function() { 14 var newMailerStatus = $( this ).hasClass ( "mailer_held" ) ? 1 : 0; // if held, new status is true, mailer_ok 15 15 wpIssuesCRM.ajaxPost( 'email_deliver', 'set_mailer_status', 0, newMailerStatus, function( response ) { 16 if ( true === response) {16 if ( response > 0 ) { 17 17 $ ( "#control-process-email-button" ).removeClass ( "mailer_held" ).addClass( "mailer_ok" ); 18 18 } else { … … 38 38 wpIssuesCRM.getMailerStatus = function () { 39 39 wpIssuesCRM.ajaxPost( 'email_deliver', 'get_mailer_status', 0, '', function( response ) { 40 if ( response ) {40 if ( response > 0 ) { 41 41 $( "#control-process-email-button").removeClass ( "mailer_held" ).addClass( "mailer_ok" ); 42 42 } else { … … 53 53 if ( controlProcessEmailButton.hasClass ("mailer_ok" ) ) { 54 54 controlProcessEmailButton.text("Suspend Mailer").attr("title", "Immediately interrupt and hold mailer."); 55 } else { 55 } else { 56 56 controlProcessEmailButton.text("Release Mailer").attr("title", "Release mailer to run when next scheduled."); 57 57 } -
wp-issues-crm/trunk/js/email-inbox.js
r2147379 r2149004 238 238 239 239 // enable or disable assignment selection button 240 if ( !( ['CATEGORY_ASSIGNED', 'CATEGORY_READY'].indexOf(inboxParms.tab) > -1 ) || !wpIssuesCRMSettings.can SendEmail ){240 if ( !( ['CATEGORY_ASSIGNED', 'CATEGORY_READY'].indexOf(inboxParms.tab) > -1 ) || !wpIssuesCRMSettings.canViewAllEmail ){ 241 241 $( '#wic-filter-assigned-button' ).prop( 'disabled',true ).addClass('ui-state-disabled'); 242 242 } else { -
wp-issues-crm/trunk/js/email-message.js
r2147379 r2149004 912 912 } 913 913 // enable/disable staff reassignment button based on user capability and message count; is enabled in all tabs 914 if ( ! wpIssuesCRMSettings.can SendEmail || wpIssuesCRM.currentMessageVars.countMessages > 1 ){914 if ( ! wpIssuesCRMSettings.canViewAllEmail || wpIssuesCRM.currentMessageVars.countMessages > 1 ){ 915 915 $( '#assigned-case-popup-button' ).prop( 'disabled',true ).addClass('ui-state-disabled').attr("title","Cannot assign/reassign."); 916 916 } else { -
wp-issues-crm/trunk/js/email-settings.js
r2096077 r2149004 173 173 */ 174 174 function sanitizePipeSeparated ( element ) { 175 var pipeSeparated = [ 'streets', 'states', 'apartments', 'special_streets', 'post_titles', 'pre_titles', 'disqualifiers', 'imc_qualifiers', 'closings', 'non_names' ];175 var pipeSeparated = [ 'streets', 'states', 'apartments', 'special_streets', 'post_titles', 'pre_titles', 'disqualifiers', 'imc_qualifiers', 'closings', 'non_names', 'team_list' ]; 176 176 elementObject = $ ( element ) 177 177 if ( pipeSeparated.indexOf ( elementObject.attr( "id") ) > -1 ) { 178 178 var uncleanString = elementObject.val(); 179 var cleanString = uncleanString.replace (new RegExp (/[^|A-Za-z0-9 -]/, 'g' ), '' ); 179 var cleanString = 'team_list' == elementObject.attr( "id") ? 180 uncleanString.replace (new RegExp ( /[^|%@.+_A-Za-z0-9-]/, 'g' ), '' ): 181 uncleanString.replace (new RegExp ( /[^|A-Za-z0-9 -]/, 'g' ), '' ); 180 182 var termsArray = cleanString.split ( '|' ); 181 183 var trimmedArray = []; … … 193 195 194 196 197 198 195 199 }( window.wpIssuesCRM = window.wpIssuesCRM || {}, jQuery )); // end namespace enclosure -
wp-issues-crm/trunk/php/admin/class-wic-admin-access.php
r2147428 r2149004 99 99 'email_attachment' => 'email', 100 100 'email_block' => 'email', 101 'email_compose' => ' email',101 'email_compose' => 'send_email', 102 102 'email_connect' => 'email', 103 103 // 'email_cron' secured with cron key … … 133 133 //'email_oauth_synch' not taking ajax calls, 134 134 //'email_oauth_update' not taking ajax calls, 135 'email_process' => ' email',136 'email_send' => ' email', // note: that list_send capability is checked within the send function135 'email_process' => 'send_email', 136 'email_send' => 'send_email', // note: that list_send capability is checked within the send function 137 137 'email_settings' => 'email', 138 138 'email_subject' => array( -
wp-issues-crm/trunk/php/admin/class-wic-admin-settings.php
r2146005 r2149004 86 86 add_settings_field( 87 87 'access_level_required_email', // field id 88 'Access all email', // field label 89 array( $this, 'access_level_required_email_callback' ), // field call back 90 'wp_issues_crm_settings_page', // page 91 'security_settings' // settings section within page 92 ); 93 94 add_settings_field( 95 'access_level_required_send_email', // field id 88 96 'Send email', // field label 89 array( $this, 'access_level_required_ email_callback' ), // field call back97 array( $this, 'access_level_required_send_email_callback' ), // field call back 90 98 'wp_issues_crm_settings_page', // page 91 99 'security_settings' // settings section within page … … 755 763 } 756 764 765 // setting field call back 766 public function access_level_required_send_email_callback() { 767 global $wic_db_dictionary; 768 $option_array = $wic_db_dictionary->lookup_option_values( 'capability_levels' ); 769 770 $value = isset ( $this->plugin_options['access_level_required_send_email'] ) ? $this->plugin_options['access_level_required_send_email'] : 'edit_theme_options'; 771 772 $args = array ( 773 'field_label' => '', 774 'option_array' => $option_array, 775 'input_class' => '', 776 'field_slug_css' => '', 777 'hidden' => '', 778 'field_slug' => 'wp_issues_crm_plugin_options_array[access_level_required_send_email]', 779 'value' => $value , 780 ); 781 echo WIC_Control_Select::create_control( $args ); 782 } 783 757 784 758 785 // setting field call back … … 1498 1525 if( isset( $input['access_level_required_email'] ) ) { 1499 1526 $new_input['access_level_required_email'] = sanitize_text_field( $input['access_level_required_email'] ); 1500 } 1527 } 1528 if( isset( $input['access_level_required_send_email'] ) ) { 1529 $new_input['access_level_required_send_email'] = sanitize_text_field( $input['access_level_required_send_email'] ); 1530 } 1501 1531 if( isset( $input['access_level_required_list_send'] ) ) { 1502 1532 $new_input['access_level_required_list_send'] = sanitize_text_field( $input['access_level_required_list_send'] ); -
wp-issues-crm/trunk/php/admin/class-wic-admin-setup.php
r2145245 r2149004 286 286 'maxFileSize' => WIC_Entity_Upload_Upload::get_safe_file_size(), 287 287 'dearToken' => WIC_Entity_Email_Send::dear_token, 288 'canSendEmail' => current_user_can (WIC_Admin_Access::check_required_capability ('email')), 288 'canViewAllEmail' => current_user_can (WIC_Admin_Access::check_required_capability ('email')), 289 'canSendEmail' => current_user_can (WIC_Admin_Access::check_required_capability ('send_email')), 289 290 'canViewOthersAssigned' => current_user_can (WIC_Admin_Access::check_required_capability ('view_edit_unassigned')), 290 291 ) -
wp-issues-crm/trunk/php/entity/class-wic-entity-email-deliver-activesync.php
r2019577 r2149004 108 108 $current_id = $outbox_message->ID; 109 109 // test to see if OK to continue running 110 if ( ! get_option ( 'wp-issues-crm-mailer-ok-to-go', true ) ) { 110 // in php string 0 is false https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting 111 if ( ! get_option ( 'wp-issues-crm-mailer-ok-to-go', 1 ) ) { 111 112 WIC_Entity_Email_Cron::log_mail ( 'Ending WIC_Entity_Email_Deliver_Activesync::process_message_queue -- mailer suspended.'); 112 113 return true; // don't retry -
wp-issues-crm/trunk/php/entity/class-wic-entity-email-deliver.php
r2043247 r2149004 210 210 */ 211 211 public static function get_mailer_status( $dummy1, $dummy2 ) { 212 return array ( 'response_code' => true, 'output' => get_option ( 'wp-issues-crm-mailer-ok-to-go', true) ); // start with mailer released if have not set option212 return array ( 'response_code' => true, 'output' => get_option ( 'wp-issues-crm-mailer-ok-to-go', 1 ) ); // start with mailer released if have not set option 213 213 } 214 214 215 215 public static function set_mailer_status( $dummy, $new_status ) { 216 update_option ( 'wp-issues-crm-mailer-ok-to-go', $new_status ); 217 return array ( 'response_code' => true, 'output' => $new_status ); 216 // use 1/0 -- note that in update_option if value = false and no option https://core.trac.wordpress.org/ticket/40007 217 update_option ( 'wp-issues-crm-mailer-ok-to-go', $new_status ? 1 : 0 ); 218 return self::get_mailer_status( '', '' ); // return truth, not theory, about value! 218 219 } 219 220 … … 286 287 $current_id = $outbox_message->ID; 287 288 // test to see if OK to continue running 288 if ( ! get_option ( 'wp-issues-crm-mailer-ok-to-go', true ) ) { 289 // in php string 0 is false https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting 290 if ( ! get_option ( 'wp-issues-crm-mailer-ok-to-go', 1 ) ) { 289 291 WIC_Entity_Email_Cron::log_mail ( 'Ending WIC_Entity_Email_Deliver::process_message_queue -- mailer suspended.'); 290 292 $mail->smtpClose(); -
wp-issues-crm/trunk/php/entity/class-wic-entity-email-inbox.php
r2147085 r2149004 78 78 $word_minimum_threshold = isset ( $form_variables_object->word_minimum_threshold ) ? $form_variables_object->word_minimum_threshold : 200; 79 79 $mapped_threshold = isset ( $form_variables_object->mapped_threshold ) ? $form_variables_object->mapped_threshold : 85; 80 // get pipe seperated list of team from emails 81 $team_list = isset ( $form_variables_object->team_list ) ? $form_variables_object->team_list : ''; 82 $team_list_array = $team_list ? explode ( '|', $team_list ): array(); 80 83 // get current folder 81 84 $folder = WIC_Entity_Email_Account::get_folder(); … … 147 150 148 151 /* 149 * add tab selection terms -- CATEGORY_ADVOCACY, CATEGORY_ASSIGNED, CATEGORY_READY special, dynamically applied 152 * 153 * this is a hook to allow substitution of category definitions without reparsing the inbox 154 * 155 * the following is an example that could be placed in a local plugin -- always include leading and trailing white spaces around the defined term 156 define ('WP_ISSUES_CRM_LOCAL_CATEGORY_REWRITE', " 157 IF( category = 'CATEGORY_PROMOTIONS', 158 'CATEGORY_PERSONAL', 159 IF( 160 category = 'CATEGORY_FORUMS', 161 'CATEGORY_SOCIAL', 162 category 163 ) 164 ) 165 "); 166 */ 167 $category_phrase = defined ( 'WP_ISSUES_CRM_LOCAL_CATEGORY_REWRITE' ) ? WP_ISSUES_CRM_LOCAL_CATEGORY_REWRITE : ' category '; 168 /* 169 * add tab selection terms -- CATEGORY_TEAM, CATEGORY_ADVOCACY, CATEGORY_ASSIGNED, CATEGORY_READY special, dynamically applied 150 170 * 151 171 * assigned_subject is the subject from $assigned_subject_join subselection query below … … 160 180 * if ! $user_can_see_all, just choosing between two allowed tabs -- 161 181 * CATEGORY_ASSIGNED or if a response has been drafted in CATEGORY_READY 182 * 183 * CATEGORY_TEAM is an overriding category -- it doesn't matter what the underlying category is; if from team, in team tab and not elsewhere 184 * EXCEPT that subject being assigned overrides email being team 162 185 */ 186 $team_list_criterion = ''; 187 if ( $team_list_array ) { 188 $team_list_criterion = '( '; 189 foreach ( $team_list_array as $email_criterion ) { 190 // cannot use wpdb prepare -- % gets replaced with hash; so hard resanitize the $email_criterion directly 191 // ?? https://stackoverflow.com/questions/53831586/using-like-statement-with-wpdb-prepare-showing-hashes-where-wildcard-character 192 $email_criterion_resanitized = preg_replace ( '/[^%@.+_A-Za-z0-9-]/', '', $email_criterion ); 193 $team_list_criterion .= " from_email LIKE '$email_criterion_resanitized' OR "; 194 } 195 $team_list_criterion .= " $category_phrase = 'CATEGORY_TEAM' OR 1 = 0 )"; // (short) legacy of built in category_team 196 } 197 163 198 $category_where = $user_can_see_all ? 199 ( 200 'CATEGORY_TEAM' == $data->tab ? " $team_list_criterion AND assigned_subject is null AND " : 164 201 $wpdb->prepare ( 165 202 " IF( 166 203 assigned_subject is NULL, 167 IF( mapped_issue > 0, 'CATEGORY_ADVOCACY', category),204 IF( mapped_issue > 0, 'CATEGORY_ADVOCACY', $category_phrase ), 168 205 IF( subject_is_final, 'CATEGORY_READY', 'CATEGORY_ASSIGNED' ) 169 ) = %s AND ",206 ) = %s AND ( NOT $team_list_criterion OR assigned_subject IS NOT NULL ) AND ", 170 207 array ( $data->tab ) 171 ) : 208 ) 209 ) 210 : 211 // note that if ! $user_can_see_all, $absolute_user_where_limit also applies, limiting displayed messages to assigned 172 212 $wpdb->prepare ( 173 213 " IF( inbox_defined_reply_is_final , 'CATEGORY_READY', 'CATEGORY_ASSIGNED' ) = %s AND ", … … 235 275 * if ! $user_can_see all, only seeing ready and assigned tabs and only for current user is inbox_defined_staff, only first two cases apply 236 276 */ 237 $tabs_array = WIC_Entity_Email_Account::get_tabs(); 277 $tabs_array = WIC_Entity_Email_Account::get_tabs(); 238 278 $tabs_summary_sql = ''; 239 foreach ( $tabs_array as $tab ) { 279 foreach ( $tabs_array as $tab ) { 240 280 $category = 'CATEGORY_' . strtoupper( $tab ); 241 281 if ( ! $user_can_see_all && ! in_array( $category, array( 'CATEGORY_READY', 'CATEGORY_ASSIGNED' ) ) ) { 242 282 continue; 243 283 } 244 // this logic , covers all four possible combinations for counts, the default covering all tabs other than the syntheticready, advocacy and assigned284 // this logic covers all five possible combinations for counts, the default covering all tabs other than the synthetic team, ready, advocacy and assigned 245 285 $tabs_summary_sql .= ", SUM(IF(" ; 246 286 switch ( $category) { … … 260 300 ); 261 301 break; 302 case 'CATEGORY_TEAM': 303 $tabs_summary_sql .= ( 304 " assigned_subject is null AND $team_list_criterion, " 305 ); 306 break; 262 307 // in the latter two cases, mapped_issue cannot be null because it is a not null field 263 308 case 'CATEGORY_ADVOCACY': 264 309 $tabs_summary_sql .= 265 " assigned_subject IS NULL AND ( mapped_issue > 0 OR category= '$category' ), ";310 " assigned_subject IS NULL AND NOT $team_list_criterion AND ( mapped_issue > 0 OR $category_phrase = '$category' ), "; 266 311 break; 267 312 default: 268 313 $tabs_summary_sql .= 269 " assigned_subject IS NULL AND ( mapped_issue = 0 AND category= '$category' ), ";314 " assigned_subject IS NULL AND NOT $team_list_criterion AND ( mapped_issue = 0 AND $category_phrase = '$category' ), "; 270 315 } 271 316 $tabs_summary_sql .= "1, 0)) as $category"; -
wp-issues-crm/trunk/sql/wic_data_dictionary_and_field_groups.sql
r2096077 r2149004 148 148 ('email_settings', 'non_constituent_responder', 'non_constituent_response_subject_line', 'text', 'Non Constituent Response Subject Line', 20, 0, 0, '', 0, 0, 0, '', 1, '', '', '', '', 0, 0, 1, 0, 0), 149 149 ('email_settings', 'non_constituent_responder', 'non_constituent_response_message', 'textarea', 'Non Constituent Response Text (should include signature -- no signature will be added)', 30, 0, 0, '', 0, 0, 0, '', 1, '', '', '', '', 0, 0, 1, 0, 0), 150 ('email_settings', 'team_definition', 'team_list', 'textarea', 'Put these emails in the Team Tab.', 10, 0, 0, '', 0, 0, 0, '', 1, '', '', '', '', 0, 0, 1, 0, 0), 150 151 ('email_compose', 'compose_options', 'compose_to', 'multi_email', '', 10, 0, 0, '', 0, 0, 0, '', 1, '', '', '', '', 0, 0, 1, 0, 0), 151 152 ('email_compose', 'compose_options', 'compose_cc', 'multi_email', '', 20, 0, 0, '', 0, 0, 0, '', 1, '', '', '', '', 0, 0, 1, 0, 0), … … 390 391 ( 'email_settings', 'gmail_oauth', 'Gmail', 'WP Issues CRM can read and send mail through the Gmail API. Gmail heavily filters incoming email, especially if forwarded, and so may not be suitable as a general purpose constituent inbox where responsiveness is a priority.', 3, 1, 0), 391 392 ( 'email_settings', 'user_sig', 'Signature', '', 20, 1, 0), 393 ( 'email_settings', 'team_definition', 'Team Emails', 'Incoming emails from addresses that you list here will appear in the Team tab. You can use % as a wildcard for any string of characters. For example %masenate% would include any email address with masenate in the middle. Separate terms with the pipe "|" character. 394 For example: mybestfriend@gmail.com|staffmember1@jones.com|%masenate%|%belmontma.gov. Comparisons are not case sensitive.', 30, 1, 0), 392 395 ( 'email_settings', 'imap_message_grouping', 'Grouping', 'WP Issues CRM groups messages for bulk handling following conservative rules. In addition to requiring a 393 396 subject line which you have affirmatively trained, it also checks for consistency of message content. Note that matches are updated dynamically as you make new replies.', 30, 1, 0), -
wp-issues-crm/trunk/wp-issues-crm.php
r2147450 r2149004 39 39 // set database version global; 40 40 global $wp_issues_crm_db_version; 41 $wp_issues_crm_db_version = '4.5.0.1 ';41 $wp_issues_crm_db_version = '4.5.0.1.1'; 42 42 /* 43 43 * set js_css version global -- three possibilities:
Note: See TracChangeset
for help on using the changeset viewer.