id, '_agilepress_story_data', true); $current_status = (!empty($agilepress_meta['story_status'])) ? $agilepress_meta['story_status'] : ''; $current_product = (!empty($agilepress_meta['product'])) ? $agilepress_meta['product'] : ''; /* * Info */ $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Change the note\'s excerpt (i.e. the text body of the note).', // description $note->id, // id 'info', // action $note, // board_data 'header' // section ); // $modal_window .= ''; $modal_window .= '
'; $modal_window .= ''; $modal_window .= 'is_disabled('info') . '>'; $modal_window .= '

'; $modal_window .= 'is_disabled('info') . '>'; $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Change the note\'s excerpt (i.e. the text body of the note).', // description $note->id, // id 'info', // action $note, // board_data 'footer' // section ); /* * Comment */ $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Recent comments (use the box below to add your own).', // description $note->id, // id 'comment', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $args = array( 'post_id' => $note->id, 'number' => '3', //'status' => 'approve' ); $comments = get_comments($args); foreach ($comments as $comment) { $modal_window .= '

Comment: ' . esc_html($comment->comment_content) . '
'; $modal_window .= 'Posted by: ' . esc_html($comment->comment_author) . ' @ ' . esc_html($comment->comment_date) . '

'; $modal_window .= '
'; } $modal_window .= ''; $modal_window .= 'is_disabled('comment') . '>'; if (('yes' == $guest_comments) && (!is_user_logged_in())) { $modal_window .= ''; $modal_window .= 'is_disabled('comment') . '>'; } $modal_window .= '

'; $modal_window .= 'is_disabled('comment') . '>'; $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Recent comments (use the box below to add your own).', // description $note->id, // id 'comment', // action $note, // board_data 'footer' // section ); /* * Transition */ $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Create a new task from this story. This allows you to break your story (the "what") into to-do items (the "how").', // description $note->id, // id 'transition', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $modal_window .= ''; $modal_window .= 'is_disabled('transition') . '>'; $modal_window .= ''; $modal_window .= 'is_disabled('transition') . '>'; $modal_window .= '

'; $modal_window .= 'is_disabled('transition') . '>'; $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Create a new task from this story. This allows you to break your story (the "what") into to-do items (the "how").', // description $note->id, // id 'transition', // action $note, // board_data 'footer' // section ); /* * Attachments */ $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'View attachments related to this story. To add or remove attachments, visit the Admin panel entry for this story.', // description $note->id, // id 'attachment', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; //$products = $myQuery->get_products(); //$sprints = $myQuery->get_sprints(); $myMetadata = new AgilePress_Meta; $agilepress_attachment_meta = get_post_meta($note->id, '_agilepress_attachment_data', false); $meta_section = $myMetadata->build_attachment_meta_box($agilepress_attachment_meta, true); $modal_window .= $meta_section; $modal_window .= '

'; $modal_window .= 'is_disabled('attachment') . '>'; $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'View attachments related to this story. To add or remove attachments, visit the Admin panel entry for this story.', // description $note->id, // id 'attachment', // action $note, // board_data 'footer' // section ); /* * Settings */ $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Change any setting related to the story. (Bear in mind, changing the settings could result in a change in the story status or even remove it from this board).', // description $note->id, // id 'settings', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $products = $myQuery->get_products(); $sprints = $myQuery->get_sprints(); $myMetadata = new AgilePress_Meta; $meta_section = $myMetadata->build_story_meta_box($agilepress_meta, $products, $sprints, false); //print_r($meta_section); //$meta_section = str_replace('agilepress_story[product]', 'passed_product', $meta_section); //$meta_section = str_replace('agilepress_story[story_status]', 'passed_status', $meta_section); //$meta_section = str_replace('agilepress_story[story_sprint]', 'passed_sprint', $meta_section); //$meta_section = str_replace('agilepress_story[parent_epic]', 'passed_epic', $meta_section); //$meta_section = str_replace('agilepress_story[parent_epic]', 'passed_epic', $meta_section); $modal_window .= $meta_section; $modal_window .= '

'; $modal_window .= 'is_disabled('settings') . '>'; $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Change any setting related to the story. (Bear in mind, changing the settings could result in a change in the story status or even remove it from this board).', // description $note->id, // id 'settings', // action $note, // board_data 'footer' // section ); /* * Remove */ $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Delete this item?', // description $note->id, // id 'remove', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $modal_window .= ''; $modal_window .= ' '; $modal_window .= '

'; $modal_window .= 'is_disabled('remove') . '>'; $modal_window .= $this->modal_inner_form( 'backlogboard', // board_type 'story', // note_type $current_product, null, $note->story_title, // note_title 'Delete this item?', // description $note->id, // id 'remove', // action $note, // board_data 'footer' // section ); } break; default: foreach ($board_data as $note) { /* * Info */ $agilepress_meta = get_post_meta($note->id, '_agilepress_task_data', true); $current_status = (!empty($agilepress_meta['task_status'])) ? $agilepress_meta['task_status'] : ''; $current_product = (!empty($agilepress_meta['product'])) ? $agilepress_meta['product'] : ''; $current_sprint = (!empty($agilepress_meta['sprint'])) ? $agilepress_meta['sprint'] : ''; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Change the note\'s excerpt (i.e. the text body of the note).', // description $note->id, // id 'info', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $modal_window .= ' ' . $this->is_disabled('info') . ''; $modal_window .= '

'; $modal_window .= 'is_disabled('info') . '>'; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Change the note\'s excerpt (i.e. the text body of the note).', // description $note->id, // id 'info', // action $note, // board_data 'footer' // section ); /* * Comment */ $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Recent comments (use the box below to add your own).', // description $note->id, // id 'comment', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $args = array( 'post_id' => $note->id, 'number' => '3', //'status' => 'approve' ); $comments = get_comments($args); foreach ($comments as $comment) { $modal_window .= '

Comment: ' . esc_html($comment->comment_content) . '
'; $modal_window .= 'Posted by: ' . esc_html($comment->comment_author) . ' @ ' . esc_html($comment->comment_date) . '

'; $modal_window .= '
'; } $modal_window .= ''; $modal_window .= 'is_disabled('comment') . '>'; if (('yes' == $guest_comments) && (!is_user_logged_in())) { $modal_window .= ''; $modal_window .= 'is_disabled('comment') . '>'; } $modal_window .= '

'; $modal_window .= 'is_disabled('comment') . '>'; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Recent comments (use the box below to add your own).', // description $note->id, // id 'comment', // action $note, // board_data 'footer' // section ); /* * Transition */ $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'story', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Create a new task from this story. This allows you to break your story (the "what") into to-do items (the "how").', // description $note->id, // id 'transition', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $modal_window .= ''; $modal_window .= 'is_disabled('transition') . '>'; $modal_window .= ''; $modal_window .= 'is_disabled('transition') . '>'; $modal_window .= '

'; $modal_window .= 'is_disabled('transition') . '>'; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'story', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Create a new task from this story. This allows you to break your story (the "what") into to-do items (the "how").', // description $note->id, // id 'transition', // action $note, // board_data 'footer' // section ); /* * Attachments */ $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'View attachments related to this task. To add or remove attachments, visit the Admin panel entry for this task.', // description $note->id, // id 'attachment', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; //$products = $myQuery->get_products(); //$sprints = $myQuery->get_sprints(); $agilepress_attachment_meta = get_post_meta($note->id, '_agilepress_attachment_data', false); $myMetadata = new AgilePress_Meta; $meta_section = $myMetadata->build_attachment_meta_box($agilepress_attachment_meta, true); $modal_window .= $meta_section; $modal_window .= '

'; $modal_window .= 'is_disabled('attachment') . '>'; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'View attachments related to this story. To add or remove attachments, visit the Admin panel entry for this story.', // description $note->id, // id 'attachment', // action $note, // board_data 'footer' // section ); /* * Settings */ $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Change any setting related to the task. (Bear in mind, changing the settings could result in a change in the task status or even remove it from this board).', // description $note->id, // id 'settings', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $products = $myQuery->get_products(); $sprints = $myQuery->get_sprints(); $stories = $myQuery->get_stories(); $myMetadata = new AgilePress_Meta; $meta_section = $myMetadata->build_task_meta_box($agilepress_meta, $products, $sprints, $stories, false); //print_r($meta_section); //$meta_section = str_replace('agilepress_task[product]', 'passed_product', $meta_section); //$meta_section = str_replace('agilepress_task[task_status]', 'passed_status', $meta_section); //$meta_section = str_replace('agilepress_task[sprint]', 'passed_sprint', $meta_section); ///$meta_section = str_replace('agilepress_task[parent_story]', 'passed_parent', $meta_section); //$meta_section = str_replace('agilepress_task[task_priority]', 'passed_priority', $meta_section); $modal_window .= $meta_section; $modal_window .= '

'; $modal_window .= 'is_disabled('settings') . '>'; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Change any setting related to the task. (Bear in mind, changing the settings could result in a change in the task status or even remove it from this board).', // description $note->id, // id 'settings', // action $note, // board_data 'footer' // section ); /* * Remove */ $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Delete this item?', // description $note->id, // id 'remove', // action $note, // board_data 'header' // section ); $modal_window .= ''; $modal_window .= ''; $modal_window .= ''; $modal_window .= ' '; $modal_window .= '

'; $modal_window .= 'is_disabled('remove') . '>'; $modal_window .= $this->modal_inner_form( 'sprintboard', // board_type 'task', // note_type $current_product, $current_sprint, $note->task_title, // note_title 'Delete this item?', // description $note->id, // id 'remove', // action $note, // board_data 'footer' // section ); } break; } return $modal_window; } /** * Creates the redundant parts of each modal * * This method creates the head and tail of all modals. * * @param string $board_type The type of board (backlog, kanban, etc.) * @param string $note_type Task or Story * @param string $note_title Display name for note * @param string $description What the modal does * @param integer $id The ID of the note being affected * @param string $action The action being taking (i.e. comment, transition, etc.) * @param object $board_data The contents of the affected note * @param string $section Whether to do the top or the bottom * @return string $partial_modal A formated HTML string * * @author Vinland Media, LLC. * @package AgilePress */ private function modal_inner_form($board_type = null, $note_type = null, $current_product = null, $current_sprint = null, $note_title = null, $description = null, $id = null, $action = null, $board_data = null, $section = null) { global $wp; $partial_modal = ''; $url = home_url(add_query_arg(array(),$wp->request));//home_url($wp->request); switch ($section) { case 'header': $window_id = 'id-' . $action . '-' . $id; $title = '$board_data->' . $note_type . '_title'; $partial_modal .= '
'; $partial_modal .= '
'; $partial_modal .= '
'; $partial_modal .= '×'; $partial_modal .= '
'; $partial_modal .= '
'; $partial_modal .= '

' . esc_html($note_title) . '

'; $partial_modal .= '
'; $partial_modal .= '
'; $partial_modal .= '

' . esc_html($description) . '

'; $partial_modal .= '
'; break; case 'footer': $partial_modal .= ''; $partial_modal .= ''; $partial_modal .= ''; $partial_modal .= ''; $partial_modal .= ''; $partial_modal .= ''; $partial_modal .= ''; $partial_modal .= '

'; $partial_modal .= ''; $partial_modal .= '
'; $partial_modal .= '
'; $partial_modal .= '
'; $partial_modal .= '
'; break; default: $partial_modal .= ''; break; } return $partial_modal; } /** * Disables HTML Inputs * * This method is used to disable HTML input elements for users who are not * authorized to edit/change them. * * @param string $action The action currently being processed * @return string $result The word "disabled" or null * * @author Vinland Media, LLC. * @package AgilePress */ private function is_disabled($action = null) { if ('comment' == $action) { // get saved options $agilepress_options = get_option('agilepress_options'); // guests are allowed to comment on public boards if ((isset($agilepress_options['agilepress_guest_comments'])) && (!empty($agilepress_options['agilepress_guest_comments']))) { $guest_comments = $agilepress_options['agilepress_guest_comments']; } else { $guest_comments = null; } } if ((user_can(wp_get_current_user(), 'transition_tasks')) || ('yes' == $guest_comments && 'comment' == $action)) { $result = null; } else { $result = 'disabled'; } return $result; } }