Tuesday, June 30, 2009

Updated the spiceworks helpdesk customization plugin

Just a quick update with the source code. I added a field to the toolbar thanks to Paul_Maxim and now all of those fields are optional. Oh yeah, I separated the css out from the inline styling.

// ==SPICEWORKS-PLUGIN==
// @name Help Desk Customizations Clone
// @description Adds minor enhancements to your Help Desk, including ticket status in the toolbar, colors for past due tickets and private messages, and information on devices in the Related To field.
// @version 0.6
// ==/SPICEWORKS-PLUGIN==

plugin.configure({
settingDefinitions: [
{name:'past_due_color', label:'Past Due Highlight Color', type:'string', defaultValue:'#ffdede', example:'Default: #ffdede'},
{name:'private_note_color', label:'Private Note Color', type:'string', defaultValue:'#cccccc', example:'Default: #cccccc'},
{name:'tickets_open_display', label:'Display Open Tickets', type:'checkbox', defaultValue:true },
{name:'tickets_due_display', label:'Display Past Due Tickets', type:'checkbox', defaultValue:true },
{name:'tickets_unassigned_display', label:'Display Unassigned Tickets', type:'checkbox', defaultValue:true }
]
});

function refreshToolbarTicketInfo(){
// display ticket stats
if (plugin.settings.tickets_open_display || plugin.settings.tickets_due_display || plugin.settings.ticket_unassigned_display){
var displayString = '';

if (plugin.settings.tickets_open_display){
displayString += '<span><strong>Open:</strong> ' + SPICEWORKS.data.Ticket.find('all', {filter:'open'}).length + '</span>';
}
if (plugin.settings.tickets_due_display){
displayString += '<span><strong>Past Due:</strong> ' + SPICEWORKS.data.Ticket.find('all', {filter:'past_due'}).length + '</span>';
}
if (plugin.settings.tickets_unassigned_display){
displayString += '<span><strong>Unassigned:</strong> ' + SPICEWORKS.data.Ticket.find( 'all', {filter:'unassigned'}).length + '</span>';
}

var toolbarTicketInfo = $('main-toolbar').down('span.right span.toolbar_ticket_info');

if (toolbarTicketInfo){
toolbarTicketInfo.remove();
}

$('main-toolbar').down('span.right').insert({top:'<span class="toolbar_ticket_info">' + displayString + '</span>'});
}
}

SPICEWORKS.app.helpdesk.ready(function(){
// set styling
SPICEWORKS.utils.addStyle("\
span.toolbar_ticket_info{margin-right:20px;padding:0 5px;border:1px solid #999;}\
span.toolbar_ticket_info span{margin-right:5px;}\
#related_to_summary{display:none;clear:both;border:1px solid #ccc;padding:10px;margin:5px 0;overflow:hidden;}\
#related_to_summary ul{margin:0;padding:0;text-align:left;}\
#related_to_summary p{float:right;}\
");

// mark past due ticket rows
$('td.past_due').each(function(item){
item.up().setStyle({backgroundColor: plugin.settings.past_due_color});
});

refreshToolbarTicketInfo();

});

SPICEWORKS.app.helpdesk.ticket.closed(function(){
refreshToolbarTicketInfo();
});

SPICEWORKS.app.helpdesk.ticket.ready(function(){
// color private messages
$('li.private').each(function(item){
item.setStyle({backgroundColor: plugin.settings.private_note_color})
});

// add device summary
var deviceLink = $('related_to_property').down('.value a');
if(deviceLink) {
var deviceURL = deviceLink.readAttribute('href');
var startIndex = deviceURL.indexOf('devices/');

if(startIndex != -1) {
var substring = deviceURL.substring(startIndex);
var deviceID = substring.gsub(/[^\d]/, '');
var device = SPICEWORKS.data.Device.find(deviceID);
if(device) {
var displayInfo = '<div id="related_to_summary"><ul>'
var listStyle = '<li>'
if(device.ip_address && !device.ip_address.empty()) {
displayInfo += listStyle + '<strong>IP:</strong> ' + device.ip_address + '</li>';
}
if(device.mac_address && !device.mac_address.empty()) {
displayInfo += listStyle + '<strong>MAC:</strong> ' + device.mac_address + '</li>';
}
if(device.manufacturer && !device.manufacturer.empty()) {
displayInfo += listStyle + '<strong>Vendor:</strong> ' + device.manufacturer + '</li>';
}
if(device.current_user && !device.current_user.empty()) {
displayInfo += listStyle + '<strong>Last Login:</strong> ' + device.current_user + '</li>';
}
if(device.primary_owner_name && !device.primary_owner_name.empty()) {
displayInfo += listStyle + '<strong>Owner:</strong> ' + device.primary_owner_name + '</li>';
}
if(device.asset_tag && !device.asset_tag.empty()) {
displayInfo += listStyle + '<strong>Asset Tag:</strong> ' + device.asset_tag + '</li>';
}
if(device.operating_system && !device.operating_system.empty()) {
displayInfo += listStyle + '<strong>OS:</strong> ' + device.operating_system + '</li>';
}
if(device.serial_number && !device.serial_number.empty()) {
displayInfo += listStyle + '<strong>Serial No:</strong> ' + device.serial_number + '</li>';
}
displayInfo += '</ul><p><a href="#" onclick="new Effect.BlindUp(\'related_to_summary\', {duration:0.20}); return false;">hide</a></p></div>';
$('related_to_section').insert({after: displayInfo});
deviceLink.insert({after: '&nbsp;&nbsp;(<a href="#" onclick="new Effect.BlindDown(\'related_to_summary\', {duration:0.20}); return false;">info</a>)'})
}
}
}
});

Tuesday, June 23, 2009

Cost and Time Estimation

Ibuildings had a great little post on best practices in estimating. I think it is a good lesson for people who are just getting in to running their own business or as a reminder for people who are already. The main points laid out are:
  • Right size your estimating process to the project
  • Use qualified people
  • Constantly monitor your estimates and estimators
  • The estimate is what it is

Follow up: An Open Letter to our Nation's Leadership

I hope this is okay to repost. I feel it is very important so I wanted to give everyone a chance to read it. This is the letter that started the online petition that I posted last week.
I'm a home grown American citizen, 53, registered Democrat all my life. Before the last presidential election I registered as a Republican because I no longer felt the Democratic Party represents my views or works to pursue issues important to me. Now I no longer feel the Republican Party represents my views or works to pursue issues important to me. The fact is I no longer feel any political party or representative in Washington represents my views or works to pursue the issues important to me. There must be someone. Please tell me who you are. Please stand up and tell me that you are there and that you're willing to fight for our Constitution as it was written. Please stand up now. You might ask yourself what my views and issues are that I would horribly feel so disenfranchised by both major political parties. What kind of nut job am I? Will you please tell me?

Well, these are briefly my views and issues for which I seek representation:

One, illegal immigration. I want you to stop coddling illegal immigrants and secure our borders. Close the underground tunnels. Stop the violence and the trafficking in drugs and people. No amnesty, not again. Been there, done that, no resolution. P.S., I'm not a racist. This isn't to be confused with legal immigration.

Two, the TARP bill, I want it repealed and I want no further funding supplied to it. We told you no, but you did it anyway. I want the remaining unfunded 95% repealed. Freeze, repeal.

Three: Czars, I want the circumvention of our checks and balances stopped immediately. Fire the czars. No more czars. Government officials answer to the process, not to the president. Stop trampling on our Constitution and honor it.

Four, cap and trade. The debate on global warming is not over. There is more to say.

Five, universal healthcare. I will not be rushed into another expensive decision. Don't you dare try to pass this in the middle of the night and then go on break. Slow down!

Six, growing government control. I want states rights and sovereignty fully restored. I want less government in my life, not more. Shrink it down. Mind your own business. You have enough to take care of with your real obligations. Why don't you start there.

Seven, ACORN. I do not want ACORN and its affiliates in charge of our 2010 census. I want them investigated. I also do not want mandatory escrow fees contributed to them every time on every real estate deal that closes. Stop the funding to ACORN and its affiliates pending impartial audits and investigations. I do not trust them with taking the census over with our taxpayer money. I don't trust them with our taxpayer money. Face up to the allegations against them and get it resolved before taxpayers get any more involved with them. If it walks like a duck and talks like a duck, hello. Stop protecting your political buddies. You work for us, the people. Investigate.

Eight, redistribution of wealth. No, no, no. I work for my money. It is mine. I have always worked for people with more money than I have because they gave me jobs. That is the only redistribution of wealth that I will support. I never got a job from a poor person. Why do you want me to hate my employers? Why ‑‑ what do you have against shareholders making a profit?

Nine, charitable contributions. Although I never got a job from a poor person, I have helped many in need. Charity belongs in our local communities, where we know our needs best and can use our local talent and our local resources. Butt out, please. We want to do it ourselves.

Ten, corporate bailouts. Knock it off. Sink or swim like the rest of us. If there are hard times ahead, we'll be better off just getting into it and letting the strong survive. Quick and painful. Have you ever ripped off a Band‑Aid? We will pull together. Great things happen in America under great hardship. Give us the chance to innovate. We cannot disappoint you more than you have disappointed us.

Eleven, transparency and accountability. How about it? No, really, how about it? Let's have it. Let's say we give the buzzwords a rest and have some straight honest talk. Please try ‑‑ please stop manipulating and trying to appease me with clever wording. I am not the idiot you obviously take me for. Stop sneaking around and meeting in back rooms making deals with your friends. It will only be a prelude to your criminal investigation. Stop hiding things from me.

Twelve, unprecedented quick spending. Stop it now.

Take a breath. Listen to the people. Let's just slow down and get some input from some nonpoliticians on the subject. Stop making everything an emergency. Stop speed reading our bills into law. I am not an activist. I am not a community organizer. Nor am I a terrorist, a militant or a violent person. I am a parent and a grandparent. I work. I'm busy. I'm busy. I am busy, and I am tired. I thought we elected competent people to take care of the business of government so that we could work, raise our families, pay our bills, have a little recreation, complain about taxes, endure our hardships, pursue our personal goals, cut our lawn, wash our cars on the weekends and be responsible contributing members of society and teach our children to be the same all while living in the home of the free and land of the brave.

I entrusted you with upholding the Constitution. I believed in the checks and balances to keep from getting far off course. What happened? You are very far off course. Do you really think I find humor in the hiring of a speed reader to unintelligently ramble all through a bill that you signed into law without knowing what it contained? I do not. It is a mockery of the responsibility I have entrusted to you. It is a slap in the face. I am not laughing at your arrogance. Why is it that I feel as if you would not trust me to make a single decision about my own life and how I would live it but you should expect that I should trust you with the debt that you have laid on all of us and our children. We did not want the TARP bill. We said no. We would repeal it if we could. I am sure that we still cannot. There is such urgency and recklessness in all of the recent spending.

From my perspective, it seems that all of you have gone insane. I also know that I am far from alone in these feelings. Do you honestly feel that your current pursuits have merit to patriotic Americans? We want it to stop. We want to put the brakes on everything that is being rushed by us and forced upon us. We want our voice back. You have forced us to put our lives on hold to straighten out the mess that you are making. We will have to give up our vacations, our time spent with our children, any relaxation time we may have had and money we cannot afford to spend on you to bring our concerns to Washington. Our president often knows all the right buzzword is unsustainable. Well, no kidding. How many tens of thousands of dollars did the focus group cost to come up with that word? We don't want your overpriced words. Stop treating us like we're morons.

We want all of you to stop focusing on your reelection and do the job we want done, not the job you want done or the job your party wants done. You work for us and at this rate I guarantee you not for long because we are coming. We will be heard and we will be represented. You think we're so busy with our lives that we will never come for you? We are the formerly silent majority, all of us who quietly work , pay taxes, obey the law, vote, save money, keep our noses to the grindstone and we are now looking up at you. You have awakened us, the patriotic spirit so strong and so powerful that it had been sleeping too long. You have pushed us too far. Our numbers are great. They may surprise you. For every one of us who will be there, there will be hundreds more that could not come. Unlike you, we have their trust. We will represent them honestly, rest assured. They will be at the polls on voting day to usher you out of office. We have cancelled vacations. We will use our last few dollars saved. We will find the representation among us and a grassroots campaign will flourish. We didn't ask for this fight. But the gloves are coming off. We do not come in violence, but we are angry. You will represent us or you will be replaced with someone who will. There are candidates among us when hewill rise like a Phoenix from the ashes that you have made of our constitution.

Democrat, Republican, independent, libertarian. Understand this. We don't care. Political parties are meaningless to us. Patriotic Americans are willing to do right by us and our Constitution and that is all that matters to us now. We are going to fire all of you who abuse power and seek more. It is not your power. It is ours and we want it back. We entrusted you with it and you abused it. You are dishonorable. You are dishonest. As Americans we are ashamed of you. You have brought shame to us. If you are not representing the wants and needs of your constituency loudly and consistently, in spite of the objections of your party, you will be fired. Did you hear? We no longer care about your political parties. You need to be loyal to us, not to them. Because we will get you fired and they will not save you. If you do or can represent me, my issues, my views, please stand up. Make your identity known. You need to make some noise about it. Speak up. I need to know who you are. If you do not speak up, you will be herded out with the rest of the sheep and we will replace the whole damn congress if need be one by one. We are coming. Are we coming for you? Who do you represent? What do you represent? Listen. Because we are coming. We the people are coming.

Friday, June 19, 2009

Spiceworks 4.0 released, helpdesk customization plugin updated

I got in to work today and found out that a final version of Spiceworks 4.0 had been released. That was very exciting as they have added a network map and carbon-copying people on helpdesk tickets. Those were the two features that I wanted to add the most. So I went ahead and upgraded my 3.5 installation and everything went as smooth as butter.

I then went and checked my helpdesk and aghhh, the helpdesk customization plugin I helped write was no longer working. That just wouldn't do, so I decided to fix all the things that were broken in it. I also removed the expanding height for the ticket responses box since the height is now liquid with the new version. I also went and shared the new version of the plugin.

It looks like it hasn't been updated with the new release yet and I'm not sure how long it will take, but there is a direct link to the plugin by going here. There is also the new source below. Enjoy.

// ==SPICEWORKS-PLUGIN==
// @name Help Desk Customizations Clone
// @description Adds minor enhancements to your Help Desk, including ticket status in the toolbar, colors for past due tickets and private messages, and information on devices in the Related To field.
// @version 0.4
// ==/SPICEWORKS-PLUGIN==

plugin.configure({
settingDefinitions: [
{name: 'past_due_color', label: 'Past Due Highlight Color', type: 'string', defaultValue: '#ffdede', example: 'Default: #ffdede'},
{name: 'private_note_color', label: 'Private Note Color', type: 'string', defaultValue: '#cccccc', example: 'Default: #cccccc'}
]
});

function refreshToolbarTicketInfo(){
// display ticket stats
var numOpenTickets = SPICEWORKS.data.Ticket.find('all', {filter:'open'}).length;
var numPastDue = SPICEWORKS.data.Ticket.find('all', {filter:'past_due'}).length;

var toolbarTicketInfo = $('main-toolbar').down('span.right span.toolbar_ticket_info');

if (toolbarTicketInfo){
toolbarTicketInfo.remove();
}
$('main-toolbar').down('span.right').insert({top:'<span class="toolbar_ticket_info" style="margin-right: 40px; padding: 0 5px; border: 1px solid #999;"><strong>Open Tickets:</strong> ' + numOpenTickets + '&nbsp;&nbsp;&nbsp;<strong>Past Due:</strong> ' + numPastDue + '</span>'});
}

SPICEWORKS.app.helpdesk.ready(function(){


// mark past due ticket rows
$('td.past_due').each(function(item){
item.up().setStyle({backgroundColor: plugin.settings.past_due_color});
});

refreshToolbarTicketInfo();

});

SPICEWORKS.app.helpdesk.ticket.closed(function(){
refreshToolbarTicketInfo();
});

SPICEWORKS.app.helpdesk.ticket.ready(function(){
// color private messages
$('li.private').each(function(item){
item.setStyle({backgroundColor: plugin.settings.private_note_color})
});

// add device summary
var deviceLink = $('related_to_property').down('.value a');
if(deviceLink) {
var deviceURL = deviceLink.readAttribute('href');
var startIndex = deviceURL.indexOf('devices/');
if(startIndex != -1) {
var substring = deviceURL.substring(startIndex);
var deviceID = substring.gsub(/[^\d]/, '');
var device = SPICEWORKS.data.Device.find(deviceID);
if(device) {
var displayInfo = '<div id="related_to_summary" style="display: none; clear: both; border:1px solid #ccc; padding: 10px; margin: 5px 0; overflow: hidden;"><ul style="margin: 0; padding: 0; text-align: left;">'
var listStyle = '<li>'
if(device.ip_address && !device.ip_address.empty()) {
displayInfo += listStyle + '<strong>IP:</strong> ' + device.ip_address + '</li>';
}
if(device.mac_address && !device.mac_address.empty()) {
displayInfo += listStyle + '<strong>MAC:</strong> ' + device.mac_address + '</li>';
}
if(device.manufacturer && !device.manufacturer.empty()) {
displayInfo += listStyle + '<strong>Vendor:</strong> ' + device.manufacturer + '</li>';
}
if(device.current_user && !device.current_user.empty()) {
displayInfo += listStyle + '<strong>Last Login:</strong> ' + device.current_user + '</li>';
}
if(device.primary_owner_name && !device.primary_owner_name.empty()) {
displayInfo += listStyle + '<strong>Owner:</strong> ' + device.primary_owner_name + '</li>';
}
if(device.asset_tag && !device.asset_tag.empty()) {
displayInfo += listStyle + '<strong>Asset Tag:</strong> ' + device.asset_tag + '</li>';
}
if(device.operating_system && !device.operating_system.empty()) {
displayInfo += listStyle + '<strong>OS:</strong> ' + device.operating_system + '</li>';
}
if(device.serial_number && !device.serial_number.empty()) {
displayInfo += listStyle + '<strong>Serial No:</strong> ' + device.serial_number + '</li>';
}
displayInfo += '</ul><p style="float: right;"><a href="#" onclick="new Effect.BlindUp(\'related_to_summary\', {duration:0.20}); return false;">hide</a></p></div>';
$('related_to_section').insert({after: displayInfo});
deviceLink.insert({after: '&nbsp;&nbsp;(<a href="#" onclick="new Effect.BlindDown(\'related_to_summary\', {duration:0.20}); return false;">info</a>)'})
}
}
}
});

Thursday, June 18, 2009

An Open Letter to our Nation's Leadership - The Petition Site

I found this petition about our government yesterday and thought it was fitting to post for all the people unhappy with OUR government. Be it the Democratic President or Republican Senators or just the laws or stimulus packages that were enacted without even being fully read. The officials we elect are supposed to help us, not help themselves. And I'm fully aware that internet petitions don't really mean anything or do anything, but if it can help spread ideas and get people thinking about how to fix some of the problems in our country, that is even better. I love the United States of American and am proud to be a citizen, and I want to be a part of a better America.

An Open Letter to our Nation's Leadership - The Petition Site

Wednesday, June 10, 2009

I got some swag, contest announcement

Yesterday I got some cool new decals from Tracy Arakaki of PunishUM Motorsports. It is so cool to have these and I thought about putting them on my car, but I don't know if that would do them justice. I have an 1986 RX-7 that is rusting; just not in good shape. Anyway, I put a picture of the decals below.

Speaking of decals, PunishUM is starting to have monthly giveaways just for being a member of their site. This months giveaway is a commemorative final Drift event shirt from the stadium and a limited edition PunishUM window decal.

Friday, June 5, 2009

Always be learning

Today is a wonderful day. Not only is it Friday (casual day at my work) but I got in to work and found an inspirational post by Seth Godin. It was inspirational because it reminds me what I usually think, and that is to try to know as much as possible so that I can make informed decisions. Here is an exerpt:
The second approach is to write it down and not go to bed that night until you know the topic better than the person who brought it up. How else, precisely, are you going to become one of the smart people?
Really, shouldn't everyone try to be smart? That is how we go about advancing our careers. And doesn't it just feel good to know things? I know it does for me.

Tuesday, June 2, 2009

Follow up: jQuery social bookmarking plugin

I just wanted to follow the last post up by saying that the plugin has been added to the jQuery repository and to github's repository.

Monday, June 1, 2009

jQuery social bookmarking plugin

I was just working on trying to get a social bookmarking tool installed on one of my sites and came across two very good ones ShareThis and AddThis. Both seem to be very good but the AddThis tool operates on ssl sites. So, accordingly, I went with AddThis. The plugin code was a little too long for me, an example as follows:


Bookmark and Share



I decided to write a jQuery plugin to leverage simpler code. The following is the plugin jquery.addthis.js:

/*
* Addthis 1.0
* (c)2009 Brent Wong
*/
(function($){
$.addthis = function(code){

function init(){
try{
// determine whether to include the normal or SSL version
var addthisurl = (location.href.indexOf('https') == 0 ? 'https://' : 'http://') + 's7.addthis.com/js/250/addthis_widget.js?pub=' + code;

// include the script
$.getScript(addthisurl, function(){
$('a.addthis').append('<img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/>').attr('href', 'http://www.addthis.com/bookmark.php?v=250').mouseover(
function(){
return addthis_open(this, '', '[URL]', '[TITLE]');
}).mouseout(
function(){
addthis_close();
}).click(
function(){
return addthis_sendto();
});
});
} catch(err) {
// log any failure
console.log('Failed to load AddThis Script:' + err);
}
}

init();
}
})(jQuery);


Then all you have to do is create a link such as this:

<a class="addthis"></a>


And include the jQuery command in the header:

$(function(){
$.addthis('publishername');
});


And voila, you have AddThis links.