CVS: tmda-cgi PendList.py,1.17,1.18

Jim Ramsay <[email protected]>
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda-cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv17876

Modified Files:
	PendList.py 
Log Message:
Added variable "PageRange" variable (N of X) so it can be added to templates if wanted


Index: PendList.py
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/PendList.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- PendList.py	22 May 2003 17:05:57 -0000	1.17
+++ PendList.py	22 May 2003 17:44:41 -0000	1.18
@@ -112,7 +112,8 @@
         Queue._addCache(Msg)
         Queue._saveCache()
   if FirstMsg >= len(Msgs):
-    FirstMsg = len(Msgs) - int(PVars[("PendingList", "PagerSize")])
+    FirstMsg = len(Msgs) - \
+               (len(Msgs) % int(PVars[("PendingList", "PagerSize")]) )
   if FirstMsg < 0:
     FirstMsg = 0
   if len(Msgs) <= int(PVars[("PendingList", "PagerSize")]):
@@ -122,8 +123,11 @@
     LastMsg = len(Msgs)
   if len(Msgs):
     T["DispRange"] = "%d-%d of %d" % (FirstMsg + 1, LastMsg, len(Msgs))
-    # TODO: page numbering
-    T["PageRange"] = "n of x"
+    numPages = len(Msgs) / int(PVars[("PendingList", "PagerSize")])
+    if len(Msgs) % int(PVars[("PendingList", "PagerSize")]) > 0:
+      numPages += 1
+    pageNum = ( FirstMsg / int(PVars[("PendingList", "PagerSize")]) ) + 1
+    T["PageRange"] = "%d of %d" % ( pageNum, numPages )
 
     # Grey out the first & prev buttons?
     if FirstMsg == 0:

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.