Index: /WAeUP_SRP/trunk/PatchCatalogToolXMLAdapter.py
===================================================================
--- /WAeUP_SRP/trunk/PatchCatalogToolXMLAdapter.py	(revision 1061)
+++ /WAeUP_SRP/trunk/PatchCatalogToolXMLAdapter.py	(revision 1062)
@@ -24,7 +24,11 @@
     na = node.attributes.items()
     not_found = True
-    if na[0][1] == "CMF Catalog":
+    new_indexes = []
+    new_columns = []
+    if na[0][1] in ("WAeUP Table"):
         not_found = False
+    elif na[0][1] == "CMF Catalog":
         #print na[1][1]
+        not_found = False
         for ch in node._get_childNodes():
             if ch.nodeName in ('index',):
@@ -34,4 +38,5 @@
                 if iname in inds.keys() and inds[iname] == itype:
                     continue
+                new_indexes.append(iname)
             elif ch.nodeName in ('column',):
                 cha = ch.attributes.items()
@@ -39,4 +44,5 @@
                 if iname in columns:
                     continue
+                new_columns.append(iname)
             else:
                 continue
Index: /WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTables.py	(revision 1061)
+++ /WAeUP_SRP/trunk/WAeUPTables.py	(revision 1062)
@@ -78,8 +78,27 @@
         for field in self.schema() + self.indexes():
             record_data[field] = getattr(record, field)
+        record_data = {}
+        for field in self.schema() + self.indexes():
+            record_data[field] = getattr(record, field)
         # Add the updated data:
         record_data.update(data)
         self.catalog_object(dict2ob(record_data), uid)
 
+    def reindexIndex(self, name, REQUEST,pghandler=None):
+        if isinstance(name, str):
+            name = (name,)
+        paths = self._catalog.uids.items()
+        i = 0
+        #import pdb;pdb.set_trace()
+        for p,rid in paths:
+            i += 1
+            metadata = self.getMetadataForRID(rid)
+            record_data = {}
+            for field in name:
+                record_data[field] = metadata.get(field)
+            uid = metadata.get(self.key)
+            self.catalog_object(dict2ob(record_data), uid, idxs=name,
+                                update_metadata=0)
+            
     security.declareProtected(ModifyPortalContent,"exportAllRecords")
     def exportAllRecords(self):
Index: /WAeUP_SRP/trunk/profiles/default/accommodation.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/accommodation.xml	(revision 1061)
+++ /WAeUP_SRP/trunk/profiles/default/accommodation.xml	(revision 1062)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
-<object name="portal_catalog" meta_type="CMF Catalog">
+<object name="portal_catalog" meta_type="WAeUP Table">
  <column value="bed"/>
  <column value="bed_type"/>
Index: /WAeUP_SRP/trunk/profiles/default/pins.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/pins.xml	(revision 1061)
+++ /WAeUP_SRP/trunk/profiles/default/pins.xml	(revision 1062)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
-<object name="portal_pins" meta_type="CMF Catalog">
+<object name="portal_pins" meta_type="WAeUP Table">
  <column value="pin"/>
  <column value="student"/>
Index: /WAeUP_SRP/trunk/profiles/default/pumeresults.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/pumeresults.xml	(revision 1061)
+++ /WAeUP_SRP/trunk/profiles/default/pumeresults.xml	(revision 1062)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
-<object name="portal_catalog" meta_type="CMF Catalog">
+<object name="portal_catalog" meta_type="WAeUP Table">
  <column value="jamb_reg_no"/>
  <column value="name"/>
Index: /WAeUP_SRP/trunk/profiles/default/students_catalog.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/students_catalog.xml	(revision 1061)
+++ /WAeUP_SRP/trunk/profiles/default/students_catalog.xml	(revision 1062)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
-<object name="portal_catalog" meta_type="CMF Catalog">
+<object name="portal_catalog" meta_type="WAeUP Table">
  <column value="id"/>
  <column value="jamb_reg_no"/>
Index: /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml	(revision 1061)
+++ /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml	(revision 1062)
@@ -25,10 +25,10 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="pins_view"/>
+ <alias from="(Default)" to="search_pins"/>
  <alias from="create_do" to=""/>
  <alias from="created" to=""/>
- <alias from="view" to="pins_view"/>
+ <alias from="view" to="search_pins"/>
  <action title="View" action_id="view" category="object"
-    condition_expr="" url_expr="string:${object_url}/pins_view"
+    condition_expr="" url_expr="string:${object_url}/search_pins"
     visible="True">
   <permission value="View"/>
Index: /WAeUP_SRP/trunk/skins/waeup_pins/disable_pins.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/disable_pins.py	(revision 1062)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/disable_pins.py	(revision 1062)
@@ -0,0 +1,42 @@
+## Script (Python) "disable_pins"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=REQUEST,ids=[]
+##title=
+##
+# $Id$
+"""
+disable pins
+"""
+import DateTime
+current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
+import logging
+logger = logging.getLogger('getStudentInfo')
+
+request = REQUEST
+wftool = context.portal_workflow
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+#from Products.zdb import set_trace
+#set_trace()
+
+if not ids:
+    return
+
+pincat = context.portal_pins
+for pid in ids:
+    serial,prefix = pid.split("_")
+    res = pincat(prefix_batch=prefix,
+                 serial=int(serial))
+    if len(res) != 1:
+        continue
+    uid = res[0].pin
+    dict = {"pin": uid,
+            "student": "disabled by: %s on %s" % (member,current)
+            }
+    pincat.modifyRecord(**dict)
+    logger.info('"%s","disabled pin","%s"' % (member,uid))
+return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url())
Index: /WAeUP_SRP/trunk/skins/waeup_pins/enable_pins.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/enable_pins.py	(revision 1062)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/enable_pins.py	(revision 1062)
@@ -0,0 +1,45 @@
+## Script (Python) "enable_pins"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=REQUEST,ids=[]
+##title=
+##
+# $Id$
+"""
+enable pins
+"""
+import DateTime
+current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
+import logging
+logger = logging.getLogger('getStudentInfo')
+
+request = REQUEST
+wftool = context.portal_workflow
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+#from Products.zdb import set_trace
+#set_trace()
+
+if not ids:
+    return
+
+pincat = context.portal_pins
+for pid in ids:
+    serial,prefix = pid.split("_")
+    res = pincat(prefix_batch=prefix,
+                 serial=int(serial))
+    if len(res) != 1:
+        continue
+    rec = res[0]
+    uid = rec.pin
+    if not rec.student.startswith('disabled'):
+        continue
+    dict = {"pin": uid,
+            "student": ""
+            }
+    pincat.modifyRecord(**dict)
+    logger.info('"%s","enabled pin","%s"' % (member,pid))
+return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url())
Index: /WAeUP_SRP/trunk/skins/waeup_pins/pins_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/pins_view.pt	(revision 1061)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/pins_view.pt	(revision 1062)
@@ -1,3 +1,7 @@
-<metal:html>
+<metal:html tal:define="info options/info;
+                        rendered options/rendered;
+                        mtool here/portal_membership;
+                        member mtool/getAuthenticatedMember;
+                        ">
   <metal:body use-macro="here/main_template/macros/master">
     <metal:main fill-slot="main">
@@ -5,13 +9,62 @@
       </span>  
       <span tal:condition="not:isAnon">
+        <span tal:replace="structure rendered" />
+      <form action="." method="post">
+        <table>
+          <tr tal:repeat="pin info/used">
+            <td>
+              <input type="checkbox" name="ids:list" value="" id="" class="noborder"
+                     tal:define="id string:${pin/serial}_${pin/prefix}"
+                     tal:attributes="value id;
+                     id python:'cb_' + id;"
+                     />
+            </td>
+            <td width="50px"> <span tal:content="pin/serial" />: </td>
+            <td tal:content="pin/pin" />
+            <td tal:content="pin/student_id" />
+            <td tal:condition="pin/student_url">
+              <a tal:condition="pin/student_url" href="" tal:content="pin/student"
+                 tal:attributes="href pin/student_url"></a>
+              <span tal:condition="not: pin/student_url" tal:content="pin/student" />
+            </td>
+          </tr>
+        </table>
+        <table width="100%" cellspacing="0" cellpadding="2"
+               summary="contents of the folder"
+               class="folderButtons">
+          <tr>
+            <td align="left" valign="top" rowspan="3"></td>
+            <td align="left" valign="top">
+              <input type="submit" name="disable_pins:method" 
+                     value="disable pins"
+                     class="destructive"
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     (cpsmcat('really disable ?'), )" 
+                     />
+            </td>
+            <td align="left" valign="top">
+              <input type="submit" name="enable_pins:method" 
+                     value="enable pins"
+                     class="destructive"
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     (cpsmcat('really enable ?'), )" 
+                     />
+            </td>
+          </tr>
+        </table>
+      </form>
         <h3>PIN Batches</h3>
         <br />
-        <table tal:define="batches python: context.portal_catalog(portal_type='ScratchCardBatch')">
-          <tr tal:repeat="batch batches">
-            <td><a href="batch" 
-                   tal:attributes="href string:${batch/getPath}/search_pins"
-                   tal:content="batch/Title"></a></td>    
-          </tr>
-        </table>
+      <form action="." method="get">
+        <select class="form-element" name=":action" 
+                tal:attributes="onChange string:location.href='${context/absolute_url}/'+this.options[this.selectedIndex].value"
+                >
+          <option value="--">Goto Batch ...</option>
+          <option tal:repeat="batch context/objectIds"
+                  tal:attributes="value batch"
+                  tal:content="batch">
+          </option>
+        </select>
+      </form>
       </span>
     </metal:main>
Index: /WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py	(revision 1061)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py	(revision 1062)
@@ -33,26 +33,37 @@
                       )
 info = {}
-info['batch_doc'] = context.getContent() 
-info['unused'] = info['batch_doc'].getUnusedPins()
 info['used'] = []
-info['nr_used'] = info['batch_doc'].getNumberOfUsedPins()
-
+if context.portal_type == "ScratchCardBatch":
+    info['batch_doc'] = context.getContent() 
+    info['unused'] = info['batch_doc'].getUnusedPins()
+    info['nr_used'] = info['batch_doc'].getNumberOfUsedPins()
+    view = context.batch_view
+elif context.portal_type == "ScratchCardBatchesFolder":
+    view = context.pins_view
 if psm == '':
-    return context.batch_view(rendered = rend,
-                             psm = psm,
-                             #psm = "%s, %s" % (psm,ds),
-                             info = info,
-                             allowed = True,
-                             )
-#set_trace()
+    return view(rendered = rend,
+                psm = psm,
+                #psm = "%s, %s" % (psm,ds),
+                info = info,
+                allowed = True,
+                )
 what = ds.get('search_mode')
 term = ds.get('search_string')
+pincat = context.portal_pins
 if term != "":
     if what == 'student' :
-        items_1 = context.portal_pins(student = term.upper())
-        items_2 = context.portal_pins(student = term.lower())
+        items_1 = pincat(student = term.upper())
+        items_2 = pincat(student = term.lower())
         items = items_1 + items_2
     elif what == 'pin':
-        items = context.portal_pins(pin = term.upper())
+        items = pincat(pin = term.upper())
+    elif what == 'serial':
+        try:
+            snr = int(term.strip())
+            items = pincat(serial = snr)
+        except ValueError:
+            psm = "invalid number"
+            items = []
+            pass
     else:
         items = []
@@ -64,6 +75,10 @@
         sno = i['student']
         item['student'] = sno
+        item['prefix'] = i.prefix_batch
         item['serial'] = i.serial
-        item['pin'] = i.pin
+        if len(sno) > 0:
+            item['pin'] = i.pin
+        else:
+            item['pin'] = "%s%s****%s" % (i.prefix_batch,i.pin[-10:-7],i.pin[-3:])
         if i.pin in pins:
             continue
@@ -73,5 +88,8 @@
             res = context.students_catalog(jamb_reg_no=sno.upper())
             if len(res) > 0:
-                item['student_url'] = "%s/campus/students/%s" % (context.portal_url(),res[0].id)
+                if sno.startswith('disabled'):
+                    item['student_url'] = None
+                else:
+                    item['student_url'] = "%s/campus/students/%s" % (context.portal_url(),res[0].id)
                 item['student_id'] = res[0].id
             else:
@@ -79,6 +97,9 @@
                 item['student_id'] = ''
         elif sno:
-            item['student_url'] = '%s/campus/students/%s' % (students_url,item['student'])
-            item['student_id'] = student
+            if sno.startswith('disabled'):
+                item['student_url'] = None
+            else:
+                item['student_url'] = '%s/campus/students/%s' % (students_url,item['student'])
+            item['student_id'] = item['student']
         else:
             item['student_url'] = ''
@@ -88,8 +109,8 @@
     info['used'] = l
 
-return context.batch_view(rendered = rend,
-                             psm = psm,
-                             #psm = "%s, %s" % (psm,ds),
-                             info = info,
-                             allowed = True,
-                             )
+return view(rendered = rend,
+            psm = psm,
+            #psm = "%s, %s" % (psm,ds),
+            info = info,
+            allowed = True,
+            )
