Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Exporting from my syllabus file (Read 6874 times)
Derek Van Ittersum
Full Member
*
Offline



Posts: 168

Exporting from my syllabus file
Aug 10th, 2010, 7:26am
 
Hi all,

I've got an export question for my syllabus file (just posted in this message:  http://www.eastgate.com/Tinderbox/forum//YaBB.pl?num=1281439077/0#0)

I'm trying to get my export to show the Week number in between the dates, sort of like this:

Week 1
August 31, 2010
Reading 1
Reading 2
September 2, 2010
Reading 1
Reading 2
Week 2
September 6, 2010
Reading 1
Reading 2
September 8, 2010
Reading 1
Reading 2
etc.

I'm using the envelope/letter method with this code in the envelope:

Code:
<li>^value(DisplayName)^</li>
^if(^get(ChildCount))
			<ul>
^justChildren(Syllabus)
			</ul>
^endif  



And this code in the letter:

Code:
<h2>^Week</h2>
<h3>^readingDate</h3> 



But for some reason the Week attribute (user-created) isn't displaying . . .
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting from my syllabus file
Reply #1 - Aug 10th, 2010, 8:50am
 
I've found one HTML template but nothing appears to use it. Your template 'Syllabus' is calling itself rather than the second template you cite (which doesn't exist). BTW, a good ttip for your Templates folder is to give it this $OnAdd code, $IsTemplate=true;, so that any children of the container automatically get set as templates.

A number of usage elements are probably throwing curve balls:
  • ^justChildren^ has been deprecated for ^children^ since v4,6.
  • Unless you're really expert with TB code I strongly recommend you close all your export codes, i.e. ^code^ not ^code. Why, don't both work. Yes, but in the latter case TB has to figure out/guess where codes finish. If you're export you won't write code where TB guesses wrongly, if not you're making it more likely you'll get an unexpected result. By closing each export tag, mis-parsing tags is knocked out as a cause of things that might go wrong.
  • Attribute names. These are case sensitive and can be any case but convention is for initial and intercapital: This or ThisThat not thisThat. If you forget a $is readingDate a code, or an attribute, etc..?
  • There are no export codes ^Week^ and ^readingDate^. Now you're making TB guess your meaning! I think you want to use ^get(AttributeName)^ or ^value($AttributeName)^.

I'm not trying to be pedantic or dismissive but simply show how by embracing rules - albeit non-binding one - it's a lot easier to see the wood for the trees.

OK, so agent "SyllabusAgent" should be set to use the HTML export template note "Syllabus" whose corrected code is:
Code:
<h1>^value(DisplayName)^</h1>
^if(^get(ChildCount)^)^<ul>
^children(Syllabus-Item)^
</ul>^endif^ 



Add a new template "Syllabus-Item" with this code:
Code:
	</li>
		<h2>^value($Week)^</h2>
		<h3>^value(format($readingDate,"*"))^</h3>
	</li>

 

The forum code mark-up makes it hard to show, but in this latter template it is important there is a line return in the code after the closing </li>. In the first template it doesn't matter if there is or isn't a line return after the last code.

I now get output for the SyllabusAgent of:
Code:
<h1>SyllabusAgent</h1>
<ul>
	</li>
		<h2>Week 1</h2>
		<h3>Tue, 31 Aug 2010 06:42:00 +0100</h3>
	</li>
	</li>
		<h2>Week 1</h2>
		<h3>Thu, 2 Sep 2010 06:42:00 +0100</h3>
	</li>
	</li>
		<h2>Week 2</h2>
		<h3>Tue, 7 Sep 2010 06:45:00 +0100</h3>
	</li>
	</li>
		<h2>Week 2</h2>
		<h3>Thu, 9 Sep 2010 06:46:00 +0100</h3>
	</li>
...etc...
</ul>  


And that, I think, is what you wanted? The HTML tags, while correctly balanced, may not be what you intended but more importantly I think TB- attribute derived data is correct and in the correct place.

Get a copy of the corrected file from here (right-click and 'Save as'). Were it my project, I'd also suggest making an attribute $ReadingDate, using an agent to copy all data from $readingDate to $ReadingDate and then deleting $readingDate.  How? Make the new data attribute and then an agent with:
Query:   $readingAgent  (i.e. where attribute 'readingDate' has a value)
Action:   $ReadingDate=$readingDate
Check data has copied then delete the agent and the $readingDate attribute.
Back to top
 
« Last Edit: Aug 10th, 2010, 9:02am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Derek Van Ittersum
Full Member
*
Offline



Posts: 168

Re: Exporting from my syllabus file
Reply #2 - Aug 10th, 2010, 12:45pm
 
Thanks for the feedback Mark.  I'm still having trouble understanding the more computer-science-y aspects of export/agent code, so mostly am just trying to cobble things together out of code-snippets from your TBref, forum posts, Tinderbox Way, and guesses.  Since my original TBX was exporting something close to what I wanted, I assumed I had done things right--since usually I can't get the export worked out at all!  Much better, though, to have a sense of how and why these elements work together.  The whole ^value($attributeName) is key! I'll take a look at the revised file and post any follow up if I'm still wrestling with it.

thanks again for taking the time to explain it.  One of the challenges, I'm finding, is that people on the forum and elsewhere are able to take the flexibility of TBX in vastly different directions, and it's difficult for me to abstract out the parts that might apply to my projects and the parts that are particular to their projects.  After I make it through tenure in a few years, I think some remedial computer programming training might be in order!

derek
Back to top
 
 
  IP Logged
Derek Van Ittersum
Full Member
*
Offline



Posts: 168

Re: Exporting from my syllabus file
Reply #3 - Aug 10th, 2010, 1:20pm
 
Ok Mark, I've had a chance to review your revised file and I have a few questions.

1. in the output from your two template method, the note names (the actual reading assignments) aren't getting displayed/called.  In my file,when I do HTML view of Syllabus-Agents, I get this:
Code:
<li>SyllabusAgent</li>

			<ul>
<li>August 31, 2010</li>

			<ul>
<li>no assignment.  we'll go over course policies and assignments, and how to use the course website.</li>

			</ul>
<li>September 2, 2010</li>

			<ul>
<li>Bazerman, Charles. “The case for writing studies as a major discipline.” Rhetoric and composition as intellectual work. Ed. Gary A Olson. Carbondale: Southern Illinois University Press, 2002. 32-38.</li>
<li>Lauer, Janice. “Rhetoric & Composition.” English Studies: An introduction to the discipline(s). Ed. Bruce McComiskey. Urbana, IL: NCTE, 2006. 106-152. </li>
<li>Miller, Susan. “Writing studies as a mode of inquiry.” Rhetoric and composition as intellectual work. Ed. Gary A. Olson. Carbondale, IL: Southern Illinois University Press, 2002. 41-54. </li>

			</ul>
<li>September 7, 2010</li>

			<ul>
<li>Harris, Joseph. “The Idea of Community in the Study of Writing.” College Composition and Communication 40.1 (1989): 11-22. Print.</li>
<li>Trimbur, John. “Consensus and Difference in Collaborative Learning.” College English 51.6 (1989): 602-616.</li>
<li>Prior, Paul. Writing/disciplinarity: A sociohistoric account of literate activity in the academy. Mahwah, NJ: Lawrence Erlbaum Associates, 1998. Print.

Chapter 1
</li>

			</ul> 



Granted, that isn't what I expected when I wrote the code, but it does approximate what I need.  My thinking was that I was creating a recursive template that would keep calling itself until all the children were exported (sort of like what is described in Tinderbox Way on p 135).

What I am hoping for is this:

Code:
<h1>SyllabusAgent</h1>

<h2>Week 1</h2>
			<ul>
<li><h3>August 31, 2010</h3></li>

<li>no assignment.  we'll go over course policies and assignments, and how to use the course website.</li>

<li><h3>September 2, 2010</h3></li>

<li>Bazerman, Charles. “The case for writing studies as a major discipline.” Rhetoric and composition as intellectual work. Ed. Gary A Olson. Carbondale: Southern Illinois University Press, 2002. 32-38.</li>
<li>Lauer, Janice. “Rhetoric & Composition.” English Studies: An introduction to the discipline(s). Ed. Bruce McComiskey. Urbana, IL: NCTE, 2006. 106-152. </li>
<li>Miller, Susan. “Writing studies as a mode of inquiry.” Rhetoric and composition as intellectual work. Ed. Gary A. Olson. Carbondale, IL: Southern Illinois University Press, 2002. 41-54. </li>

</ul>
<h2>Week 2</h2>
<ul>
<li><h2>September 7, 2010</h2></li>
<li>Harris, Joseph. “The Idea of Community in the Study of Writing.” College Composition and Communication 40.1 (1989): 11-22. Print.</li>
<li>Trimbur, John. “Consensus and Difference in Collaborative Learning.” College English 51.6 (1989): 602-616.</li>
<li>Prior, Paul. Writing/disciplinarity: A sociohistoric account of literate activity in the academy. Mahwah, NJ: Lawrence Erlbaum Associates, 1998. Print.

Chapter 1
</li>

			</ul> 


Basically, I'm hoping that the week numbers can create another layer of hierarchy:
--Syllabus
---Week 1
-----Day 1
--------Reading 1
--------Reading 2
-----Day 2
--------Reading 1
--------Reading 2
---Week 2
-----Day 3
--------Reading 1
-----Day 4
---Week 3
etc.


2.  Now that I am examining the file again, I notice that none of the items (agent aliases) in the "SyllabusAgent" agent have children.  I'm thinking this might be because of the new changes in v5 re: aliases.  For some reason, this doesn't prevent my export method from working as I expected, but it does prevent your export method from returning the note names in the export.  Is there a way to get the SyllabusAgent to return all the aliases for the agents it finds as well?  I am hoping for this layout because this way to reuse the file for a later semester, I will only have to change the titles of the adornments, and then all the other readingDates will be populated automatically.  Moving the agents elsewhere manually would require their reading dates to be manually added (I assume).
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting from my syllabus file
Reply #4 - Aug 11th, 2010, 4:01am
 
Note - I made an HTML code error in my last example as the Syllabus-Item template started with a </li> tag instead of an <li> tag. As it happens we need to amend that template anyway so we'll fix the issue as we go on...

OK, from your last post I see that the letter in our main envelope-letter export itself needs to become the envelopes for a new (and different letter).

Therefore, change template Syllabus-Item to the following (as before put a line return after the closing <li>):

Code:
	<li>
		<h2>^value($Week)^</h2>
		<h3>^value(format($readingDate,"*"))^</h3>
		^if(^get(ChildCount)^)^<ul>
		^children(Syllabus-Sub-Item)^
		</ul>^endif^
	</li>

 


Now add anew export template "Syllabus-Sub-Item". give it the following code (here too, leave a line return after the closing </li> tag):


Code:
^indent^<li>^value($Name)^</li>

 



The result is like below (I've truncated the end ofthe following code sample):

Code:
<h1>SyllabusAgent</h1>
<ul>
	<li>
		<h2>Week 1</h2>
		<h3>Tue, 31 Aug 2010 06:42:00 +0100</h3>
		<ul>
			<li>no assignment.  we'll go over course policies and assignments, and how to use the course website.</li>

		</ul>
	</li>
	<li>
		<h2>Week 1</h2>
		<h3>Thu, 2 Sep 2010 06:42:00 +0100</h3>
		<ul>
			<li>Bazerman, Charles. “The case for writing studies as a major discipline.” Rhetoric and composition as intellectual work. Ed. Gary A Olson. Carbondale: Southern Illinois University Press, 2002. 32-38.</li>
	<li>Lauer, J.</li>
	<li>Susan Miller, “Writing Studies as a Mode of Inquiry,” Rhetoric and Composition as Intellectual Work, ed.</li>

		</ul>
...etc.
 



To get all the <li> indented the same throughout you'll need v5.5.0+ to access extra optional parameters that got added to the ^indent^ code. However, such changes only effects the source HTML code that most folks never look at and I'm aware you're using v5.0.2 so can't use the newer code

OK, for folk playing along at home who do have v5.5.0+, I've added copies of the 3 templates - all ending in "55" - that create correctly consistently indented HTML source. To use this version, when you open the demo TBX (see link below), open the HTML view for SyllabusAgent and change the template assignment from "Syllabus" to "Syllabus55".

I've updated my example TBX - get it here (right-click - in Safari anyway - and click Download Linked File As...).
Back to top
 
« Last Edit: Aug 11th, 2010, 4:04am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting from my syllabus file
Reply #5 - Aug 11th, 2010, 4:11am
 
Quote:
Now that I am examining the file again, I notice that none of the items (agent aliases) in the "SyllabusAgent" agent have children.  I'm thinking this might be because of the new changes in v5 re: aliases.  For some reason, this doesn't prevent my export method from working as I expected, but it does prevent your export method from returning the note names in the export.  Is there a way to get the SyllabusAgent to return all the aliases for the agents it finds as well?  I am hoping for this layout because this way to reuse the file for a later semester, I will only have to change the titles of the adornments, and then all the other readingDates will be populated automatically.  Moving the agents elsewhere manually would require their reading dates to be manually added (I assume).


Actually, as you'll see from my earlier answer the solution to the non-export of the actual reading notes was a different one.  My version 1 'letter' template simply never called it's children.

But, you ask, how are we exporting grandchildren  - that don't exist - of an agent? Well, the children of an agent are indeed aliases which can't have children. But, an alias is a pointer to the original. So when we ask an alias "Do you have children?" TB looks at the alias' original to determine the answer.

I think you'll find the demo file I've uploaded should allow you the re-use you desire. If not, come back with a 'broken' example and we can fix it again.
Back to top
 
« Last Edit: Dec 26th, 2010, 4:05am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Derek Van Ittersum
Full Member
*
Offline



Posts: 168

Re: Exporting from my syllabus file
Reply #6 - Aug 11th, 2010, 4:52am
 
Wow Mark, this is great.  Thanks for taking the time to sort this out with me.  I hadn't thought of a letter becoming an envelope for yet another letter, but that helps me understand a whole heap of things about exporting.  

I really appreciate your help here--I know I wouldn't be using Tinderbox without the help I've received here. THanks!

Derek
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting from my syllabus file
Reply #7 - Aug 11th, 2010, 5:35am
 
No problem. The envelope-letter method is very powerful. With a little lateral thought the same content can be exported several different ways. A practical example might be exporting the reading list with/without teacher-only notes. If that's something you want to try we can explore that, but for now I'll not add further complications!
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print