--- lise/Extensions/liseScript Kopie.py 2004/04/14 16:37:27 1.1 +++ lise/Extensions/liseScript Kopie.py 2004/04/23 16:25:09 1.2 @@ -3,20 +3,32 @@ import os def liseScript(mainobj, idclicked="0"): """ liseScript """ + pictid = int(idclicked) - 1 if pictid < 0: pictid = 0 session = mainobj.REQUEST.SESSION + pagelist = mainobj.pagelist + pagelistlen = len(pagelist) + openchaplist = session.get("openchaplist", []) newopenchaplist = 0 if len(openchaplist) < 1: newopenchaplist = 1 + for i in pagelist: + if i.level == 0: + openchaplist.append(1) + else: + openchaplist.append(0) + # openchaplist = [] # newopenchaplist = 1 pagelist = mainobj.pagelist filelist = mainobj.filenames + filelistlen = len(filelist) +# baseurl = mainobj.baseurl filelistindex = 0; # fetch the current picture @@ -27,16 +39,22 @@ def liseScript(mainobj, idclicked="0"): else: if IsInt(pagelist[pictid].pictindex): filelistindex = int(pagelist[pictid].pictindex) - pictfile = filelist[filelistindex] + if filelistindex < filelistlen: + pictfile = filelist[filelistindex] + else: + pictfile = 'this_is the_no_fucking_picture_error_from_script_1' else: - pictfile = 'this_is the_no_fucking_picture_error' + pictfile = 'this_is the_no_fucking_picture_error_from_script_2' else: if IsInt(pagelist[pictid].pictindex): filelistindex = int(pagelist[pictid].pictindex) - pictfile = filelist[filelistindex] + if filelistindex < filelistlen: + pictfile = filelist[filelistindex] + else: + pictfile = 'this_is the_no_fucking_picture_error_from_script_3' else: - pictfile = 'this_is the_no_fucking_picture_error' - mainobj.currpict = pictfile + pictfile = 'this_is the_no_fucking_picture_error_from_script_4' + mainobj.currpict = '' thelength = len(pagelist) counter = 0 @@ -45,12 +63,7 @@ def liseScript(mainobj, idclicked="0"): # build the list which is used to open / close the chapters if pagelist[pictid].type == 'C': for i in pagelist: - if newopenchaplist == 1: - if i.level == 0: - openchaplist.append(1) - else: - openchaplist.append(0) - else: + if newopenchaplist == 0: if counter == pictid: currlevel = pagelist[counter + 1].level if openchaplist[counter + 1] == 0: @@ -67,12 +80,13 @@ def liseScript(mainobj, idclicked="0"): break; else: openchaplist[j] = 0 - + counter = counter + 1 +# return str(counter) bid = session.getBrowserIdManager().getBrowserId() - outtext = "" + outtext = "pictnum" + str(pictid) + "
" + "pict: " + pagelist[pictid].picturelink + "
" counter = 0 for i in pagelist: if openchaplist[counter] == 1: