The Paperless Era is Here

May 29, 2014

Whether you like it or not, the world is slowly inching towards a paper-free workplace. I’ve been involved in a few projects recently where the entire management team had unanimously decided that they have had enough of binders and wanted to take their documents entirely online! As recently as a few months ago, RefineCo emancipated an entire Board of Directors of a large company from the clutches of 2-pound binders, pens and sticky notes by offering an entirely different way to hold a board meeting — paperless…and they are loving it!

This is nothing new. Companies have been slowly moving their files online for the last decade. I mean, you know that when the US Library of Congress goes digital that paper is really a thing of the past. So what is the big deal? Well there are three important agents of change that are shutting binders all around the world:

1. The Commercialization and Commoditization of the Tablet

Four years ago, Apple took a huge commercial risk by introducing the iPad, which is pretty much the first usable and responsive tablet that was ever created. At the time no one knew how the market would react. Well, as we all know, now everyone has a tablet! What’s more interesting is that it took the commercial world about 2 years to get used to the idea. Now we are seeing tablets pop up all around offices, being used as a standard work tool.

But there is one snag. Tablets are not laptops. Aside from the Microsoft Surface, which is still on trial by the public, you cannot just install Visio and start making diagrams and workflows, etc. These things run different hardware that is very battery friendly. They also have a different input method: your fingers. So, software has to be written with those two factors in mind.

Fortunately, the web consortium (W3C) responded with CSS3/HTML5 and now we have tablet friendly web pages all over the place. If done correctly, these will shrink and fit into any touch device and will be intuitive enough for you to use with just your finger motions. So you see, using a tablet with the right software can eliminate your need to use paper altogether. Both for capturing information…and here comes the segue…for recalling it.

2. Information! Here! Now!

Let’s start with a little history lesson to get some context here. We, as people, don’t know much about the world before roughly 3200 BC. That’s because no one wrote anything down! Yeah, we’ve discovered Mummies and buildings older than that, but we chalk it up to “lost civilizations”, etc. So when people actually began capturing information, this is when humanity as a whole began to accumulate knowledge. Each generation was smarter than the last, and so on. Then another big information revolution happened in the 1930s in Germany. As alluded to by Noam Chomsky in his 1992 book Chronicles of Dissent, Germany was one of the first countries to keep statistics on literally everything you can possibly think of (albeit for the wrong reasons of course). What Mr. Chomsky tells us is that after the war the Americans adopted a similar approach – but used the vital statistics and details for the purpose of improving our quality of life. Today, this is standard procedure in the public sector and with very large organizations.

What about the smaller organizations? The world is becoming more competitive and as the old, tired phrase says, “information is power”, so why are so many small organizations today not collecting statistics about efficiency, process, people, costs, etc. This is where the modern Dashboard and Search comes in. Having your files “digitized” is standard today. Locating and interpreting this information is still somehow a challenge.

Enter SharePoint. You can load it full of files, set up workflows, use FAST/Enterprise Search to index them, and then use an assortment of Dashboards to show you conclusions and trends. It really is just a matter of you deciding what is important, and then like the generations before you, using that information to keep your organization on the right path by making informed decisions that mitigate risk.

So…in case you thought I went off topic, nothing in this section involves paper! Ideally you use your tablet to review trends in your organization, locate the digital file you need, then input/adjust information. No notebook required.

3. Environmental Impact

Paper is expensive. Ink is expensive. Believe it or not, recycling paper is expensive too! The 1990s were all about saving trees, but it really comes down to saving energy by not using printers in general. Not to mention, recycling ink cartridges and even the printers themselves has a significant environmental impact. But this is nothing that you don’t already know.

So let us summarize what we’ve learned: The introduction of tablets helps us with removing the antiquated file and paper-based processes from our organizations. Because we are forward thinking, we can also use it to search, view statistics in the form of dashboards, and enter information right into our application. For that, we need a proper portal (like what SharePoint mostly offers out of box) a well tuned search engine, and all our information and workflows online. All the while, we are saving trees, plastic and energy!

Custom jQuery Confirm Dialog in ASP.NET

May 21, 2014

For one of our new SharePoint modal dialog forms, a button needs to prompt the user whether or not they want to check in a file they are working on. The first solution that comes to mind is JavaScript’s window.confirm dialog box.

<asp:Button
    ID="btnOk"
    runat="server"
    text="OK"
    OnClick="btnOK_Click"
    OnClientClick="return confirm('Do you want to check in?');"/>

The result is a generic dialog that looks different on each browser, does not follow the site’s styling, and has “OK” and “Cancel” buttons when “Yes” and “No” buttons would make more sense. Unfortunately, all of these problems are out of our control.

So what can we do? Make our own using the jQueryUI dialog control!

<asp:Button
    ID="btnOk"
    runat="server"
    text="OK"
    OnClick="btnOk_Click"
    OnClientClick="return confirmCheckIn();"/>

 

function confirmCheckIn() {
    jQuery('<div>')
        .html("<p>Do you want to check in?</p>")
        .dialog({
            autoOpen: true,
            modal: true,
            title: "Check in?",
            buttons: {
                "No": function () {
                    jQuery(this).dialog("close");
                    return false; // don't do stuff
                },
                "Yes": function () {
                    jQuery(this).dialog("close");
                    return true; // do stuff
                }
            },
            close: function () {
                jQuery(this).remove();
                return false; // don't do stuff
            }
        });
}

Now we have a dialog that looks the same across all browsers, matches the site’s styling, and has intuitive “Yes” and “No” buttons.

jquerydialog

The dialog looks great and all, but it doesn’t work correctly. The button’s back-end click handler does not wait for user input before running because the dialog’s “Yes”, “No”, and “close” handlers are implemented through callbacks, and thus, does not stop the execution of JavaScript to wait for user input (whereas window.confirm does).

The solution:

<asp:Button
    ID="btnOk"
    runat="server"
    text="OK"
    OnClick="btnOk_Click"
    OnClientClick="return confirmCheckIn(this);"/>

 

var _confirm = false;

function confirmCheckIn(button) {
    if (_confirm == false) {
        jQuery('<div>')
            .html("<p>Do you want to check in?</p>")
            .dialog({
                autoOpen: true,
                modal: true,
                title: "Check in?",
                buttons: {
                    "No": function () {
                        jQuery(this).dialog("close");
                    },
                    "Yes": function () {
                        jQuery(this).dialog("close");
                        _confirm = true;
                        button.click();
                    }
                },
                close: function () {
                    jQuery(this).remove();
                }
            });
    }

    return _confirm;
}

What’s happening:

  • this is passed into confirmCheckIn() from OnClientClick, so that we have the button object to work with later
  • A variable _confirm is created and is initially set to false
  • The dialog is displayed since _confirm is false
  • false gets returned and prevents the back-end click handler from running

When “Yes” is clicked:

  • The dialog is closed, _confirm is set to true, and a click() is triggered on the button causing confirmCheckIn() to run again
  • This time, _confirm is true so a new dialog does not get shown and true gets returned so the back-end handler can run

When “No” or “close” is clicked:

  • The dialog simply closes

ASP.NET No Postback After File Download in SharePoint

May 15, 2014

We have an ASP Button control in SharePoint that allows the user to download a file. When the button is clicked, the file is written to the page’s response and gets handled by the browser like any other file download.

Response.AddHeader("content-disposition", "attachment; filename= " + Uri.EscapeDataString(file.Name));
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = GetMimeType(file.Name);
Response.WriteFile(Server.MapPath("~/" + file.Name));

The problem was that the form would become completely unresponsive after this button was clicked.

Reason:

SharePoint has a JavaScript variable called _spFormOnSubmitCalled that gets set to true to prevent any further submits. Since our download button does not refresh the page, this variable remains true and thus, causes all other buttons to stop working.

Workaround:

We set this variable back to false in the button’s client click handler:

<asp:Button 
    ID="btnDownload" 
    runat="server" 
    text="Download" 
    OnClientClick="setFormSubmitFalse()" />
function setFormSubmitFalse() {
    setTimeout(function () {
        _spFormOnSubmitCalled = false;
    }, 100);
}

The timeout is needed to ensure that SharePoint first sets _spFormOnSubmitCalled to true, before we set it back to false again.

RefineCo, Inc. Expands Leadership Team and Aligns Organization to Support Growth

May 8, 2014

RefineCo is proud to announce that Shaun Stepanowich has been promoted from Chief Technical Architect to Director, Technology. May 2014 marks Shaun’s two year anniversary with RefineCo. Previously, Shaun worked as an IT Specialist at Fujitsu Consulting and as a Development Department Manager at Rare Method for multiple years. During this time he became a Microsoft Certified Technology Specialist as well as a Certified Scrum Master.

In addition to giving RefineCo’s developers the tools and information they require to deliver first-class solutions to clients, Shaun’s day to day responsibilities now also include guiding RefineCo’s overall technology strategy along with Greg Fleury, CTO. As a RefineCo director, Shaun will also be a member of the company’s management team where he will assist with developing corporate business strategy, processes and procedures.

Eric Veenendaal, CEO, is confident in this promotion as “Shaun has been instrumental in guiding RefineCo’s architectural practice to date and this expanded role is a perfect fit for him. I am also pleased to work with him on a management level as he brings a wealth of experience and insight that will reap benefits to our employees and customers.” Shaun commented, “I am looking forward to some really interesting projects we have lined up this year and continuing to work with the amazing team we have at RefineCo.”