Archive for Steve

author photo

I'm currently administering and providing content for our new Wiki at http://www.insightsfour51.com/wiki

Internet Explorer 8 & Developer Tools

For a long time I’ve touted the beauty of Firefox’s Firebug plug in. It was revolutionary for JavaScript developers. If you weren’t using it, you weren’t doing it right. After the last release it was time to upgrade IE to version 8, and one of the biggest things I wanted to check out were the new developer tools. I’ve spent some time using them this morning and my first impression is pure elation.

Anyone that has written JavaScript knows how difficult it can be making that code work in every browser. Debugging your code in those browsers was painful without tools like Firebug. Still, all too often you’d get everything working really well only to find that IE wasn’t happy with your work. I’d say this has caused me to go bald, but that happened way too long ago.

The new IE Developer Tools are simply amazing. They’ve incorporated nearly everything that Firebug offered (it is missing hover over variables) and I think they’ve improved on the user interface. Plus, Firebug development has slacked in keeping up with Firefox upgrades and still has some very annoying bugs. I am contemplating switching over to IE8 for my primary JavaScript development environment and I honestly am surprised I’m writing that.

I urge each of you that follow this section of the blog to try out the new tools for yourself.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 31%

  • Share/Bookmark

Using Custom User Fields

Our latest release included a feature that many customer have asked for, custom user fields. This feature allows you to create new fields and assign them to your buyer companies, groups and users. If you allow your user’s to edit the fields they will be displayed in their self admin profile. These field values are available to you as tokens throughout the site. You can reference them in themes, site customization, spec forms and even auto emails. With the explanation of the feature the question then becomes, “What do I do with them?” I want to cover a few ways that they can be used to your benefit.

I want to go beyond the simple “You can use it as a default value” in a spec form. I think that’s understood because you’ve always been able to use those default value tokens before. I’d like to take a different path. I will diagram how you can use custom user fields and tokens to display contact information for their assigned customer service representative on your Home Page.

I’ll first create a new user field named “Rep” and make it a selection type. I’ll set it to display to the user and add some choices for the dropdown and save. Then I’ll assign it to the entire company.

Now, I’ll put the contact information on the home page through the Buyer Site Customization Home Page template. The home page customization looks like this:

[[CustomMessage]]


[[Catalog]]
[[Messages]]
[[Orders]]

What I’ve done first is create a span element that will hold the Rep token value. Giving the span an ID property allows me to reference it in a script easily. I then added a div element to hold the result of the script. It will be what is displayed on the page. Then I add the script. I created a JSON object that holds a key value pair that matches the Customer Service reps in the custom user field with phone numbers. Just a simple example. At this point I declare a variable, “rep”. That variable value points to the span element I created to hold the token. Referencing the innerHTML property returns the value the token renders on the page. Finally, I take the token value, look up the pair in the JSON data object, and write it out to the “ContactInfo” div element so it will display on the Home page.

This example doesn’t hold any real world value. I just want to demonstrate to you how, with some imagination, you can do so many things with the information available to you in the new Custom User Fields. As always, you can go to my demo site play with the example I documented today.

If you have any questions about this blog post, please join us on the forum.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 37%

  • Share/Bookmark

Document Actions Series: ResizePage

Resizing a page is a capability that so many project builders have requested. Generally, there is a better alternative, but if you feel this is the only solution we’ve built a powerful set of document actions that will handle page resizing for you.

I’ve created a demo project that allows for width and height inputs. This is just one example of the 4 types of document actions.

There are 4 different page resize document actions: ResizePage, ResizeWidth, ResizeHeight, ResizePageByPercentage. The demo focuses on the ResizePage action, but the principles are the same.

The first thing to consider is that these actions require proper measurement values. For example, you can define a page size with the following values: Width = 5in, Height = 3in. If the input is not in the proper measurement format an error will be thrown. That’s why the demo uses a dropdown selection. That makes enforcement of those measurement formats easy.

Another major factor to consider is that these actions ONLY resize the page. Not the objects on the page. If that’s an issue you will have to ensure you’ve set all your project elements to flex appropriately. In the demo each element has many flex and copy fit rules applied. It will render correctly with any dimensions that are chosen.

I’ll repeat that these actions are most likely never the best solution for your products. They have a great probability of formatting your output incorrectly and without warning. The more content on a document the more likely it is there will be problems. I almost always recommend using multiple projects and or variable documents.

I have set up a demo product named “Documents Actions ResizePage”. Go to the site to see it in action, and also download the project files I created.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 85%

  • Share/Bookmark

Document Actions Series: ScaleImageToFill

Image scaling, in your Pageflex projects, has steadily improved over time. After beginning with just “Fit Width” and “Fit Height”, we now have options such as “Scale to Fit”. Usually, these options are enough to guarantee your printed product output renders well. However, there are complications that arise when the user is allowed to upload their own photo. Ensuring ratios are met and applied with the built in image scaling options can frequently be troublesome. Knowing these complications, Pageflex built and released a new document action that will solve many of these problems.

Using the published document action from Pageflex, I changed some of the functionality and imported it into the Four51 Document Actions library. The goal was to make it more flexible and targeted, as well as work more similarly to the existing actions in the library. Due to the unique nature of this document action I thought a blog post was in order. Of course, you should use the wiki as a reference guide.

What does this document action actually do? It’s actually pretty simple. First it gathers the size (width and height) of the image and it’s parent (area template). It then compares those sizes to determine the greater difference between the two ratios. If the height ratio is larger then the image will be scaled to the height of the area template, and vice versa for when the width is greater. This scaling will obviously leave the image larger than the area template in which it’s contained, but this is desired. The area template will crop the excess image area, leaving the entire area template filled with the area the image fits.

The anchor point property of the image controls how the image will be cropped. If the anchor point is set to Center/Middle it will be cropped evenly on all sides. If the anchor point is set to Left/Top the image will be cropped on the right and bottom.

Special recognition for this solution goes to Pageflex. It was their idea and source code that forms the basis for this offering.

This document action example can be viewed and downloaded at the demo site. The product is named “Documents Actions Scale Image To Fill”.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 92%

  • Share/Bookmark

Document Actions Series: Text Manipulation

As I sit here watching out my windows and seeing snow fall, in early November, I can’t but think of the “The Ice Bowl”. This obviously lead me to think the NFL’s trademark rights and how that might need to be controlled in their marketing and branding world. I’ll use that as an example today. The basic premise is that the ™ symbol should be inserted after the letters “NFL” are printed on the page.

I’ll use a combination of 2 different document actions (ReplaceText, Superscript). The project requires only one variable: Text. Text must be set as Formatted Text kind.

First, I’ll create the ReplaceText action. This action does precisely what the name suggests. It takes a character set to find, and when found replaces that text with another set of characters. In this case I’m looking for “NFL” so that I can replace it with NFL™. Here is the document action definition:

Method: ReplaceText
Arguments:
SpecName (contstant) = Text
OldCharacter (Constant) = NFL
NewCharacters (constant) = NFL™

Secondly, I’ll demonstrate the use of the Superscript action. While it’s not necessary in this example I wanted to show how it can be used, even in conjunction with another document action. Here is the document action definition:

Method: Superscript
Arguments:
SpecName (constant) = Text
Character (constant) = ™

Pretty simple example, but one that I think translates into real world project needs. I suggest you follow this up by reading on the GetPositionIndex action as well as Suffix and Prefix. They are closely related to the actions discussed in this post.

This document action chaining example can be views and downloaded at the demo site. The product is named “Documents Actions Calculations”.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 86%

  • Share/Bookmark

Document Actions Series: Calculations

When discussing the Four51 Action library I strive to create relevant examples that match real world scenarios you may encounter in your own departments. In this calculation example I first thought I’d do a mortgage calculator. Then I realized that it would be extremely difficult to convey in a blog post and who’s getting mortgage loans in this credit crisis anyway. So, instead I’ll keep the calculation simple while still demonstrating the concept of chaining.

The formula is quite simple: (x * y) / z = Sum. So we have three numerators and two calculations to perform to reach our sum. This requires we use 2 document actions: Multiply and Divide. The key to accuracy is the order in which we list our document actions.

First, we’ll create the Multiply action. Take note that the SpecName argument is a constant type. We are assigning a value to a variable, so we must type the name of that variable as the argument value.

Method: Mutiply
Arguments:
NumberA (variable) =
NumberB (variable) =
SpecName (constant) = _x_y

Lastly, we’ll take the sum of the multiple operation and Divide it by the z value. Notice in this action we are using the value assigned to the _x_y variable by referring to the variable.

Method: Divide
Arguments:
NumberA (variable) = <_x_y>
NumberB (variable) =
SpecName (constant) = Sum

And we’re done. You can put the Sum variable anywhere in your template file and the calculated value will print. I didn’t demonstrate the formatting capabilities, but you should play with them. They are quite powerful.

This document action chaining example can be viewed and downloaded at the demo site. The product is named “Documents Actions Calculations“.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 54%

  • Share/Bookmark

Document Actions Series: SelectImage

Well, document actions have been live for over a week now. Have you examined the new capabilities? The benefits are worth the learning curve. You’ll find yourself so much more productive, creative, and responsive to your customers. I’m starting this series on document actions to help with the learning curve and hopefully open the creative process in your own world.

Today’s demo of SelectImage will combine capabilities of some spec form scripting along with the document action. I’m trying to cover a scenario I think is widely used throughout Four51.

The idea is to present a dropdown of choices to the user. Once a choice is made an in-form preview of the image will be displayed. Once the user saves the variant the SelectImage document action will retrieve the correct image for rendering. Utilizing the document action eliminates the need to create a cumbersome rule, and I’ll show you how to set the project up in a way that allows you to quickly add new options without having to edit your project and template files.

Let’s start with the template file. I’m going to keep the demo simple by only placing a new image element in the center of the template. Then, using the element properties I’m going to give it a name: Jersey. The name property is available in the “Info” tab of the properties window.

Next, I want to create two variables in the project file: ImageChoice, Images. Both variables are constant plain text types.

The last task within the project files is to create the jobs and define the document action. I’ll only cover the arguments because you should be familiar with adding a document action by now. The SelectImage action has 4 arguments: ImageElement, Case, SourceArray, ErrorMessage.

  • The ImageElement is looking for the name of the element that will get the image assignment. Remember above that we named the element “Jersey”, so we’ll just keep the value type Constant and type “Jersey” into the vaue field.
  • The Case argument is the value indicator. Meaning that the selection value should be applied to this argument. In our demo that value is the ImageChoice variable, so I set the Value Type to Variable and then select the variable from the list.
  • The SourceArray is the array of image choices. They are essentially key value pairs. There is a key (dropdown text) and a value (image) in each pair. The keys should exist in our dropdown options and the values should match images in the project image folder. I’m going to choose Variable Value Type and select the Images variable from the list as the argument value. This is what will allow you to add new options without needing to edit your project files.
  • Now that our project is complete and we’ve created the product on Four51, let’s set up the spec form and script.

    First, the variable import for ImageChoice will be defaulted as text, but we want to make it a selection and add our choices: Green Bay, Indianapolis, Tennessee. For ease of reading I’m setting the Image variable to have 10 lines and 5000 characters. I’m also setting the default to the SourceArray value. This is the key to the update without touching the project file.
    {Green Bay=gbhome.jpg}
    {Indianapolis=indyhome.jpg}
    {Tennessee=tenhome.jpg}

    The spec form has little change to the default. I’m basically adding an image html element (id = preview) for the in-form preview:

    ImageChoice [[ImageChoice]]
    Images [[Images]]


    Lastly, we’ll write our script for previewing the image. You’ve seen this before so I won’t go into great detail:


    var preview = get('preview');
    var image_choice = spec['ImageChoice'];
    var path = "http://www.four51.com/Themes/Custom/de891832-01b5-4c5d-84da-b4f85e394864/demo/jerseys/";

    var images = {
    "Green Bay": "gbhome.jpg",
    "Indianapolis": "indyhome.gif",
    "Tennessee": "tenhome.jpg"
    }

    function Display() {
    preview.imgSrc(path + images[image_choice.selectedText()]);
    }

    image_choice.onchange = Display;
    image_choice.removeOption(0);
    // Normally I'd hide this variable, but I'm leaving it visible for the demo.
    //spec['Images'].hide();
    Display();

    You can see the comment regarding leaving the Images variable visible. I wouldn’t want a customer to see this obviously, but I’m leaving it for the demo.

    Now that we’re done setting up the product you can continually add new image options by simply updating the options in the two variable. Your project is equipped to handle that without intervention.

    I have set up a demo product named “Documents Actions Select Image“. Go to the site to see it in action, and also download the project files I created.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 46%

  • Share/Bookmark

Pageflex Upgrade Supplement

Hopefully you’ve received an invite to our Pageflex upgrade webinar. If not, the information to attend is here. If you create or manage variable products on Four51, you do not want to miss this demo. There are some amazing new features you will want to take advantage of in your products.

I’m going to supplement that demo with a few additional pieces of information. We’ve created a Four51 App Exchange wiki. I want to answer some expected questions regarding the Four51 Toolbar, and I’ll demonstrate a document action that I believe will be very popular.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 43%

  • Share/Bookmark

Advanced Technology: Defined Drop Downs

A recent forum post alerted me to the fact that I had not covered defined drop downs in the blog. I don’t know how I let that slip by. I created them to alleviate some very annoying situations that probably occur too many times to count. Basically, defined drop downs automatically populate the list with a list of companies or states so you don’t have to do it yourself.

As I said above, there are two definitions available: Countries, States. Only those two now because I reference the list we already use in the site, and I couldn’t think of any other consistent lists that are used frequently.

The defined drop downs widget is another of the type that allows you to define it in your HTML instead of scripting. It’s extremely simple to use:
Just create a span element and assign a class name corresponding to the list you want. The default usage displays the full name of the item, but records the abbreviation as the value. For example, Minnesota = MN.

Now, you know it doesn’t end there. We had to add some fanciness and flexibility. You have to use scripting to take advantage of those capabilities.
spec['States'].statedropdown({displayType: "abbr"});
spec['States'].statedropdown.onChange = function() {
alert('You chose: ' + this.selectedText() + ' and the value is: ' + this.selectedValue());
}
This code example defines the drop down as a list of states, but the display is the abbreviation rather than the full name. Additionally, whenever an item in chosen in the drop down, the browser will pop up an alert showing what was chosen.

There are additional properties and events available that you can read about in the Spec Form API documentation. You can go to my demo site to find the “Spec Form API Playground.” I’ve added an example of both types of DefinedDropDowns.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 14%

  • Share/Bookmark

Advanced Technology: What’s so Funny?

As many of you know, we are going through some font procedure changes. Our rendering servers reached the 8,000 installed font range. I would never have guessed there were that many fonts in the world. We’ve been working very diligently to get this under control and it’s required a tremendous amount of research and evaluation. Plus, we’ve asked a lot from our customers At times it becomes a little overwhelming. That’s why, after having this video sent to me from Drew’s Marketing Minute blog, I thought I’d share with you all for a good laugh.

Happy Monday.

VN:F [1.9.0_1079]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)
Google Buzz

Popularity: 11%

  • Share/Bookmark