Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
Books-on-demand
/
latest
/
Upload File :
New :
File
Dir
/home/cluster1/data/bu01/1121861/html/Books-on-demand/latest/README.txt
READ ME ----------------- Here is what I have gotten done. It is a work in progress and I wish I had more time to clean up the files a bit. In any case, here is a quick run down on the system. Story File et al ================= The heart of the system is the way that the story files are laid out. This is pretty much as before except that all the words and their glosses are stored in the words.js file. It looks like this: var words = new Array(); words["o:kipix"] = ["o:+0-k-pix-k", "compl+3sgS-3sgO-pia-perfv.sg", "pia", "Transitive Oapan verb"]; words["wel"] = ["0-wel-k", "3sgS-weli-perfv.sg", "weli", "Intransitive Oapan verb"]; words["xtemo"] = ["x-temo:-0", "imp-temowa-imp.sg", "temowa", "Intransitive Oapan verb"]; words["ona:tli"] = ["n-a:tli-0", "1sgS-a:tli-pres.sg", "a:tli", "Intransitive Oapan verb"]; The story file itself (test.html in this case) uses the js/machinery.js to handle all the DOM manipulation. It relies on each key word being marked in the story like so: <a id="o:kipix0" href="javascript:void(0)" onclick="javascript:return myLongWord('o:kipix')" onmouseover="return myWord1('o:kipix')" onmouseout="nd()" >o:kipix</a> NOTE: it relies on ID attribute and expects the IDs to be numbered sequentially starting with 0, so id="o:kipix0", id="o:kipix1" , id="o:kipix2", etc. The overlib script is as before. The only difference here is that a call out to the server is not required for each gloss lookup since the info is already in the words.js file. Of course, an actual dictionary lookup with all the senses will still need to hit the server (If you even want to do such a lookup). You may need to merge back some of the previous code to get this call out exactly right. In trying to get rid of any extra obfuscatory javascript I broke the non-parsing aspect of this. The machinery.js file basically supplies two public functions: getCaption(word) and myLongWord(word) [Feel free to change the name! Please!]. The former will pop an overlib of the word gloss and the latter will superscript the word (all instances of the word by ID) and add the word to the savedWords var. The button "Show Words" will show all the saved words. Duplicates are already screened out. PDF Portion ============== What I envision is that the url for getting a PDF version will be along the lines of either a get like /stories/pdf.php?SomeStoryTitle which would return a PDF of the entire story. Or a post with the title and all superscripted words which would be used to create the final PDF. In terms of PDF generation I have only assembled the basic components. What needs to happen is that the pdf.php file would pull the html story from off disk (by title) and pass it to the FPDF lib. Since all superscripted words are known and all instances marked by ID attributes, it should be a simple walk of the DOM to (re) superscript the words either before or after wrting each one to PDF. I can't say which is easier at the moment. There are several examples online for using FreePDF. I would look at the example with the crude HTML parser to get the best idea of what things should look like. Story File generation =========== The story file needs to generated like before except using sequential ID attributes for each word (or word part) that can be superscripted. And of course there is less javascript to lard in since it has mostly been moved to the machinery.js file. Lookin' Pretty =============== This is easy for the CSS afficianado. Just tweak the CSS to look as desired. For metook up too much time! CONCLUSION ============= I wish I had some more time to tweak these files a bit more. The PDF generation should require just some basic programming. Generating the story files in the new format should also be straightfoward. All the Best! - Rick