1) every prisoner uses the same entry (with the same reference frame in respect to boxes)
2) there are no changes in the arrangement of boxes between prisoner visits (this is extra requirement, as it includes wardens not doing any rearrangements in the meanwhile)
But otherwise, the strategy could be extended for arbitrary topologies - just state additional algorithm for defining starting point of labeling and then use a deterministic rule telling which box would be the next one.
For example, for circular arrangement - start at 12:00 and go clockwise.
Or, for arbitrary random arrangement - start at upper left box and then proceed in (axis-aligned) grid: leftmost->rightmost->down to next leftmost->repeat.
I figured a straight line would be equivalent to a random arrangement with each of the boxes being numbered, so I assumed the vagueness was designed to lead one into making a foolish assumption about their ordinal presentation. Maybe I'm paranoid :-)
Deleted comment
If you think there's something wrong with the solution provided, why not just come out with it, and write "SPOILER WARNING" before it? I suspect you're misunderstanding something, though.