Plugin Directory

Changeset 2435596


Ignore:
Timestamp:
12/09/2020 03:04:20 PM (5 years ago)
Author:
upstreamplugin
Message:

1.39.0

Location:
upstream/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • upstream/trunk/includes.php

    r2418972 r2435596  
    11<?php
    2 define('UPSTREAM_VERSION', '1.38.4');
     2define('UPSTREAM_VERSION', '1.39.0');
    33
    44global $upstream_addon_requirements;
  • upstream/trunk/includes/admin/class-up-admin.php

    r2417454 r2435596  
    767767            return "$classes upstream";
    768768        }
     769
     770        return $classes;
    769771    }
    770772
  • upstream/trunk/includes/admin/metaboxes/class-up-metaboxes-clients.php

    r2417454 r2435596  
    243243                        <tr data-id="<?php echo $user->id; ?>">
    244244                            <td>
    245                                 <?php echo esc_html($user->name); ?>
     245                                <a title="<?php echo sprintf(__("Managing %s's Permissions"), $user->name); ?>"
     246                                   href="#TB_inline?width=600&height=425&inlineId=modal-user-permissions"
     247                                   class="thickbox"><?php echo esc_html($user->name); ?></a>
    246248                            </td>
    247249                            <td><?php echo esc_html($user->email); ?></td>
     
    814816    public static function updateUserPermissions()
    815817    {
     818        header('Content-Type: application/json');
     819
     820        $response = [
     821            'success' => false,
     822            'err'     => null,
     823        ];
     824
     825        try {
     826            if ( ! upstream_admin_permissions('edit_clients')) {
     827                throw new \Exception(__("You're not allowed to do this.", 'upstream'));
     828            }
     829
     830            if (empty($_POST) || ! isset($_POST['client'])) {
     831                throw new \Exception(__('Invalid request.', 'upstream'));
     832            }
     833
     834            $client_id = (int)$_POST['client'];
     835            if ($client_id <= 0) {
     836                throw new \Exception(__('Invalid Client ID.', 'upstream'));
     837            }
     838
     839            $client_user_id = isset($_POST['user']) ? (int)$_POST['user'] : 0;
     840            if ($client_user_id <= 0) {
     841                throw new \Exception(__('Invalid User ID.', 'upstream'));
     842            }
     843
     844            if ( ! upstream_do_client_user_belongs_to_client($client_user_id, $client_id)) {
     845                throw new \Exception(__("This Client User is not associated with this Client.", 'upstream'));
     846            }
     847
     848            $clientUser = new \WP_User($client_user_id);
     849            if (array_search('upstream_client_user', $clientUser->roles) === false) {
     850                throw new \Exception(__("This user doesn't seem to be a valid Client User.", 'upstream'));
     851            }
     852
     853            if (isset($_POST['permissions']) && ! empty($_POST['permissions'])) {
     854
     855                if (is_array($_POST['permissions'])) {
     856                    $newPermissions = \array_map( 'sanitize_text_field', $_POST['permissions'] );
     857                } else {
     858                    $newPermissions = [sanitize_text_field($_POST['permissions'])];
     859                }
     860
     861                $permissions    = upstream_get_client_users_permissions();
     862
     863                $deniedPermissions = (array)array_diff(array_keys($permissions), $newPermissions);
     864                foreach ($deniedPermissions as $permissionKey) {
     865                    /* Make sure this is a valid permission. */
     866                    if (isset($permissions[$permissionKey])) {
     867                        $clientUser->add_cap($permissionKey, false);
     868                    }
     869                }
     870
     871                foreach ($newPermissions as $permissionKey) {
     872                    /* Make sure this is a valid permission. */
     873                    if (isset($permissions[$permissionKey])) {
     874                        $clientUser->add_cap($permissionKey, true);
     875                    }
     876                }
     877            }
     878
     879            $response['success'] = true;
     880        } catch (\Exception $e) {
     881            $response['err'] = $e->getMessage();
     882        }
     883
     884        echo wp_json_encode($response);
     885
    816886        wp_die();
    817887    }
     888
    818889}
  • upstream/trunk/includes/class-up-report.php

    r2410501 r2435596  
    100100                return false;
    101101
    102             return (count($ids) == 0 || in_array($item->id, $ids));
     102            return (in_array($item->id, $ids));
    103103        };
    104104
     
    124124                return false;
    125125
    126             return (count($ids) == 0 || in_array($item->id, $ids));
     126            return (in_array($item->id, $ids));
    127127
    128128        };
     
    149149                return false;
    150150
    151             return (count($ids) == 0 || in_array($item->id, $ids));
     151            return (in_array($item->id, $ids));
    152152
    153153        };
     
    175175                return false;
    176176
    177             return (count($ids) == 0 || in_array($item->id, $ids));
     177            return (in_array($item->id, $ids));
    178178
    179179        };
     
    200200                return false;
    201201
    202             return (count($ids) == 0 || in_array($item->id, $ids));
     202            return (in_array($item->id, $ids));
    203203
    204204        };
  • upstream/trunk/includes/frontend/up-template-functions.php

    r2417454 r2435596  
    5353                if (upstream_show_users_name()) {
    5454                    if ($isAfterFirstItem) {
    55                         echo ',&nbsp;';
     55                        echo ',&nbsp; ';
    5656                    }
    5757
  • upstream/trunk/includes/model/UpStream_Model_File.php

    r2385265 r2435596  
    1212
    1313    protected $upfsFileId = null;
     14
     15    protected $createdAt = 0;
    1416
    1517    protected $reminders = [];
     
    3335    {
    3436        parent::loadFromArray($item_metadata);
     37
     38        $this->createdAt = !empty($item_metadata['created_at']) ? $item_metadata['created_at'] : null;
    3539
    3640        if (upstream_filesytem_enabled() && isset($item_metadata['file']) && upstream_upfs_info($item_metadata['file'])) {
     
    8286        }
    8387
     88        if ($this->createdAt >= 0) $item_metadata['created_at'] = $this->createdAt;
    8489        $item_metadata['reminders'] = [];
    8590
     
    130135                return '';
    131136
     137            case 'createdAt':
     138                if ($this->createdAt > 0)
     139                    return self::timestampToYMD($this->createdAt);
     140                else
     141                    return '';
     142
    132143            default:
    133144                return parent::__get($property);
     
    163174
    164175        $fields['fileId'] = [ 'type' => 'file', 'title' => __('File'), 'search' => false, 'display' => true ];
     176        $fields['createdAt'] = [ 'type' => 'date', 'title' => __('Upload Date'), 'search' => true, 'display' => true ];
    165177
    166178        $fields = self::customFields($fields, UPSTREAM_ITEM_TYPE_FILE);
  • upstream/trunk/includes/model/UpStream_Model_Project.php

    r2354305 r2435596  
    2121    protected $clientUserIds = [];
    2222
     23    protected $memberUserIds = [];
     24
    2325    protected $clientId = 0;
    2426
     
    4042                'clientUserIds' => function ($m) {
    4143                    $arr = isset($m['_upstream_project_client_users'][0]) ? unserialize($m['_upstream_project_client_users'][0]) : null;
     44                    $arr = is_array($arr) ? $arr : [];
     45                    $arr = array_filter($arr);
     46                    return $arr;
     47                },
     48                'memberUserIds' => function ($m) {
     49                    $arr = isset($m['_upstream_project_members'][0]) ? unserialize($m['_upstream_project_members'][0]) : null;
    4250                    $arr = is_array($arr) ? $arr : [];
    4351                    $arr = array_filter($arr);
     
    319327            case 'clientId':
    320328            case 'clientUserIds':
     329            case 'memberUserIds':
    321330            case 'startDate':
    322331            case 'endDate':
     
    456465        $fields['statusCode'] = [ 'type' => 'select', 'title' => __('Status'), 'search' => true, 'display' => true, 'options_cb' => 'UpStream_Model_Project::getStatuses' ];
    457466        $fields['categoryIds'] = [ 'type' => 'select', 'title' => __('Categories'), 'search' => true, 'display' => true, 'options_cb' => 'UpStream_Model_Project::getCategories', 'is_array' => 'true' ];
     467        $fields['clientUserIds'] = [ 'type' => 'user_id', 'is_array' => true, 'title' => __('Selected Client Users'), 'search' => true, 'display' => true ];
     468        $fields['memberUserIds'] = [ 'type' => 'user_id', 'is_array' => true, 'title' => __('Members'), 'search' => true, 'display' => true ];
    458469        $fields['startDate'] = [ 'type' => 'date', 'title' => __('Start Date'), 'search' => true, 'display' => true ];
    459470        $fields['endDate'] = [ 'type' => 'date', 'title' => __('End Date'), 'search' => true, 'display' => true ];
  • upstream/trunk/includes/up-general-functions.php

    r2417454 r2435596  
    9595function upstream_filesystem_max_size()
    9696{
    97     return 10000000;
     97    return 100000000;
    9898}
    9999
  • upstream/trunk/readme.txt

    r2418972 r2435596  
    33Tags: project, manage, management, project management, project manager, wordpress project management, crm, client, client manager, tasks, issue tracker, bug tracker, task manager
    44Requires at least: 5.2
    5 Tested up to: 5.5
     5Tested up to: 5.6
    66Requires PHP: 5.6.20
    7 Stable tag: 1.38.4
     7Stable tag: 1.39.0
    88License: GPL-3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    142142The format is based on [Keep a Changelog](http://keepachangelog.com)
    143143and this project adheres to [Semantic Versioning](http://semver.org).
     144
     145= [1.39.0] - 2020-12-07 =
     146* Made report changes
     147* Fixed LTR display bug
     148* Added back permissions edit box removed in previous release
    144149
    145150= [1.38.4] - 2020-11-15 =
  • upstream/trunk/templates/assets/css/upstream.css

    r2315471 r2435596  
    512512    margin-bottom: 50px;
    513513}
     514
     515.rtl.nav-md .container.body .right_col {
     516    margin-left: 0 !important;
     517    margin-right: 230px !important;
     518}
     519
     520.rtl .main_container .top_nav {
     521    display:none;
     522}
     523
     524.rtl .panel-body div:first-child {
     525    margin-right:20px;
     526}
     527
     528.rtl .menu_section > ul.side-menu {
     529    padding:0;
     530}
     531
     532rtl.nav-sm .container.body .right_col {
     533    margin-left:0;
     534}
     535
     536.rtl.nav-sm ul.nav.child_menu {
     537    left: 0;
     538    position: relative;
     539    width: auto;
     540    z-index: 4000;
     541    background: inherit;
     542    padding: 0;
     543    margin: 0;
     544}
  • upstream/trunk/templates/report-parameters/section.php

    r2417454 r2435596  
    1414$typeInfo = "";
    1515
     16$show = true;
     17
    1618switch ($type) {
    1719    case 'project':
     
    2224        $typeInfo = upstream_milestone_label();
    2325        $fields = UpStream_Model_Milestone::fields();
     26        $show = !upstream_disable_milestones();
    2427        break;
    2528    case 'task':
    2629        $typeInfo = upstream_task_label();
    2730        $fields = UpStream_Model_Task::fields();
     31        $show = !upstream_disable_tasks();
    2832        break;
    2933    case 'bug':
    3034        $typeInfo = upstream_bug_label();
    3135        $fields = UpStream_Model_Bug::fields();
     36        $show = !upstream_disable_bugs();
    3237        break;
    3338    case 'file':
    3439        $typeInfo = upstream_file_label();
    3540        $fields = UpStream_Model_File::fields();
     41        $show = !upstream_disable_files();
    3642        break;
    3743}
    3844
    39 ?>
    40 <div class="col-md-12 col-sm-12 col-xs-12">
    41     <div class="x_panel" data-section="report-parameters-<?php echo $sectionId; ?>">
    42         <div class="x_title">
    43             <h2>
    44                 <?php echo esc_html($typeInfo . __(' Filters')); ?>
    45             </h2>
    46             <div class="clearfix"></div>
    47         </div>
    48         <div class="x_content">
     45if ($show) {
     46    ?>
     47    <div class="col-md-12 col-sm-12 col-xs-12">
     48        <div class="x_panel" data-section="report-parameters-<?php echo $sectionId; ?>">
     49            <div class="x_title">
     50                <h2>
     51                    <?php echo esc_html($typeInfo . __(' Filters')); ?>
     52                </h2>
     53                <div class="clearfix"></div>
     54            </div>
     55            <div class="x_content">
    4956
    50             <div class="row">
     57                <div class="row">
    5158
    52                 <div class="col-lg-12 col-xs-12">
    53                     <div class="form-group">
    54                         <label><?php esc_html_e('Name') ?></label>
    55                         <select class="form-control" multiple name="upstream_report__<?php echo $sectionId ?>_id[]">
    56                             <?php
    57                             foreach ($projects as $project):
    58                                 $user = upstream_user_data();
    59                                 if (upstream_user_can_access_project(isset($user['id']) ? $user['id'] : 0, $project->id)):
     59                    <div class="col-lg-12 col-xs-12">
     60                        <div class="form-group">
     61                            <label><?php esc_html_e('Name') ?></label>
     62                            <select class="form-control" multiple name="upstream_report__<?php echo $sectionId ?>_id[]">
     63                                <?php
     64                                foreach ($projects as $project):
     65                                    $user = upstream_user_data();
     66                                    if (upstream_user_can_access_project(isset($user['id']) ? $user['id'] : 0, $project->id)):
     67                                        ?>
     68                                        <?php if ($type == 'project'): ?>
     69                                        <option selected value="<?php echo $project->id ?>"><?php esc_html_e($project->title); ?></option>
     70                                    <?php else: ?>
     71                                        <option disabled
     72                                                style="color:#DDDDDD;font-style: italic"><?php esc_html_e($project->title); ?></option>
     73                                    <?php endif; ?>
     74
     75                                        <?php
     76                                        if ($type == 'milestone' || $type == 'bug' || $type == 'file' || $type == 'task') {
     77
     78                                            $children = [];
     79                                            if ($type == 'bug') $children = &$project->bugs();
     80                                            elseif ($type == 'file') $children = &$project->files();
     81                                            elseif ($type == 'task') $children = &$project->tasks();
     82                                            elseif ($type == 'milestone') $children = $project->findMilestones();
     83
     84                                            foreach ($children as $child) {
     85                                                if (upstream_override_access_object(true, $type, $child->id, UPSTREAM_ITEM_TYPE_PROJECT, $project->id, UPSTREAM_PERMISSIONS_ACTION_VIEW)) {
     86                                                    ?>
     87                                                    <option selected value="<?php echo esc_attr($child->id) ?>">
     88                                                        &emsp;<?php esc_html_e($child->title); ?></option>
     89                                                    <?php
     90                                                }
     91                                            }
     92
     93                                        }
     94                                        ?>
     95                                    <?php
     96                                    endif;
     97                                endforeach;
    6098                                ?>
    61                                 <?php if ($type == 'project'): ?>
    62                                     <option value="<?php echo $project->id ?>"><?php esc_html_e($project->title); ?></option>
    63                                 <?php else: ?>
    64                                     <option disabled style="color:#DDDDDD;font-style: italic"><?php esc_html_e($project->title); ?></option>
    65                                 <?php endif; ?>
     99                            </select>
     100                            <a onclick="jQuery('[name=\'upstream_report__<?php print $sectionId; ?>_id[]\'] option').prop('selected', true)">Select
     101                                all</a> | <a
     102                                    onclick="jQuery('[name=\'upstream_report__<?php print $sectionId; ?>_id[]\'] option').prop('selected', false)">Select
     103                                none</a>
     104                        </div>
    66105
    67                                 <?php
    68                                 if ($type == 'milestone' || $type == 'bug' || $type == 'file' || $type == 'task') {
    69 
    70                                     $children = [];
    71                                     if ($type == 'bug') $children = &$project->bugs();
    72                                     elseif ($type == 'file') $children = &$project->files();
    73                                     elseif ($type == 'task') $children = &$project->tasks();
    74                                     elseif ($type == 'milestone') $children = $project->findMilestones();
    75 
    76                                     foreach ($children as $child) {
    77                                         if (upstream_override_access_object(true, $type, $child->id, UPSTREAM_ITEM_TYPE_PROJECT, $project->id, UPSTREAM_PERMISSIONS_ACTION_VIEW)) {
    78                                             ?>
    79                                             <option value="<?php echo esc_attr($child->id) ?>">
    80                                                 &emsp;<?php esc_html_e($child->title); ?></option>
    81                                             <?php
    82                                         }
    83                                     }
    84 
    85                                 }
    86                                 ?>
    87                             <?php
    88                                 endif;
    89                             endforeach;
    90                             ?>
    91                         </select>
    92                         <a onclick="jQuery('[name=\'upstream_report__<?php print $sectionId; ?>_id[]\'] option').prop('selected', true)">Select all</a> | <a onclick="jQuery('[name=\'upstream_report__<?php print $sectionId; ?>_id[]\'] option').prop('selected', false)">Select none</a>
     106                        <?php include('search-fields.php'); ?>
    93107                    </div>
    94 
    95                     <?php include('search-fields.php'); ?>
    96108                </div>
    97109            </div>
    98110        </div>
    99111    </div>
    100 </div>
     112    <?php
     113}
     114?>
  • upstream/trunk/upstream.php

    r2418972 r2435596  
    55 * Author: UpStream
    66 * Author URI: https://upstreamplugin.com
    7  * Version: 1.38.4
     7 * Version: 1.39.0
    88 * Text Domain: upstream
    99 * Domain Path: /languages
Note: See TracChangeset for help on using the changeset viewer.