Only in build: build
Only in build/cobbler: __init__.pyc
diff -ur old/cobbler/remote.py build/cobbler/remote.py
--- old/cobbler/remote.py	2009-03-30 07:58:28.000000000 +0200
+++ build/cobbler/remote.py	2009-03-30 15:09:26.000000000 +0200
@@ -186,7 +186,7 @@
            logger = self.logger.info
         logger(msg)
 
-    def get_size(self,collection_name,**rest):
+    def get_size(self,collection_name):
         """
         Returns the number of entries in a collection (but not the actual
         collection) for WUI/TUI interfaces that want to paginate the results.
@@ -194,13 +194,11 @@
         data = self.__get_all(collection_name)
         return len(data)
 
-    def __get_all(self,collection_name,page=None,results_per_page=None):
+    def __get_all(self,collection_name):
         """
         Helper method to return all data to the WebUI or another caller
         without going through the process of loading all the data into
         objects and recalculating.  
-
-        Supports pagination for WUI or TUI based interfaces.
         """
 
         # FIXME: a global lock or module around data access loading
@@ -225,25 +223,6 @@
                raise CX("internal error, collection name is %s" % collection_name)
             # FIXME: speed this up
             data = contents.to_datastruct_with_cache()
-            total_items = len(data)
-
-        data.sort(self.__sorter)
-
-        if page is not None and results_per_page is not None:
-            page = int(page)
-            results_per_page = int(results_per_page)
-            if page < 0:
-                return []
-            if results_per_page <= 0:
-                return []
-            start_point = (results_per_page * page)
-            end_point   = (results_per_page * page) + results_per_page
-            if start_point > total_items:
-                start_point = total_items - 1 # correct ???
-            if end_point > total_items:
-                end_point = total_items
-            data = self.xmlrpc_hacks(data[start_point:end_point])
-
         return self.xmlrpc_hacks(data)
 
     def get_kickstart_templates(self,token=None,**rest):
@@ -561,7 +540,7 @@
         return self.__get_all("distro",page,results_per_page)
 
 
-    def __find(self,find_function,criteria={},expand=False,token=None):
+    def __find(self,find_function,criteria={},expand=False,page=None,results_per_page=None,pages=None,token=None):
         name = criteria.get("name",None)
         if name is not None:
             del criteria["name"]
@@ -569,35 +548,77 @@
             data = [x.name for x in find_function(name, True, True, **criteria)]
         else:
             data = [x.to_datastruct_with_cache() for x in find_function(name, True, True, **criteria)]
-        return self.xmlrpc_hacks(data)
+        return data
+                
+    def __paginate(self,data,page=None,results_per_page=None,token=None):
+        default_page = 1
+        default_results_per_page = 5
+        
+        try:
+            page = int(page)
+            if page < 1:
+                page = default_page
+        except:
+            page = default_page
+        try:
+            results_per_page = int(results_per_page)
+            if results_per_page <= 0:
+                results_per_page = default_results_per_page
+        except:
+            results_per_page = default_results_per_page
+                                                                                                                      
+        results = len(data)
+        page = int(page)
+        pages = results / results_per_page
+        if results % results_per_page > 0:
+            pages = pages + 1
+        start_point = (results_per_page * (page-1))
+        end_point   = (results_per_page * (page-1)) + results_per_page
+        if start_point > results:
+            start_point = results - 1
+        if end_point > results:
+            end_point = results
+        data = data[start_point:end_point]
+
+        pageinfo = {
+            'name'    : '$pageinfo$',
+            'page'    : page,
+            'pages'   : pages,
+            'results' : results,
+            'results_per_page' : results_per_page,
+        }
+        data.append(pageinfo)
+        
+        return data
 
-    def find_distro(self,criteria={},expand=False,token=None,**rest):
+    def find_distro(self,criteria={},expand=False,page=None,results_per_page=None,token=None,**rest):
         self._log("find_distro", token=token)
-        # FIXME DEBUG
-        self._log(criteria)
-        data = self.__find(self.api.find_distro,criteria,expand=expand,token=token)
-        # FIXME DEBUG
-        self._log(data)
-        return data
+        if criteria=={}:
+            data = self.__get_all("distro")
+        else:
+            data = self.__find(self.api.find_distro,criteria,expand=expand,token=token)
+        data.sort(self.__sorter)
+        data = self.__paginate(data,page=page,results_per_page=results_per_page)
+        return self.xmlrpc_hacks(data)
 
-    def find_profile(self,criteria={},expand=False,token=None,**rest):
+    def find_profile(self,criteria={},expand=False,page=None,results_per_page=None,token=None,**rest):
         self._log("find_profile", token=token)
-        data = self.__find(self.api.find_profile,criteria,expand=expand,token=token)
+        data = self.__find(self.api.find_profile,criteria,expand=expand,page=page,results_per_page=results_per_page,token=token)
         return data
 
-    def find_system(self,criteria={},expand=False,token=None,**rest):
+    def find_system(self,criteria={},expand=False,page=None,results_per_page=None,token=None,**rest):
         self._log("find_system", token=token)
-        data = self.__find(self.api.find_system,criteria,expand=expand,token=token)
+        data = self.__find(self.api.find_system,criteria,expand=expand,page=page,results_per_page=results_per_page,token=token)
         return data
 
-    def find_repo(self,criteria={},expand=False,token=None,**rest):
+    def find_repo(self,criteria={},expand=False,page=None,results_per_page=None,token=None,**rest):
         self._log("find_repo", token=token)
-        data = self.__find(self.api.find_repo,criteria,expand=expand,token=token)
+        data = self.__find(self.api.find_repo,criteria,expand=expand,page=page,results_per_page=results_per_page,token=token)
         return data
 
-    def find_image(self,criteria={},expand=False,token=None,**rest):
+    def find_image(self,criteria={},expand=False,page=None,results_per_page=None,token=None,**rest):
         self._log("find_image", token=token)
-        data = self.__find(self.api.find_image,criteria,expand=expand,token=token)
+        data = self.__find(self.api.find_image,criteria,expand=expand,page=page,results_per_page=results_per_page,token=token)
         return data
 
     def get_distros_since(self,mtime):
Only in build/cobbler: sub_process.pyc
diff -ur old/cobbler/webui/CobblerWeb.py build/cobbler/webui/CobblerWeb.py
--- old/cobbler/webui/CobblerWeb.py	2009-03-27 14:51:25.000000000 +0100
+++ build/cobbler/webui/CobblerWeb.py	2009-03-30 15:01:17.000000000 +0200
@@ -131,36 +131,40 @@
         return self.__render( 'blank.tmpl', {} )
    
     # ------------------------------------------------------------------------ #
-    # Settings
+    # Common
     # ------------------------------------------------------------------------ #
 
-    # FIXME: does it make sense to be able to edit settings?  Probably not,
-    # as you could disable a lot of functionality if you aren't careful
-    # including your ability to fix it back.
-
-    def settings_view(self,**args):
-        if not self.__xmlrpc_setup():
-            return self.xmlrpc_auth_failure()
-
-        return self.__render( 'item.tmpl', {
-            'item_data': self.remote.get_settings(),
-            'caption':   "Cobbler Settings"
-        } )
+    def __compute_pagination(self,page,results_per_page,collection_type):
+        default_page = 0
+        default_results_per_page = 50
+        total_size = self.remote.get_size(collection_type)
 
-    # ------------------------------------------------------------------------ #
-    # Distributions
-    # ------------------------------------------------------------------------ #
+        try:
+            page = int(page)
+        except:
+            page = default_page
+        try:
+            results_per_page = int(results_per_page)
+        except:
+            results_per_page = default_results_per_page 
 
-    def distro_menu(self,**spam):
-        return self.__render('blank.tmpl',{ 'more_blank' : 1})
+        if page < 0:
+           page = default_page
+        if results_per_page <= 0:
+           results_per_page = default_results_per_page
 
+        pages = total_size / results_per_page
+        return (page, results_per_page, pages)
+    
     def __search_execute(self,what,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None):
         if not self.__xmlrpc_setup():
             return self.xmlrpc_auth_failure()
 
         criteria={}
+        criteriastr=""
         if value1 is not None and value1 != "":
             criteria[key1] = value1.replace('"','')
+            criteriastr="%s%s=%s;" % ( criteriastr, key1, value1 )
         if value2 is not None and value2 != "":
             criteria[key2] = value2.replace('"','')
         if value3 is not None and value3 != "":
@@ -175,7 +179,8 @@
 
         results = []
         if what == "distro":
-            results = params['distros'] = self.remote.find_distro(criteria,True)
+#            results = params['distros'] = self.remote.find_distro(criteria,True)
+            return self.distro_list(criteria=criteriastr)
         elif what == "profile":
             results = params['profiles'] = self.remote.find_profile(criteria,True)
         elif what == "system":
@@ -187,27 +192,11 @@
         else:
             raise "internal error, unknown search type"
 
-
         if len(results) > 0:
             return self.__render( "%s_list.tmpl" % what, params)
         else:
             return self.__render('empty.tmpl', { 'search' : 1 })  
    
-    def distro_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
-        return self.__search_execute("distro",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
-
-    def profile_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
-        return self.__search_execute("profile",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
-
-    def system_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
-        return self.__search_execute("system",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
-
-    def image_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
-        return self.__search_execute("image",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
-
-    def repo_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
-        return self.__search_execute("repo",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
- 
     def __search(self, what):
         caption = ""
         dest = ""
@@ -235,23 +224,71 @@
                 'submit_dest'      : dest
         })
 
+    def distro_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
+        return self.__search_execute("distro",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
+
+    def profile_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
+        return self.__search_execute("profile",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
+
+    def system_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
+        return self.__search_execute("system",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
+
+    def image_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
+        return self.__search_execute("image",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
+
+    def repo_search_execute(self,key1=None,value1=None,key2=None,value2=None,key3=None,value3=None,key4=None,value4=None,key5=None,value5=None,**rest):
+        return self.__search_execute("repo",key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
+ 
+
+    # ------------------------------------------------------------------------ #
+    # Settings
+    # ------------------------------------------------------------------------ #
+
+    # FIXME: does it make sense to be able to edit settings?  Probably not,
+    # as you could disable a lot of functionality if you aren't careful
+    # including your ability to fix it back.
+
+    def settings_view(self,**args):
+        if not self.__xmlrpc_setup():
+            return self.xmlrpc_auth_failure()
+
+        return self.__render( 'item.tmpl', {
+            'item_data': self.remote.get_settings(),
+            'caption':   "Cobbler Settings"
+        } )
+
+    # ------------------------------------------------------------------------ #
+    # Distributions
+    # ------------------------------------------------------------------------ #
+
+    def distro_menu(self,**spam):
+        return self.__render('blank.tmpl',{ 'more_blank' : 1})
+
     def distro_search(self,**spam):
         return self.__search('distro')
  
-    def distro_list(self,page=None,limit=None,**spam):
+    def distro_list(self,criteria=None,page=None,limit=None,**spam):
         if not self.__xmlrpc_setup():
             return self.xmlrpc_auth_failure()
 
-        (page, results_per_page, pages) = self.__compute_pagination(page,limit,"distro")
-        distros = self.remote.get_distros(page,results_per_page)
-
+        criteria_dict={}
+        if criteria is not None:
+            for c in criteria.split(';'):
+                ckv=c.split('=')
+                if len(ckv)==2:
+                    criteria_dict[ckv[0]]=ckv[1]
+        distros = self.remote.find_distro(criteria_dict,True,page,limit)
+                
+        pageinfo = distros[-1]
+        if pageinfo["name"] == "$pageinfo$":
+            distros.pop()
+        else:
+            pageinfo = {}
+        
+        pageinfo['criteria']=criteria
+        pageinfo['distros']=distros
         if len(distros) > 0:
-            return self.__render( 'distro_list.tmpl', {
-                'distros'          : distros,
-                'pages'            : pages,
-                'page'             : page,
-                'results_per_page' : results_per_page
-            })
+            return self.__render('distro_list.tmpl', pageinfo)
         else:
             return self.__render('empty.tmpl', {})  
   
@@ -369,29 +406,6 @@
     # if the system list is huge, this will probably need to use an
     # iterator so the list doesn't get copied around
 
-    def __compute_pagination(self,page,results_per_page,collection_type):
-
-        default_page = 0
-        default_results_per_page = 50
-        total_size = self.remote.get_size(collection_type)
-
-        try:
-            page = int(page)
-        except:
-            page = default_page
-        try:
-            results_per_page = int(results_per_page)
-        except:
-            results_per_page = default_results_per_page 
-
-        if page < 0:
-           page = default_page
-        if results_per_page <= 0:
-           results_per_page = default_results_per_page
-
-        pages = total_size / results_per_page
-        return (page, results_per_page, pages)
-    
     def system_menu(self,**spam):
         return self.__render('blank.tmpl',{ 'more_blank' : 1})
         
@@ -416,6 +430,7 @@
             return self.__render('empty.tmpl',{})
 
 
+
     def system_list_action(self,actionname=None,targetlist=None,**args):
         if not self.__xmlrpc_setup():
             return self.xmlrpc_auth_failure()
Only in build/cobbler/webui: master.py
Only in build/config: modules.conf
Only in build/config: settings
Only in build/config: version
Only in build/docs: cobbler.1.gz
Only in build/docs: cobbler.html
Only in build: pod2htmd.tmp
Only in build: pod2htmi.tmp
diff -ur old/webui_templates/paginate.tmpl build/webui_templates/paginate.tmpl
--- old/webui_templates/paginate.tmpl	2009-03-27 14:51:25.000000000 +0100
+++ build/webui_templates/paginate.tmpl	2009-03-30 15:15:05.000000000 +0200
@@ -2,27 +2,27 @@
     ## USAGE:  # set global what="system" 
     ##         # include "/path/to/this/file"
 
-    #if $page != 0
+    #if $page != 1
        #set $previous_page = $page - 1
-       <A HREF="${base_url}?mode=${what}_list&page=${previous_page}&limit=${results_per_page}">&lt;</A>&nbsp;
+       <A HREF="${base_url}?mode=${what}_list&page=${previous_page}&limit=${results_per_page}&criteria=${criteria}">&lt;</A>&nbsp;
     #else
        &lt; 
     #end if
 
     <select onchange="location = this.options[this.selectedIndex].value;">
-    #for $this_page in range(0,$pages+1)
+    #for $this_page in range(1,$pages+1)
        #if $this_page != $page
            #set doselect = " "
        #else
            #set doselect = " selected " 
        #end if
-       <option value="${base_url}?mode=${what}_list&page=${this_page}&limit=${results_per_page}" ${doselect} >Page ${this_page}</option>
+       <option value="${base_url}?mode=${what}_list&page=${this_page}&limit=${results_per_page}&criteria=${criteria}" ${doselect} >Page ${this_page}</option>
     #end for
     </select>
 
     #if $page != $pages
        #set $next_page = $page + 1
-       <A HREF="${base_url}?mode=${what}_list&page=${next_page}&limit=${results_per_page}">&gt;</A>
+       <A HREF="${base_url}?mode=${what}_list&page=${next_page}&limit=${results_per_page}&criteria=${criteria}">&gt;</A>
     #else
        &gt;
     #end if
