PDA

View Full Version : vBulletin Project Tools - vBulletin Project Tools - Color to Indicate Status


Quarterbore
08-17-2007, 10:00 PM
Background:

I am a visual person and with the project(s) I will be using using Project Tools with I need to be able to quickly look at my pages to determine if I still have outstanding issues that need to be addressed. This modification makes it easier for me to keep track of the issues that I have to still address.

About the Modification:

I am posting this here with the hope that vBulletin takes the code and improves it and turns this into a standard feature of project tools. There are lots of ways this script could be improved but java is not my strong suite and I hope by posing this here someone else can help improve this!

The Modifications that are needed:

Two files must be edited.
Install a product file with one small phrase and a small pluggin.
Edit one template

OK, let the fun begin!

STEP 1: Install the Attached Product File!

STEP 2: A Bunch of File Edits!

OPEN FILE /AdminCP/project.php

FIND


if ($_POST['do'] == 'statusupdate')
{
$vbulletin->input->clean_array_gpc('p', array(
'issuestatusid' => TYPE_UINT,
'title' => TYPE_STR,
'issuetypeid' => TYPE_STR,
'displayorder' => TYPE_UINT,
'canpetitionfrom' => TYPE_UINT
));


REPLACE WITH:


if ($_POST['do'] == 'statusupdate')
{
$vbulletin->input->clean_array_gpc('p', array(
'issuestatusid' => TYPE_UINT,
'title' => TYPE_STR,
'issuetypeid' => TYPE_STR,
'displayorder' => TYPE_UINT,
'canpetitionfrom' => TYPE_UINT,
'background' => TYPE_STR
));


FIND:


$statusdata->set('displayorder', $vbulletin->GPC['displayorder']);
$statusdata->set('canpetitionfrom', $vbulletin->GPC['canpetitionfrom']);
$statusdata->set_info('title', $vbulletin->GPC['title']);
$statusdata->save();

define('CP_REDIRECT', 'project.php?do=typelist');
print_stop_message('issue_status_saved');
}



REPLACE WITH:


$statusdata->set('displayorder', $vbulletin->GPC['displayorder']);
$statusdata->set('canpetitionfrom', $vbulletin->GPC['canpetitionfrom']);
$statusdata->set_info('title', $vbulletin->GPC['title']);
$statusdata->set('background', $vbulletin->GPC['background']);
$statusdata->save();

define('CP_REDIRECT', 'project.php?do=typelist');
print_stop_message('issue_status_saved');
}


FIND:


$issuestatus = array(
'issuestatusid' => 0,
'issuetypeid' => $vbulletin->GPC['type'],
'displayorder' => $maxorder['maxorder'] + 10,
'canpetitionfrom' => 1,
'title' => ''
);
}


REPLACE WITH:


$issuestatus = array(
'issuestatusid' => 0,
'issuetypeid' => $vbulletin->GPC['type'],
'displayorder' => $maxorder['maxorder'] + 10,
'canpetitionfrom' => 1,
'title' => '',
'background' => $vbulletin->GPC['background']
);
}


FIND:


print_input_row($vbphrase['display_order'], 'displayorder', $issuestatus['displayorder'], true, 5);
print_yes_no_row($vbphrase['can_create_petitions_from_this_status'], 'canpetitionfrom', $issuestatus['canpetitionfrom']);

construct_hidden_code('issuestatusid', $issuestatus['issuestatusid']);
print_submit_row();

}


REPLACE WITH:


print_input_row($vbphrase['display_order'], 'displayorder', $issuestatus['displayorder'], true, 5);
print_yes_no_row($vbphrase['can_create_petitions_from_this_status'], 'canpetitionfrom', $issuestatus['canpetitionfrom']);
print_input_row($vbphrase['background_color'], 'background', $issuestatus['background'], true, 5);

construct_hidden_code('issuestatusid', $issuestatus['issuestatusid']);
print_submit_row();

}


FIND:


if ($_REQUEST['do'] == 'statusadd' OR $_REQUEST['do'] == 'statusedit')
{
$vbulletin->input->clean_array_gpc('r', array(
'issuestatusid' => TYPE_UINT,
'type' => TYPE_STR
));


REPLACE WITH


if ($_REQUEST['do'] == 'statusadd' OR $_REQUEST['do'] == 'statusedit')
{
$vbulletin->input->clean_array_gpc('r', array(
'issuestatusid' => TYPE_UINT,
'type' => TYPE_STR,
'background' => TYPE_STR
));



OPEN FILE includes/class_dm_pt_issuestatus.php

FIND:


var $validfields = array(
'issuestatusid' => array(TYPE_UINT, REQ_INCR),
'issuetypeid' => array(TYPE_STR, REQ_YES),
'displayorder' => array(TYPE_UINT, REQ_NO),
'canpetitionfrom' => array(TYPE_UINT, REQ_NO),
);


REPLACE WITH:


var $validfields = array(
'issuestatusid' => array(TYPE_UINT, REQ_INCR),
'issuetypeid' => array(TYPE_STR, REQ_YES),
'displayorder' => array(TYPE_UINT, REQ_NO),
'canpetitionfrom' => array(TYPE_UINT, REQ_NO),
'background' => array(TYPE_STR, REQ_NO),
);


STEP 3: EDIT template pt_issuebit

NOTE - You can change as many or as few cells in row of each issue. In this example I did the first three as shown in the attached image!

FIND:
<td class="alt2" align="center">
REPLACE WITH:
<td class="alt2" align="center" style="background-color: $issue[background]">

FIND:
<td class="alt1" align="$stylevar[left]">
REPLACE WITH:
<td class="alt1" align="$stylevar[left]" style="background-color: $issue[background]">

FIND:
<td class="alt2 smallfont" align="$stylevar[right]" nowrap="nowrap">
REPLACE WITH:
<td class="alt2 smallfont" align="$stylevar[right]" nowrap="nowrap" style="background-color: $issue[background]">

I also did the same edits to all of the cells on my site and attached a screen shot as an example!

Well, if I didn't scare you off and you are still reading... Just remember to use the color codes as the six digit hexadecimal values with the number sign. Here are the ones I am using:

#FFFFFF - White
#FFFFCC - Pastel Yellow
#CCFFFF - Pastel Blue
#FFCCFF - Pastel Pink

Note that I use color for issues that need my attention. I use white for the issues that I can ignore... But obviously you can use any colors you want! Now, if you do not add a color value, your site will use the default style colors as well!

Quarterbore
08-18-2007, 01:24 AM
I would really LOVE to get some help intergrating Java directly into the AdminCP like is built into the vBulletin Style Manager. I fought with that code for way too many hours before I decided to release this as is.

I also wanted to rework the main Issue Type Manager Page to show the color on there with a handy little Java script but again, I couldn't get it done!

I will not have internet access after tomorrow for about a week because of travel. I will help anybody that needs help until I leave tomorrow and I welcome someone else to help improve this and perhaps we can get this included in the standard code in Project Tools in a future release!

No copyrights claimed or otherwise... I really want to see this as a standard feature...

jluerken
08-18-2007, 08:42 AM
Good job Quarterbore, this should become a Project Tool Standard.
Colorizing the status makes the tool more easy to use.

ragtek
08-18-2007, 09:10 AM
yes!
it should be standard, specialy this is just possible with an fileedit

jgommel
08-18-2007, 09:12 PM
I've made all the file edits, template edit and updated my Issue Types (added Hex color values) under the Issue Type Manager, but I don't see anything. I checked the vBulletin Project Tools - Color to Indicate Status install to be sure the table column installed correctly (it did), the install and edits all seem to be ok, but nothing changes.

Note: I also ran the Update Counters within Project Tools just in-case.

Quarterbore
08-18-2007, 10:51 PM
I've made all the file edits, template edit and updated my Issue Types (added Hex color values) under the Issue Type Manager, but I don't see anything. I checked the vBulletin Project Tools - Color to Indicate Status install to be sure the table column installed correctly (it did), the install and edits all seem to be ok, but nothing changes.

Note: I also ran the Update Counters within Project Tools just in-case.

Did you install the product file and is the plugin active? (Product : Project Tools Status Colors)

Did you remember to edit the template in the style you are looking at? If you have multiple styles, you need to either apply this to the parent style of the rest or hack every style you want this to be shown in.

If the color shows in the AdminCP you have the hard parts done corectly! Your issue is either the plugin that pulls the color from the database based on statusid or the template edits that shows the color itself!

jgommel
08-18-2007, 10:58 PM
Did you remember to edit the template in the style you are looking at? If you have multiple styles, you need to either apply this to the parent style of the rest or hack every style you want this to be shown in.

I only have one style installed, so that's not the issue.

I also assume you installed the product file and that the plugin is active as well...

Yea, it's installed (that's how I was able to check the database to be sure the /xml script added the column to the appropriate table.

Quarterbore
08-19-2007, 01:03 AM
I only have one style installed, so that's not the issue.



Yea, it's installed (that's how I was able to check the database to be sure the /xml script added the column to the appropriate table.

Yea, then you are correct, it should work?

Can you post a link to your project tools with some project where it should show colors along with a hint about which status that is shown should have a color code and what the color should be? You may also need to allow guests to see your PT for me to see as well.

I want to look at the source code for your project page to see your template edits.

You can see it on my sites:

http://www.vbclassified.com/project.php?do=issuelist&projectid=1&issuetypeid=feature

and

http://www.timeshareforums.com/forums/project.php?do=issuelist&projectid=2&issuetypeid=bug

Delphiprogrammi
08-20-2007, 06:27 AM
hi,

I would have been much easier if you could use the cpcolorpicker popup to select a color value hex instead of having to surf seperated websites all the time when you need one.I know it has something todo with these vBulletin stuff


/clientscript/vbulletin_cpcolorpicker.js
construct_color_picker();
construct_color_row();


the last function should return an input row with a color widget next to it you can double click and that should invoke the colorpickerpopup but i can't get it to work anybody knows how to get it ?

Delphiprogrammi
08-21-2007, 01:29 PM
hi,

We are getting there i just keep on getting a javascript error when i click the button that should popup a DHTML popup colorpicker but i will see if i can find the problem ...

Edit:in firefox the colorpicker is showing but when you click a color nothing happens ... allright one step at a time lol

Delphiprogrammi
08-22-2007, 08:48 AM
hi,

IT IS WORKING !!!!!!!!!! look in the screenshot (attched to this post) click that small area next to the input field will bring up vBulletin cpcolorpicker.I managed to "integrate" it into Project Tools.I don't know if i will share it through :p

Delphiprogrammi
08-23-2007, 01:26 PM
actually you can kill one more file edit ....

hook:issuestatusdata_start

code


$this->validfields['background'] = array(TYPE_STR,REQ_NO);


that will kill the class_dm_pt_issuestatus.php edit

Delphiprogrammi
08-23-2007, 07:50 PM
hi,

To get the vBulletin default colorpicker working in the Porject Tools admin page (project.php) you need

edit

step 1

open /admincp/project.php and find


print_cp_header($vbphrase['project_tools']);


replace with


print_cp_header($vbphrase['project_tools'],'init_color_preview()');
?>
<script type="text/javascript" src="../clientscript/vbulletin_cpcolorpicker.js"></script>
<?php


step 2

find (and remove this line)


print_input_row($vbphrase['background_color'],'background',$issuestatus['background'],true,5);


step 3

find this line


print_yes_no_row($vbphrase['can_create_petitions_from_this_status'], 'canpetitionfrom', $issuestatus['canpetitionfrom']);


below that add this


require_once(DIR . '/includes/adminfunctions_template.php');
$colorPicker = construct_color_picker(11);
echo "<tr>
<td class=\"alt1\">$vbphrase[background_color]</td>
<td class=\"alt1\">
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
<tr>
<td><input type=\"text\" class=\"bginput\" name=\"background\" id=\"color_0\" value=\"{$issuestatus['background']}\" title=\"background\" tabindex=\"1\" size=\"22\" onchange=\"preview_color(0)\" dir=\"ltr\" />&nbsp;</td>
<td><div id=\"preview_0\" class=\"colorpreview\" onclick=\"open_color_picker(0, event)\"></div></td>
</tr>
</table>
</td>
</tr>\n";


step 4

find this lines


construct_hidden_code('issuestatusid', $issuestatus['issuestatusid']);
print_submit_row();


below that add


echo $colorPicker;
?>
<script type="text/javascript">
<!--
var bburl = "<?php echo $vbulletin->options['bburl']; ?>/";
var cpstylefolder = "<?php echo $vbulletin->options['cpstylefolder']; ?>";
var numColors = 1;
var colorPickerWidth = <?php echo intval($colorPickerWidth); ?>;
var colorPickerType = <?php echo intval($colorPickerType); ?>;
//-->
</script>
<?php


that should do it

Quarterbore
08-24-2007, 01:18 AM
Thanks for working on this... I wanted to work on it as well before I left for a trip but I ran out of time. I will help (if you need it) when I get back next week.

Quarterbore
08-26-2007, 10:43 PM
I am just getting home from a trip so it will take me a while to get back into a routein that I can fight with this... I have added Delphiprogrammi as a Co-Author!

EDIT:

OK, I am not sure this is all of the edits but it should be... this will add a small table to the main issue status listing so that the colors for each status will be displayed.

All of these edits are in Admin/project.php

FIND:

print_cells_row(array(
'<span class="normal">' . $vbphrase['status'] . '</span>',
'<span class="normal">' . $vbphrase['display_order'] . '</span>',
'<b>' . construct_link_code($vbphrase['add_status'], 'project.php?do=statusadd&amp;type=' . $type['issuetypeid']) . '</b>'
), true);


REPLACE WITH:

print_cells_row(array(
'<span class="normal">' . $vbphrase['status'] . '</span>',

'<span class="normal">' . $vbphrase['display_order'] . '</span>',

'<span class="normal">' . $vbphrase['background_color'] . '</span>',

'<b>' . construct_link_code($vbphrase['add_status'], 'project.php?do=statusadd&amp;type=' . $type['issuetypeid']) . '</b>'
), true);

FIND:

print_cells_row(array(
$vbphrase["issuestatus$status[issuestatusid]"],
"<input type=\"text\" class=\"bginput\" name=\"order[$status[issuestatusid]]\" value=\"$status[displayorder]\" tabindex=\"1\" size=\"3\" />",
"<div align=\"$stylevar[right]\" class=\"smallfont\">" .
construct_link_code($vbphrase['edit'], 'project.php?do=statusedit&amp;issuestatusid=' . $status['issuestatusid']) .
construct_link_code($vbphrase['delete'], 'project.php?do=statusdelete&amp;issuestatusid=' . $status['issuestatusid']) .
'</div>'
));

REPLACE WITH:

print_cells_row(array(
$vbphrase["issuestatus$status[issuestatusid]"],
"<input type=\"text\" class=\"bginput\" name=\"order[$status[issuestatusid]]\" value=\"$status[displayorder]\" tabindex=\"1\" size=\"3\" />",
"<table height=\"24\" width=\"85\" cellpadding=\"0\" cellspacing=\"0\" border=\"1\">
<tr><td style=\"background-color: $status[background]\"><font color = \"black\"> $status[background] </font></td>
</tr></table>",
"<div align=\"$stylevar[right]\" class=\"smallfont\">" .
construct_link_code($vbphrase['edit'], 'project.php?do=statusedit&amp;issuestatusid=' . $status['issuestatusid']) .
construct_link_code($vbphrase['delete'], 'project.php?do=statusdelete&amp;issuestatusid=' . $status['issuestatusid']) .
'</div>'
));


FIND:

print_submit_row($vbphrase['save_display_order'], '', 3);

REPLACE WITH:

print_submit_row($vbphrase['save_display_order'], '', 4);

dave_finlayson
08-31-2007, 12:45 PM
Great mod but it doesn't seem to work for search results. Can it be amended to do so?

Delphiprogrammi
08-31-2007, 07:56 PM
Great mod but it doesn't seem to work for search results. Can it be amended to do so?

well i didn't know it didn't worked in search results until i saw your post and i didn't liked it either so here we go to make it work within the search results

1)open hooks_vbprojecttools.xml (/includes/xml folder from the pt distrubution) and find


<hook>projectsearch_results_groupbit</hook>


replace that with


<hook>projectsearch_results_bit</hook>
<hook>projectsearch_results_groupbit</hook>


upload the modified hooks_vbprojecttools.xml to /includes/xml

2)create a new plugin with this information

product: Project Tools Status Colors
hook:projectsearch_results_bit
phpcode

$get_background = $vbulletin->db->query_first("SELECT background FROM " . TABLE_PREFIX . "pt_issuestatus WHERE issuestatusid='{$issue['issuestatusid']}'");
$issue['background'] = $get_background['background'];
active:yes3)edit template pt_searchresultbit and add the background color in all "<td>" tags like this


<td class="alt2" align="center" style="background-color:$issue[background]">


all done

Quarterbore
09-01-2007, 07:04 PM
well i didn't know it didn't worked in search results until i saw your post and i didn't liked it either so here we go to make it work within the search results

<snip>

all done

Great job!

Also a note to anyone else that the hook is already in the search file but there was a known bug in the xml file where the hook location was missed!

Delphiprogrammi
09-02-2007, 11:10 AM
hi,

or you could "kill" the template edits by doing it like this

hook project_issuebit find


$get_background = $vbulletin->db->query_first("SELECT background FROM " . TABLE_PREFIX . "pt_issuestatus WHERE issuestatusid = $issue[issuestatusid] LIMIT 1");
$issue[background] = $get_background[background];


below add


$vbulletin->templatecache['pt_issuebit'] = preg_replace('/<td class=\\\"alt2\\\"/', '<td style=\"background-color:$issue[background]\"', $vbulletin->templatecache['pt_issuebit']);
$vbulletin->templatecache['pt_issuebit'] = preg_replace('/<td class=\\\"alt1\\\"/', '<td style=\"background-color:$issue[background]\"', $vbulletin->templatecache['pt_issuebit']);
$vbulletin->templatecache['pt_issuebit'] = preg_replace('/<td class=\\\"alt2 smallfont\\\"/', '<td style=\"background-color: $issue[background]\" class=\"smallfont\"', $vbulletin->templatecache['pt_issuebit']);
$vbulletin->templatecache['pt_issuebit'] = preg_replace('/<td class=\\\"alt1 smallfont\\\"/', '<td style=\"background-color: $issue[background]\" class=\"smallfont\"', $vbulletin->templatecache['pt_issuebit']);


hook projectsearch_results_bit find


$get_background = $vbulletin->db->query_first("SELECT background FROM " . TABLE_PREFIX . "pt_issuestatus WHERE issuestatusid='{$issue['issuestatusid']}'");
$issue['background'] = $get_background['background'];


below add


$vbulletin->templatecache['pt_searchresultbit'] = preg_replace('/<td class=\\\"alt2\\\"/', '<td style=\"background-color: $issue[background]\"', $vbulletin->templatecache['pt_searchresultbit']);
$vbulletin->templatecache['pt_searchresultbit'] = preg_replace('/<td class=\\\"alt1\\\"/', '<td style=\"background-color: $issue[background]\"', $vbulletin->templatecache['pt_searchresultbit']);
$vbulletin->templatecache['pt_searchresultbit'] = preg_replace('/<td class=\\\"alt2 smallfont\\\"/', '<td style=\"background-color: $issue[background]\" class=\"smallfont\"', $vbulletin->templatecache['pt_searchresultbit']);
$vbulletin->templatecache['pt_searchresultbit'] = preg_replace('/<td class=\\\"alt1 smallfont\\\"/', '<td style=\"background-color: $issue[background]\" class=\"smallfont\"', $vbulletin->templatecache['pt_searchresultbit']);


that should do it

Delphiprogrammi
09-02-2007, 04:36 PM
there is an error in the product uninstall code the MySQL query should be


$db->query_write("ALTER TABLE " . TABLE_PREFIX . "pt_issuestatus DROP background");

yotsume
09-01-2009, 05:10 AM
Does this mod still work with the current version of Project Tools?

yotsume
09-02-2009, 12:51 AM
Sorry I have business to do and need this mod.... so I have to BUMP this question.

Do these edits still work with the current version of Project Tools.

I need to know please. If they do then why now update your description so we dont have to waste time asking such questions. ;)

THANKS!

yotsume
09-08-2009, 04:45 AM
The developer of this seems to be MIA so...

Ok I have now updated this mod to work with the latest version of Project Tools v2.01 and vb3.8.4

There are a ton of extra spaces in the quoted codes which made it a pain in the a$$ to implement all these edits into the latest PT version.

All of these instructions are outdated and usually missing a line here or there when it comes to the instructions labeled: "Find"

When I get a chance I will post clear updated instructions. This mod and all it's extras needs to be included in default PT!

Delphiprogrammi
09-23-2010, 07:38 PM
no this instructions won't work i have the admincp part but i'm having trouble getting the rows colored i'm a coder i hate designing lol

yotsume
09-23-2010, 10:23 PM
no this instructions won't work i have the admincp part but i'm having trouble getting the rows colored i'm a coder i hate designing lol

I recoded this to work with the latest version of Project Tools. (See Screen Shot).

I will post the instructions soon...

Delphiprogrammi
10-16-2010, 03:40 PM
I recoded this to work with the latest version of Project Tools. (See Screen Shot).

I will post the instructions soon...

the new templates are confusing me why the f... did they changed that