Skip to content

Commit

Permalink
Merge branch 'release/1.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
asikur committed Jun 22, 2017
2 parents d09002f + 7a2dbd4 commit a71d0a4
Show file tree
Hide file tree
Showing 17 changed files with 5,766 additions and 232 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ build
secret.json
.netbeans.xml
npm-debug.log
.svnignore

14 changes: 14 additions & 0 deletions .svnignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
includes/pro
node_modules
nbproject
Gruntfile.js
package.json
docs.md
changelog.txt
export.sh
plugin-deploy.sh
readme.md
composer.json
customs.json
secret.json
.gitignore
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = function(grunt) {
'!.git/**',
'!Gruntfile.js',
'!package.json',
'!package-lock.json',
'!debug.log',
'!phpunit.xml',
'!export.sh',
Expand Down
1 change: 1 addition & 0 deletions assets/js/task-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@ Vue.component('cpm-text-editor', {
selector: 'textarea#' +self.editor_id,
menubar: false,
placeholder: CPM_Vars.message.comment_placeholder,
branding: false,

setup: function (editor) {
editor.on('change', function () {
Expand Down
13 changes: 12 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
= 1.6.4 - June 22, 2017 =

* [new] Task list-view on the right corner in to-do list section.
* [update] Notify co-workers on task completion.
* [update] Task update action hook.
* [update] Style sheets updated.
* [update] Some javascript refactored.
* [fix] Wrong color is showing for a task on basis of task competion status.
* [fix] PHP warning on project overview.
* [fix] PHP warning on my task overview.

= 1.6.3 - June 07, 2017 =

* [new] Drag and drop sortability added to the task
Expand All @@ -10,7 +21,7 @@
* [fix] Project overview graph is not working.
* [fix] Not all users of a project is being duplicated when duplicating a project.
* [fix] Notification is sent to the co-workers when a project is created.
* [fix] Unable to comment in a task when it is redirected from current task in my task.
* [fix] Unable to comment in a task when it is redirected from current task in my task.
* [fix] Unable to comment in a task when it is redirected from outstanding task in mytask.
* [fix] Unable to comment in a task when it is redirected from competed task in my task.
* [fix] User selection is not working in my task.
Expand Down
1 change: 1 addition & 0 deletions class/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ function mark_task_complete() {
$project_id = isset( $posted[ 'project_id' ] ) ? intval( $posted[ 'project_id' ] ) : 0;
$task_obj = CPM_Task::getInstance();
$is_assign = $task_obj->check_task_assign( $task_id );


if ( cpm_user_can_delete_edit( $project_id, $task_id, true ) || $is_assign ) {

Expand Down
2 changes: 1 addition & 1 deletion class/managetransient.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function new_task( $list_id, $task_id, $data ) {
* @param array $data
* @param int $project_id
*/
function complete_task( $list_id, $task_id, $data, $project_id ) {
function complete_task( $project_id, $task_id ) {

$this->delete_chart_transient_data( $project_id );
}
Expand Down
18 changes: 9 additions & 9 deletions class/notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class CPM_Notification {
private static $_instance;

function __construct() {

//notify users
add_action( 'cpm_project_new', array( $this, 'project_new' ), 10, 2 );
add_action( 'cpm_project_update', array( $this, 'project_update' ), 10, 2 );
Expand All @@ -16,7 +16,8 @@ function __construct() {

add_action( 'cpm_task_new', array( $this, 'new_task' ), 9, 3 );
add_action( 'cpm_task_update', array( $this, 'new_task' ), 9, 3 );

add_action( 'mark_task_complete', array( $this, 'complete_task' ), 9, 3 );

add_action( 'cpm_sub_task_new', array( $this, 'subtask_new_notify' ), 9, 3);
}

Expand Down Expand Up @@ -193,18 +194,19 @@ function project_update( $project_id, $data ) {
}
}

function complete_task( $list_id, $task_id, $data, $project_id ) {
function complete_task( $project_id, $task_id ) {
$project_users = CPM_Project::getInstance()->get_users( $project_id );

$users = array();

if ( is_array( $project_users ) && count( $project_users ) ) {
foreach ( $project_users as $user_id => $role_array ) {
if ( $role_array['role'] == 'manager' ) {
//if ( $role_array['role'] == 'manager' ) {
if ( $this->filter_email( $user_id ) ) {
// $users[$user_id] = sprintf( '%s (%s)', $role_array['name'], $role_array['email'] );
$users[$user_id] = sprintf( '%s', $role_array['email'] );
}
}
//}
}
}

Expand All @@ -224,15 +226,13 @@ function complete_task( $list_id, $task_id, $data, $project_id ) {
ob_start();

$arg = array(
'list_id' => $list_id,
'task_id' => $task_id,
'project_id' => $project_id,
'data' => $data,
'task_id' => $task_id,
);
cpm_load_template( $file_name, $arg );

$message = ob_get_clean();

if ( $message ) {
$this->send( implode( ', ', $users ), $subject, $message );
}
Expand Down
83 changes: 42 additions & 41 deletions class/task.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function register_post_type() {
function tasks_scripts() {
if ( isset( $_GET[ 'tab' ] ) AND $_GET[ 'tab' ] == 'task' ) {
wp_enqueue_media();

$scripts = array(
'cpm-uploader',
'cpm-toastr',
Expand All @@ -173,7 +173,6 @@ function tasks_scripts() {
'cpm-vue',
'cpm-vuex',
'cpm-vue-router',
'cpm-toastr',
'cpm-task-store',
'cpm-vue-multiselect',
'cpm-task-mixin',
Expand All @@ -189,16 +188,16 @@ function tasks_scripts() {
'todo_list_form' => apply_filters( 'todo_list_form', array( 'CPM_Task_Mixin' ) ),
'todo_list_router_default' => apply_filters( 'todo_list_router_default', array( 'CPM_Task_Mixin' ) ),
'todo_list_text_editor' => apply_filters( 'todo_list_text_editor', array() ),
));
));

do_action( 'cpm_before_task_scripts' );

foreach( $scripts as $script ) {
do_action( 'before-'. $script );
wp_enqueue_script( $script );
do_action( 'after-'. $script );
}

wp_enqueue_style( 'cpm-vue-multiselect' );
wp_enqueue_style( 'cpm-toastr' );
wp_enqueue_style( 'cpm-trix' );
Expand Down Expand Up @@ -292,7 +291,7 @@ function add_task( $list_id, $postdata, $task_id = 0 ) {
// $due = empty( $postdata['task_due'] ) ? '' : cpm_date2mysql( $postdata['task_due'] );
$due = empty( $postdata[ 'task_due' ] ) ? '' : cpm_to_mysql_date( $postdata[ 'task_due' ] );
$start = empty( $postdata[ 'task_start' ] ) ? '' : cpm_to_mysql_date( $postdata[ 'task_start' ] );

$data = array (
'post_parent' => $list_id,
'post_title' => $task_title,
Expand Down Expand Up @@ -335,7 +334,9 @@ function add_task( $list_id, $postdata, $task_id = 0 ) {
$comment_obj->associate_file( $file_id, $task_id );
}
}


$data['assigned_users'] = $postdata[ 'task_assign' ];

if ( $is_update ) {
$this->new_task_project_item( $list_id, $task_id, $assigned, $task_privacy, $is_update );
do_action( 'cpm_task_update', $list_id, $task_id, $data );
Expand Down Expand Up @@ -513,7 +514,7 @@ function update_task( $list_id, $postdata, $task_id ) {
*/
function get_task_lists( $project_id, $privacy = false, $show_all = false, $pagenum = 1, $defaults = array() ) {
global $wpdb;

$args = array (
'post_type' => 'cpm_task_list',
'order' => 'DESC',
Expand All @@ -522,7 +523,7 @@ function get_task_lists( $project_id, $privacy = false, $show_all = false, $page
);

$args = wp_parse_args( $args, $defaults );

if ( true === $show_all ) {
$args[ 'posts_per_page' ] = -1;
} else {
Expand All @@ -533,7 +534,7 @@ function get_task_lists( $project_id, $privacy = false, $show_all = false, $page
}

$args = apply_filters( 'cpm_get_tasklist', $args, $privacy, $show_all, $pagenum, $defaults );

$lists = new WP_Query( $args );

foreach ( $lists->posts as $list ) {
Expand Down Expand Up @@ -613,14 +614,14 @@ function set_list_meta( &$task_list ) {
$task_list->count_incompleted_tasks = $this->count_incompleted_tasks( $task_list->ID );
$comments = wp_count_comments( $task_list->ID );
$task_list->count_comments = $comments->approved;
$task_list->tasks = array();
$task_list->tasks = array();
}

function get_tasks_by_access_role( $list_id, $project_id = null ) {

if ( cpm_user_can_access( $project_id ) ) {
//for manager lavel
$tasks = $this->get_tasks( $list_id );
$tasks = $this->get_tasks( $list_id, true );
} else {

if ( cpm_user_can_access( $project_id, 'todo_view_private' ) ) {
Expand All @@ -645,11 +646,11 @@ function get_tasks( $list_id, $privacy = null, $pagenum = 1 ) {

$limit = -1;

$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
'post_status' => 'publish',
'order' => 'ASC',
'order' => 'ASC',
'orderby' => 'menu_order',
// 'order' => 'DESC',
// 'orderby' => 'ID',
Expand All @@ -670,20 +671,20 @@ function get_tasks( $list_id, $privacy = null, $pagenum = 1 ) {

function get_incompleted_tasks( $list_id, $privacy = null, $pagenum = 1 ) {
$per_page = cpm_get_option( 'show_incomplete_tasks', 'cpm_general' );
$limit = empty( $per_page ) ? 50 : $per_page;
$limit = empty( $per_page ) ? 50 : $per_page;

$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
'post_status' => 'publish',
'order' => 'ASC',
'order' => 'ASC',
'orderby' => 'menu_order',
// 'order' => 'DESC',
// 'orderby' => 'ID',
'offset' => $pagenum, // * $limit,
'posts_per_page' => $limit,
'meta_query' => array (
array (
array (
'key' => '_completed',
'value' => '0',
'compare' => '='
Expand All @@ -706,18 +707,18 @@ function get_completed_tasks( $list_id, $privacy = null, $pagenum = 1 ) {
$per_page = cpm_get_option( 'show_completed_tasks', 'cpm_general' );
$limit = empty( $per_page ) ? 50 : $per_page;

$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
'post_status' => 'publish',
'order' => 'ASC',
'order' => 'ASC',
'orderby' => 'menu_order',
// 'order' => 'DESC',
// 'orderby' => 'ID',
'offset' => $pagenum, // * $limit,
'posts_per_page' => $limit,
'meta_query' => array (
array (
array (
'key' => '_completed',
'value' => '1',
'compare' => '='
Expand All @@ -744,9 +745,9 @@ function get_completed_tasks( $list_id, $privacy = null, $pagenum = 1 ) {
*/
function count_tasks( $list_id ) {

$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
$args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
'post_status' => 'publish',
'posts_per_page' => 1,
);
Expand All @@ -766,14 +767,14 @@ function count_tasks( $list_id ) {
*/
function count_completed_tasks( $list_id ) {

$complete_task_args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
$complete_task_args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
'post_status' => 'publish',
'orderby' => 'menu_order',
'posts_per_page' => 1,
'meta_query' => array (
array (
array (
'key' => '_completed',
'value' => '1',
'compare' => '='
Expand All @@ -793,13 +794,13 @@ function count_completed_tasks( $list_id ) {
*/
function count_incompleted_tasks( $list_id ) {

$complete_task_args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
$complete_task_args = array (
'post_parent' => $list_id,
'post_type' => 'cpm_task',
'post_status' => 'publish',
'posts_per_page' => 1,
'meta_query' => array (
array (
array (
'key' => '_completed',
'value' => '0',
'compare' => '='
Expand All @@ -808,7 +809,7 @@ function count_incompleted_tasks( $list_id ) {
);

$complete_task = new WP_Query( $complete_task_args );

return $complete_task->found_posts;
}

Expand Down Expand Up @@ -957,7 +958,7 @@ function get_task_comments( $task_id ) {

foreach ( $task_comments as $key => $comment ) {
$comment->comment_content = do_shortcode( $comment->comment_content );
}
}

return $task_comments;
}
Expand Down Expand Up @@ -1136,7 +1137,7 @@ function check_task_assign( $task_id, $user_id = false ) {
* All necessary template for todo-lists
*
* @since 1.6
*
*
* @return void
*/
function load_js_template() {
Expand Down
Loading

0 comments on commit a71d0a4

Please sign in to comment.