88 require ('../config.php ' );
99}
1010require (GENERATEDIR .'lib/Curated.class.php ' );
11- require (GENERATEDIR .'lib/Network.class.php ' );
1211
1312// update the files on the server via SVN
1413
2423//`cd /var/www/processing && /usr/local/bin/svn co svn://processing.org/trunk/web/content/`;
2524
2625`cd $ there && /usr/local/bin/svn update curated.xml `;
27- `cd $ there && /usr/local/bin/svn update updates.xml `;
2826
2927
3028/******************************************** CURATED ***/
@@ -113,66 +111,15 @@ function curated_xml($num)
113111 return $ curated ;
114112}
115113
116- /******************************************** NETWORK ***/
117- function get_network_list (&$ network , $ num = 30 )
118- {
119- // output html
120- $ html = '<dl class="network"> ' ."\n" ;
121- for ($ i = 0 ; $ i < $ num ; $ i ++) {
122- $ html .= $ network [$ i ]->display ();
123- }
124- $ html .= "</dl> \n\n" ;
125- return $ html ;
126- }
127-
128- function get_network_table (&$ network , $ start = NETWORK_FIRST_PAGE , $ num = 90 )
129- {
130- $ html = "\n<table border= \"0 \" width= \"100% \"> \n\t<tr> \n" ;
131- $ j = 0 ;
132- for ($ i = $ start ; $ i < min (count ($ network ), $ start +$ num ); $ i ++) {
133- if ($ j % 3 == 0 && $ j != 0 ) { $ html .= "\t</tr> \n\t<tr> \n" ; }
134- if ($ network [$ i ]) {
135- $ html .= "\t\t<td> " . $ network [$ i ]->display_cell () . "</td> \n" ;
136- } else {
137- $ html .= "\t\t<td> </td> \n" ;
138- }
139- $ j ++;
140- }
141- return $ html . "\t</tr> \n</table> \n" ;
142- }
143-
144- function network_xml ($ num )
145- {
146- // open and parse network.xml
147- $ xml =& openXML ('network.xml ' );
148-
149- // get software nodes
150- $ softwares = $ xml ->getElementsByTagName ('software ' );
151- $ softwares = $ softwares ->toArray ();
152-
153- // create network objects
154- $ i = 1 ;
155- foreach ($ softwares as $ software ) {
156- $ network [] = new Network ($ software );
157- if ($ i >= $ num && $ num != 'all ' ) { break ; }
158- $ i ++;
159- }
160-
161- return $ network ;
162- }
163-
164114if (!defined ('COVER ' )) {
165115 $ benchmark_start = microtime_float ();
166116
167117 // get xml
168118 $ curated = curated_xml ('all ' );
169- $ network = network_xml ('all ' );
170119 // count number of items
171120 $ ctotal = count ($ curated );
172- $ ntotal = count ($ network );
173121 // count number of pages needed
174122 $ cnum_pages = ceil ($ ctotal / CURATED_PER_PAGE );
175- $ nnum_pages = ceil ($ ntotal / NETWORK_PER_PAGE );
176123
177124 // create and write the first page
178125 #$page = new Page('Exhibition', 'Index');
@@ -195,22 +142,7 @@ function network_xml($num)
195142 }
196143 writeFile ("exhibition/ " .$ pagename , $ page ->out ());
197144 }
198-
199- for ($ i = 0 ; $ i <= $ nnum_pages ; $ i ++) {
200- $ page = new Page ('Network Archives ' , 'Network Links ' );
201- $ page ->subtemplate ('template.network.archive.html ' );
202- $ page ->set ('network_nav ' , network_nav ($ nnum_pages , $ i +1 ));
203- //$page->set('network', get_network_table($network, NETWORK_PER_PAGE*($i-2)+NETWORK_FIRST_PAGE, NETWORK_PER_PAGE));
204- $ page ->set ('network ' , get_network_table ($ network , NETWORK_PER_PAGE *$ i , NETWORK_PER_PAGE ));
205- //$pagename = sprintf("network_page_%d.html", $i);
206- if ($ i == 0 ) {
207- $ pagename = sprintf ("network/index.html " );
208- } else {
209- $ pagename = sprintf ("network/network_page_%d.html " , $ nnum_pages -$ i );
210- }
211- writeFile ("exhibition/ " .$ pagename , $ page ->out ());
212- }
213-
145+
214146 $ benchmark_end = microtime_float ();
215147 $ execution_time = round ($ benchmark_end - $ benchmark_start , 4 );
216148
@@ -240,36 +172,6 @@ function curated_nav($num, $current)
240172 $ html .= implode (' \\ ' , $ links );
241173 $ html .= '</p> ' ;
242174 return $ html ;
243- }
244-
245- /*
246- function curated_nav($num, $current)
247- {
248- $html = '<p class="exhibition-nav">';
249- $links[] = '<a href="curated_page_1.html">1</a>';
250- for ($i = 2; $i <= $num; $i++) {
251- $links[] = ($i == $current) ? $i : sprintf("<a href=\"curated_page_%d.html\">%d</a>", $i, $i);
252- }
253- $html .= implode(' \\ ', $links);
254- $html .= '</p> ';
255- return $html;
256- }
257- */
258-
259- function network_nav ($ num , $ current )
260- {
261- $ html = '<p class="exhibition-nav"> ' ;
262- //$links[] = '<a href="network_page_1.html">1</a>';
263- for ($ i = $ num ; $ i > 0 ; $ i --) {
264- if ($ i == $ num ) {
265- $ links [] = sprintf ("<a href= \"./ \">%d</a> " , $ i );
266- } else {
267- $ links [] = (($ num -$ i +1 ) == $ current ) ? $ i : sprintf ("<a href= \"network_page_%d.html \">%d</a> " , $ i , $ i );
268- }
269- }
270- $ html .= implode (' \\ ' , $ links );
271- $ html .= '</p> ' ;
272- return $ html ;
273175}
274176
275177?>
0 commit comments