Index: WAeUP_SRP/base/skins/waeup_accommodation/acco_folder_view.pt
===================================================================
--- WAeUP_SRP/base/skins/waeup_accommodation/acco_folder_view.pt	(revision 2828)
+++ WAeUP_SRP/base/skins/waeup_accommodation/acco_folder_view.pt	(revision 2845)
@@ -53,7 +53,7 @@
               <strong tal:content="row/title" /></a> </td>
             <td tal:content="row/id"> </td>
-            
+            <td tal:content="row/sort_id"> </td>
             <td> 
-            <a tal:condition="row/is_editable"
+              <a tal:condition="row/is_editable"
                 href="edit" tal:attributes="href string:/${row/url}/external_edit_form"
                 target="edit"
Index: WAeUP_SRP/base/skins/waeup_accommodation/getAccoFolderInfo.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_accommodation/getAccoFolderInfo.py	(revision 2828)
+++ WAeUP_SRP/base/skins/waeup_accommodation/getAccoFolderInfo.py	(revision 2845)
@@ -12,4 +12,9 @@
 return Info about the Accommodation-Folder
 """
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
 request = context.REQUEST
 
@@ -23,15 +28,18 @@
 items = []
 is_editable = mtool.checkPermission('Modify portal content', context)
-is_editable = False
-halls = context.portal_catalog(portal_type='AccoHall')
-for f in halls:
+#is_editable = False
+#halls = context.portal_catalog(portal_type='AccoHall')
+for id,hall in context.objectItems():
+    hall_doc = hall.getContent()
     row = {}
-    row['id'] = f.id
-    row['title'] = f.Title
-    row['url'] = "%s/%s" % (context.absolute_url(),f.id)
+    row['id'] = id
+    row['title'] = hall_doc.Title()
+    row['sort_id'] = getattr(hall_doc,'sort_id',0)
+    row['url'] = "%s/%s" % (context.absolute_url(),id)
     #fo = f.getObject()
     #row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
     row['is_editable'] = is_editable
     items.append(row)
+items.sort(cmp=lambda x,y: cmp( x['sort_id'],y['sort_id']))
 info['items'] = items
 return info
Index: WAeUP_SRP/base/skins/waeup_accommodation/getAccoHallInfo.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_accommodation/getAccoHallInfo.py	(revision 2828)
+++ WAeUP_SRP/base/skins/waeup_accommodation/getAccoHallInfo.py	(revision 2845)
@@ -12,4 +12,11 @@
 return Info about a Accommodation Hall
 """
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+    
+from Products.AdvancedQuery import Eq, Between, Le,In
 
 def cmp_bed(a,b):
@@ -23,5 +30,6 @@
 path_info = request.get('PATH_INFO').split('/')
 mtool = context.portal_membership
-pa = context.portal_accommodation
+portal_accommodation = context.portal_accommodation
+aq_accommodation = portal_accommodation.evalAdvancedQuery
 info = {}
 #dep_id = request.get('PATH_TRANSLATED').split('/')[-2]
@@ -30,16 +38,15 @@
 info['choosen_ids'] = request.get('ids',[])
 info['doc'] = context.getContent()
-bed_types = pa.uniqueValuesFor('bed_type')
+bed_types = portal_accommodation.uniqueValuesFor('bed_type')
 bt_list = []
 bt_names =  context.getBedTypeNames()
-res = pa.uniqueValuesFor('student')
-all_booked = [st for st in res if st]
+res = portal_accommodation.uniqueValuesFor('student')
+all_booked = [st for st in res if st and st != 'not_occupied']
 booked_list = []
-#from Products.zdb import set_trace;set_trace()
 for bt in bed_types:
-    total = len(pa(bed_type=bt,hall=context.getId()))
+    total = len(portal_accommodation(bed_type=bt,hall=context.getId()))
     if total <= 1:
         continue
-    booked = pa.searchResults({'bed_type': bt,
+    booked = portal_accommodation.searchResults({'bed_type': bt,
                                  'student':all_booked,
                                  'hall': context.getId()})
@@ -49,4 +56,18 @@
                     })
     booked_list.extend(booked)
+# query = ~Eq('student','not_occupied') 
+# beds = aq_accommodation(query,sortSpecs=('bed_type',))
+# bt_list = []
+# bt_names =  context.getBedTypeNames()
+# bt = 'xxx' 
+# for bed in beds:
+#     if bt != bed.bed_type:
+#         bt = bed.bed_type
+#         total = len(aq_accommodation(Eq('bed_type',bt)))
+#         bt_list.append({'name': bt_names[bt],
+#                         'total': total,
+#                         'reserved': len(booked),
+#                        })
+      
 info['bed_types'] = bt_list
 res_list = []
