+int CompareRoomListByFloorRoomPrivFirstRev(const void *room1, const void *room2)
+{
+ folder *r1 = (folder*) GetSearchPayload(room1);
+ folder *r2 = (folder*) GetSearchPayload(room2);
+
+ /**
+ * are we on the same floor? else sort by floor.
+ */
+ if (r2->Floor != r1->Floor)
+ {
+ /**
+ * the private rooms are first in any case.
+ */
+ if (r1->Floor->ID == VIRTUAL_MY_FLOOR)
+ return -1;
+ if (r2->Floor->ID == VIRTUAL_MY_FLOOR)
+ return 1;
+ /**
+ * else decide alpaheticaly by floorname
+ */
+
+ return (r1->Floor->AlphaN < r2->Floor->AlphaN)? 1 : -1;
+ }
+
+ /**
+ * if we have different levels of subdirectories,
+ * we want the toplevel to be first, regardless of sort
+ * sequence.
+ */
+ if (((r1->nRoomNameParts > 1) ||
+ (r2->nRoomNameParts > 1) )&&
+ (r1->nRoomNameParts != r2->nRoomNameParts))
+ {
+ int i, ret;
+ int nparts = (r1->nRoomNameParts > r2->nRoomNameParts)?
+ r2->nRoomNameParts : r1->nRoomNameParts;
+
+ for (i=0; i < nparts; i++)
+ {
+ /**
+ * special cases if one room is top-level...
+ */
+ if (r2->nRoomNameParts == 1)
+ ret = strcmp (ChrPtr(r2->name),
+ ChrPtr(r1->RoomNameParts[i]));
+ else if (r1->nRoomNameParts == 1)
+ ret = strcmp (ChrPtr(r2->RoomNameParts[i]),
+ ChrPtr(r1->name));
+ else
+ ret = strcmp (ChrPtr(r2->RoomNameParts[i]),
+ ChrPtr(r1->RoomNameParts[i]));
+ /**
+ * Deltas in common parts? exit here.
+ */
+ if (ret != 0)
+ return ret;
+ }
+
+ /**
+ * who's a subdirectory of whom?
+ */
+ if (r1->nRoomNameParts > r2->nRoomNameParts)
+ return 1;
+ else
+ return -1;
+ }
+
+ return strcmp (ChrPtr(r2->name),
+ ChrPtr(r1->name));
+}
+
+int GroupchangeRoomListByFloorRoomPrivFirst(const void *room1, const void *room2)
+{
+ folder *r1 = (folder*) room1;
+ folder *r2 = (folder*) room2;
+
+
+ if (r1->Floor == r2->Floor)
+ return 0;
+ else
+ {
+ wcsession *WCC = WC;
+ static int columns = 3;
+ int boxes_per_column = 0;
+ int nf;
+
+ nf = GetCount(WCC->Floors);
+ while (nf % columns != 0) ++nf;
+ boxes_per_column = (nf / columns);
+ if (boxes_per_column < 1)
+ boxes_per_column = 1;
+ if (r1->Floor->AlphaN % boxes_per_column == 0)
+ return 2;
+ else
+ return 1;
+/// wprintf("</td><td valign=top>\n");
+ }
+}
+
+
+
+