You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: LastRenshai <las...@us...> - 2005-07-29 15:59:46
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27286/scripts/maxima Modified Files: stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** stackmaxima.mac 25 Jul 2005 10:09:32 -0000 1.22 --- stackmaxima.mac 29 Jul 2005 15:59:32 -0000 1.23 *************** *** 569,572 **** --- 569,586 ---- + /* *************************ATPartFrac Test**************************** */ + /* requires: Student Answer, */ + /* [Teachers Question, */ + /* Respect To which the fractions are parted, */ + /* Formative Feedback] */ + /* returns: StackReturnOb */ + /* CASE 1: topOp is divisor - single fraction */ + /* CASE 2: CORRECT answer - true */ + /* CASE 3: Different Variables - diff vars */ + /* CASE 4: Different amount of parts - Diff parts */ + /* CASE 5: Different Numerator - ret factored expression */ + /* CASE 6: Different Denominator - ret sDenom and tDenom */ + /* ******************************************************************** */ + ATPartFrac(SA,SBL) := BLOCK([NEGDISTRIB,val,rawmk,fb,ansnote,SB,v,quiet,facdum], NEGDISTRIB:FALSE, *************** *** 582,587 **** rawmk: 0, fb: "", ansnote: "", ret: StackReturnOb(val,rawmk,ansnote,fb), if factor( expand( sExpr ) ) = factor( expand( tExpr ) ) then ! block( [topOp, list], ! topOp: op(sExpr), list: args(sExpr), if topOp = "//" then BLOCK( val: "false", --- 596,603 ---- rawmk: 0, fb: "", ansnote: "", ret: StackReturnOb(val,rawmk,ansnote,fb), if factor( expand( sExpr ) ) = factor( expand( tExpr ) ) then ! BLOCK( ! [topOp, list], ! topOp: op( sExpr ), ! list: args( sExpr ), if topOp = "//" then BLOCK( val: "false", *************** *** 589,593 **** ansnote: "ATPartFrac_single_fraction", fb:StackAddFeedback("","ATPartFrac_single_fraction") ! ) else if topOp = "+" or topOp = "-" or topOp = "*" then BLOCK( val: "true", --- 605,609 ---- ansnote: "ATPartFrac_single_fraction", fb:StackAddFeedback("","ATPartFrac_single_fraction") ! ) else if topOp = "+" or topOp = "-" or topOp = "*" then BLOCK( val: "true", *************** *** 601,613 **** else if sameVars(sExpr, tExpr) # true then BLOCK( ! val: "true", rawmk: String(0), ansnote : "ATPartFrac_diff_variables", ! fb:StackAddFeedback("","ATPartFrac_diff_variables") ) ! else ! ! block( ! [sDeg,tDeg], sDeg: deg(denom(factor(sExpr))), --- 617,628 ---- else if sameVars(sExpr, tExpr) # true then BLOCK( ! val: "false", rawmk: String(0), ansnote : "ATPartFrac_diff_variables", ! fb:StackAddFeedback("","ATPartFrac_diff_variables"), ! ret: StackReturnOb(val, rawmk, ansnote,fb) ) ! else ! BLOCK( [sDeg,tDeg], sDeg: deg(denom(factor(sExpr))), *************** *** 615,619 **** sNDeg: deg(num(factor(sExpr))), tNDeg: deg(num(factor(tExpr))), ! if tNDeg # sNDeg then BLOCK( val:"true", --- 630,634 ---- sNDeg: deg(num(factor(sExpr))), tNDeg: deg(num(factor(tExpr))), ! if tDeg # sDeg then BLOCK( val:"true", *************** *** 623,637 **** ret: StackReturnOb(val,rawmk,ansnote,fb), RETURN(ret) ! ) ! ! else ! if sDeg = 2 then ! quadTest(sExpr,tExpr,wrt) else if sDeg = 3 then ! tripTest(sExpr, tExpr, wrt) ! ! )), if (quiet) then FeedBack:"", ! RETURN(StackReturnOb(val,STRING(rawmk),ansnote,fb)) )$ --- 638,652 ---- ret: StackReturnOb(val,rawmk,ansnote,fb), RETURN(ret) ! ) ! else ! BLOCK( ! if sDeg = 2 then ! ret: quadTest(sExpr,tExpr,wrt) else if sDeg = 3 then ! ret: tripTest(sExpr, tExpr, wrt)) ! ) ! ), if (quiet) then FeedBack:"", ! RETURN(ret) )$ *************** *** 900,904 **** rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr)),"\$") ) else if (isDenomSame(sExprL, tExprL) = false and isDenomSame(sExprL, tExprR) = false) --- 915,919 ---- rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr),"\$")) ) else if (isDenomSame(sExprL, tExprL) = false and isDenomSame(sExprL, tExprR) = false) *************** *** 915,919 **** rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr)),"\$") ), ret: StackReturnOb(val, rawmk,ansnote,fb), --- 930,934 ---- rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr),"\$")) ), ret: StackReturnOb(val, rawmk,ansnote,fb), *************** *** 967,971 **** rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr)),"\$") ) else if (isDenomSame(s1,t1) = false and isDenomSame(s1,t2) = false and isDenomSame(s1, t3) = false) --- 982,986 ---- rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr),"\$")) ) else if (isDenomSame(s1,t1) = false and isDenomSame(s1,t2) = false and isDenomSame(s1, t3) = false) *************** *** 983,987 **** rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr)),"\$") ), ret: StackReturnOb(val, rawmk, ansnote, fb), --- 998,1002 ---- rawmk: String(0), ansnote: "ATPartFrac_ret_expression", ! fb: StackAddFeedback("", "ATPartFrac_ret_expression", StackDISP(factor(sExpr),"\$")) ), ret: StackReturnOb(val, rawmk, ansnote, fb), |
From: LastRenshai <las...@us...> - 2005-07-29 15:59:46
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27286/lang/en/doc Modified Files: student_factsformula.php Log Message: Index: student_factsformula.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_factsformula.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** student_factsformula.php 14 Jul 2005 08:46:52 -0000 1.3 --- student_factsformula.php 29 Jul 2005 15:59:31 -0000 1.4 *************** *** 330,338 **** \cos^2A={1+\cos 2A\over 2}$'; ! $stackFact['trig_notes_notation']['name'] = 'A Note on Trigonometric Notation'; ! $stackFact['trig_notes_notation']['fact'] = '$\sin^2 A$ is the notation used for $(\sin A)^2$. Similarly ! $\cos^2A$ means $(\cos A)^2$ etc. This notation is used with ! trigonometric and hyperbolic functions but with positive integer ! powers only.'; --- 330,353 ---- \cos^2A={1+\cos 2A\over 2}$'; ! $stackFact['part_frac']['name'] = 'Partial Fraction Form'; ! $stackFact['part_frac']['fact'] = '\noindent ! Partial Fraction Form is the result of reversing the process of adding fractions. ! It involves splitting a complicated rational expression into the sum of two or ! more simpler ones.\smallbreak \noindent ! Example: Find the partial form of ! $$\frac{5x + 14}{(x+1)(x+4)}$$ ! $$\frac{5x + 14}{(x+1)(x+2)} = \frac{A}{x+1} + \frac{B}{x+4}$$ ! $$5X+14=A(x+4) + B(x+1)$$ ! Let $$x=-4$$ ! Then $$5(-4) + 14 = 0 + B(-3)$$ ! $$-6 = -3B$$ ! $$B=2$$ ! Let $$x =-1$$ ! Then $$5(-1) + 14 = A(3) + 0$$ ! $$9 = 3A$$ ! $$A=3$$ ! Hence the partial fraction form of ! $$\frac{5x + 14}{(x+1)(x+4)}$$ is ! $$\frac{3}{x+1} + \frac{2}{x+4}$$.'; |
From: pkiddie <pk...@us...> - 2005-07-28 15:04:12
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7780/scripts/rqp Modified Files: Tag: development_xmlrqp RQPv1p0Server.php index.php nb_easyxml_lite.php nb_soapfuncs.php Added Files: Tag: development_xmlrqp RQPv1p0Client.php Log Message: Added a changelog with history of changes, Nialls latest RQP code, and some changes to integrate this RQP code --- NEW FILE: RQPv1p0Client.php --- <?php include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); /********* Data structures used by this web service ********* * * type ServerInformationDType{ * ['name']=>string * ['version']=>string * ['rqpVersion']=>string * ['studentDocs']=>anyURI * ['teacherDocs']=>anyURI * ['adminDocs']=>anyURI * ['operations']=>array(string, ...) * ['serverProperties']=>array({ * ['key']=>string * ['val']=>string * }, ...) * ['mimetypes']=>array(string, ...) * ['resources']=>array(anyURI, ...) * } * * type ItemInformationDType{ * ['name']=>string * ['itemProperties']=>array({ * ['key']=>string * ['val']=>string * }, ...) * ['error']=>string * ['warning']=>string * } * * type RenderDType{ * ['persistentData']=>string * ['outcomeVars']=>array({ * ['key']=>string * ['val']=>string * }, ...) * ['onSubmit']=>string * ['head']=>array(string, ...) * ['output']=>array({ * ['key']=>string * ['val']=>string * }, ...) * ['mimetype']=>string * ['files']=>array(anyURI, ...) * } * * type kvPair{ * ['key']=>string * ['val']=>string * } * * type input{ * ['key']=>string * ['val']=>string * } * * type CloneDType{ * ['clones']=>array(string, ...) * } * */ class RQPv1p0 { var $Url; /** * web service consumer method RQP_ServerInformation * * @return ServerInformationDType */ function RQP_ServerInformation() // returns a ServerInformationDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_ServerInformation xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; $soapXML .= "</RQP_ServerInformation>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request10($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_ServerInformation", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_ServerInformationResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_ServerInformationDType($xml, $cp, "RQP_ServerInformation"); return $result; } /** * web service consumer method RQP_ItemInformation * * @param source : string * @return ItemInformationDType */ function RQP_ItemInformation($source) // returns a ItemInformationDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_ItemInformation xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; // Parameter string source $soapXML .= $this->soapify_string($source, "source"); $soapXML .= "</RQP_ItemInformation>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request10($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_ItemInformation", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_ItemInformationResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_ItemInformationDType($xml, $cp, "RQP_ItemInformation"); return $result; } /** * web service consumer method RQP_Render * * @param source : string * @param options : kvPair[] * @param persistentData : string * @param inputData : input[] * @param directives : string[] * @param mimetypes : string[] * @param namePrefix : QName * @param itemBase : anyURI * @param resourceBase : anyURI * @param tempfileBase : anyURI * @return RenderDType */ function RQP_Render($source, $options, $persistentData, $inputData, $directives, $mimetypes, $namePrefix, $itemBase, $resourceBase, $tempfileBase) // returns a RenderDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_Render xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; // Parameter string source $soapXML .= $this->soapify_string($source, "source"); // Parameter kvPair[] options $soapXML .= $this->soapify_kvPairArray($options, "options"); // Parameter string persistentData $soapXML .= $this->soapify_string($persistentData, "persistentData"); // Parameter input[] inputData $soapXML .= $this->soapify_inputArray($inputData, "inputData"); // Parameter string[] directives $soapXML .= $this->soapify_stringArray($directives, "directives"); // Parameter string[] mimetypes $soapXML .= $this->soapify_stringArray($mimetypes, "mimetypes"); // Parameter QName namePrefix $soapXML .= $this->soapify_QName($namePrefix, "namePrefix"); // Parameter anyURI itemBase $soapXML .= $this->soapify_anyURI($itemBase, "itemBase"); // Parameter anyURI resourceBase $soapXML .= $this->soapify_anyURI($resourceBase, "resourceBase"); // Parameter anyURI tempfileBase $soapXML .= $this->soapify_anyURI($tempfileBase, "tempfileBase"); $soapXML .= "</RQP_Render>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request10($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_Render", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_RenderResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_RenderDType($xml, $cp, "RQP_Render"); return $result; } /** * web service consumer method RQP_Clone * * @param source : string * @param number : int * @return CloneDType */ function RQP_Clone($source, $number) // returns a CloneDType { $soapXML = "<soap:Body>\n"; $soapXML .= "<RQP_Clone xmlns=\"http://mantis.york.ac.uk/rqp_v1p0\">\n"; // Parameter string source $soapXML .= $this->soapify_string($source, "source"); // Parameter int number $soapXML .= $this->soapify_int($number, "number"); $soapXML .= "</RQP_Clone>\n"; $soapXML .= "</soap:Body>\n"; $soapXML = nbSOAP_Envelope($soapXML); // Send the request (syncronous http 1.0 only at the moment) $soapOut = nbSOAP_request10($this->Url, "http://mantis.york.ac.uk/rqp_v1p0/RQP_Clone", $soapXML); // is it an error? $soapStart = strpos($soapOut, "<?xml"); if($soapStart==-1) return false; $xml = nb_easyxmldoc(substr($soapOut,$soapStart)); $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/"); $cp = $xml->FindChildElement($body); if($cp==false) // empty soap:Body return null; $tn = $xml->getName($cp); if($tn=="Fault") // should really report it... return desoap_nbSOAPFault($xml, $cp); if($tn != "RQP_CloneResponse") return null; $cp = $xml->FindChildElement($cp); if($cp==false) // empty value return null; $result = $this->desoap_CloneDType($xml, $cp, "RQP_Clone"); return $result; } function soapify_ServerInformationDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('name', $input)) $ret .= $this->soapify_string($input['name'], "name"); if(array_key_exists('version', $input)) $ret .= $this->soapify_string($input['version'], "version"); if(array_key_exists('rqpVersion', $input)) $ret .= $this->soapify_string($input['rqpVersion'], "rqpVersion"); if(array_key_exists('studentDocs', $input)) $ret .= $this->soapify_anyURI($input['studentDocs'], "studentDocs"); if(array_key_exists('teacherDocs', $input)) $ret .= $this->soapify_anyURI($input['teacherDocs'], "teacherDocs"); if(array_key_exists('adminDocs', $input)) $ret .= $this->soapify_anyURI($input['adminDocs'], "adminDocs"); if(array_key_exists('operations', $input)) $ret .= $this->soapify_stringArray($input['operations'], "operations"); if(array_key_exists('serverProperties', $input)) $ret .= $this->soapify_kvPairArray($input['serverProperties'], "serverProperties"); if(array_key_exists('mimetypes', $input)) $ret .= $this->soapify_stringArray($input['mimetypes'], "mimetypes"); if(array_key_exists('resources', $input)) $ret .= $this->soapify_anyURIArray($input['resources'], "resources"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_ServerInformationDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string name case "name": $ret['name'] = $xml->getContent($cidx); break; // string version case "version": $ret['version'] = $xml->getContent($cidx); break; // string rqpVersion case "rqpVersion": $ret['rqpVersion'] = $xml->getContent($cidx); break; // anyURI studentDocs case "studentDocs": $ret['studentDocs'] = $xml->getContent($cidx); break; // anyURI teacherDocs case "teacherDocs": $ret['teacherDocs'] = $xml->getContent($cidx); break; // anyURI adminDocs case "adminDocs": $ret['adminDocs'] = $xml->getContent($cidx); break; // string[] operations case "operations": $ret['operations'] = $this->desoap_stringArray($xml, $cidx, "operations"); break; // kvPair[] serverProperties case "serverProperties": $ret['serverProperties'] = $this->desoap_kvPairArray($xml, $cidx, "serverProperties"); break; // string[] mimetypes case "mimetypes": $ret['mimetypes'] = $this->desoap_stringArray($xml, $cidx, "mimetypes"); break; // anyURI[] resources case "resources": $ret['resources'] = $this->desoap_anyURIArray($xml, $cidx, "resources"); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_ItemInformationDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('name', $input)) $ret .= $this->soapify_string($input['name'], "name"); if(array_key_exists('itemProperties', $input)) $ret .= $this->soapify_kvPairArray($input['itemProperties'], "itemProperties"); if(array_key_exists('error', $input)) $ret .= $this->soapify_string($input['error'], "error"); if(array_key_exists('warning', $input)) $ret .= $this->soapify_string($input['warning'], "warning"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_ItemInformationDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string name case "name": $ret['name'] = $xml->getContent($cidx); break; // kvPair[] itemProperties case "itemProperties": $ret['itemProperties'] = $this->desoap_kvPairArray($xml, $cidx, "itemProperties"); break; // string error case "error": $ret['error'] = $xml->getContent($cidx); break; // string warning case "warning": $ret['warning'] = $xml->getContent($cidx); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_string($input, $name) { $ret = "<$name>"; $ret .= encodeXMLSafeString($input); $ret .= "</$name>\n"; return $ret; } function desoap_string($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_RenderDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('persistentData', $input)) $ret .= $this->soapify_string($input['persistentData'], "persistentData"); if(array_key_exists('outcomeVars', $input)) $ret .= $this->soapify_kvPairArray($input['outcomeVars'], "outcomeVars"); if(array_key_exists('onSubmit', $input)) $ret .= $this->soapify_string($input['onSubmit'], "onSubmit"); if(array_key_exists('head', $input)) $ret .= $this->soapify_stringArray($input['head'], "head"); if(array_key_exists('output', $input)) $ret .= $this->soapify_kvPairArray($input['output'], "output"); if(array_key_exists('mimetype', $input)) $ret .= $this->soapify_string($input['mimetype'], "mimetype"); if(array_key_exists('files', $input)) $ret .= $this->soapify_anyURIArray($input['files'], "files"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_RenderDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string persistentData case "persistentData": $ret['persistentData'] = $xml->getContent($cidx); break; // kvPair[] outcomeVars case "outcomeVars": $ret['outcomeVars'] = $this->desoap_kvPairArray($xml, $cidx, "outcomeVars"); break; // string onSubmit case "onSubmit": $ret['onSubmit'] = $xml->getContent($cidx); break; // string[] head case "head": $ret['head'] = $this->desoap_stringArray($xml, $cidx, "head"); break; // kvPair[] output case "output": $ret['output'] = $this->desoap_kvPairArray($xml, $cidx, "output"); break; // string mimetype case "mimetype": $ret['mimetype'] = $xml->getContent($cidx); break; // anyURI[] files case "files": $ret['files'] = $this->desoap_anyURIArray($xml, $cidx, "files"); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_kvPair($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('key', $input)) $ret .= $this->soapify_string($input['key'], "key"); if(array_key_exists('val', $input)) $ret .= $this->soapify_string($input['val'], "val"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_kvPair($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string key case "key": $ret['key'] = $xml->getContent($cidx); break; // string val case "val": $ret['val'] = $xml->getContent($cidx); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_input($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('key', $input)) $ret .= $this->soapify_string($input['key'], "key"); if(array_key_exists('val', $input)) $ret .= $this->soapify_string($input['val'], "val"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_input($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string key case "key": $ret['key'] = $xml->getContent($cidx); break; // string val case "val": $ret['val'] = $xml->getContent($cidx); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_QName($input, $name) { $ret = "<$name>"; $ret .= encodeXMLSafeString($input); $ret .= "</$name>\n"; return $ret; } function desoap_QName($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_anyURI($input, $name) { $ret = "<$name>"; $ret .= encodeXMLSafeString($input); $ret .= "</$name>\n"; return $ret; } function desoap_anyURI($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_CloneDType($input, $name) { $ret = "<$name>"; $ret .= "\n"; if(array_key_exists('clones', $input)) $ret .= $this->soapify_stringArray($input['clones'], "clones"); $ret .= "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_CloneDType($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $nm = $xml->getName($cidx); switch($nm) { // string[] clones case "clones": $ret['clones'] = $this->desoap_stringArray($xml, $cidx, "clones"); break; } $cidx = $xml->FindNextPeer($cidx); } return $ret; } function soapify_int($input, $name) { $ret = "<$name>"; $ret .= strval(intval($input)); $ret .= "</$name>\n"; return $ret; } function desoap_int($xml, $idx, $name) { // ideally I should check element name is $name first $ret = decodeXMLSafeString($xml->getContent($idx)); return $ret; } function soapify_kvPairArray($input, $name) { $ret = "<$name>\n"; if(is_array($input)) { reset($input); while(list($k, $v)=each($input)) { $ret .= $this->soapify_kvPair($v, "kvPair") . "\n"; } } else $ret .= $this->soapify_kvPair($input, "kvPair") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_kvPairArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_kvPair($xml, $cidx, "kvPair"); $cidx = $xml->FindNextPeer($cidx); } } function soapify_inputArray($input, $name) { $ret = "<$name>\n"; if(is_array($input)) { reset($input); while(list($k, $v)=each($input)) { $ret .= $this->soapify_input($v, "input") . "\n"; } } else $ret .= $this->soapify_input($input, "input") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_inputArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_input($xml, $cidx, "input"); $cidx = $xml->FindNextPeer($cidx); } } function soapify_stringArray($input, $name) { $ret = "<$name>\n"; if(is_array($input)) { reset($input); while(list($k, $v)=each($input)) { $ret .= $this->soapify_string($v, "string") . "\n"; } } else $ret .= $this->soapify_string($input, "string") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_stringArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_string($xml, $cidx, "string"); $cidx = $xml->FindNextPeer($cidx); } } function soapify_anyURIArray($input, $name) { $ret = "<$name>\n"; if(is_array($input)) { reset($input); while(list($k, $v)=each($input)) { $ret .= $this->soapify_anyURI($v, "anyURI") . "\n"; } } else $ret .= $this->soapify_anyURI($input, "anyURI") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_anyURIArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); $cidx = $xml->FindNextPeer($cidx); } } } ?> Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/RQPv1p0Server.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** RQPv1p0Server.php 28 Jul 2005 13:38:01 -0000 1.1.2.1 --- RQPv1p0Server.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 *************** *** 1,1213 **** ! <?php ! include("nb_easyxml_lite.php"); ! include("nb_soapfuncs.php"); ! include("rqp_util.php"); //Stack/RQP utility functions ! ! /********* Data structures used by this web service ********* ! * ! * type ServerInformationDType{ ! * ['identifier']=>anyURI ! * ['name']=>string [...2421 lines suppressed...] ! } ! else ! $ret .= $this->soapify_anyURI($input, "anyURI") . "\n"; ! $ret .= "</$name>\n"; ! return $ret; ! } ! ! function desoap_anyURIArray($xml, $idx, $name) ! { ! $ret = array(); ! $cidx = $xml->FindChildElement($idx); ! while($cidx != false) ! { ! $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); ! } ! } ! ! } ! ?> ! Index: nb_soapfuncs.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/nb_soapfuncs.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** nb_soapfuncs.php 28 Jul 2005 13:38:01 -0000 1.1.2.1 --- nb_soapfuncs.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 *************** *** 1,108 **** ! <?php ! /***************************************************************************** ! The purpose of this library is to provide a very simple, interoperable ! SOAP implentation for PHP that is not dependent on any optional libraries and ! can function with both PHP version 4.3 and PHP version 5. ! This library is expected to be used with generated code from ws_gen and ! requires nb_easyxml.php. ! *****************************************************************************/ ! ! class nbSOAP ! { ! //# this is just a placeholder for now, eventually it will ! // hold serialization methods for inbuilt types and ! // the SOAP request functions. ! } ! ! // HTTP 1.1 version; under development, not ready for use ! function nbSOAP_request11($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; //## ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! //# this part needs to properly check the length of response, and ! //# time out neatly if there's too long a delay. ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! while ((!feof($sock))&&($cl < strlen($contents))) ! { ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! echo "<pre>" . htmlentities($contents) . "</pre>"; ! return $contents; ! ! } ! ! function nbSOAP_request10($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! while (!feof($sock)) ! { ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging ! return $contents; ! ! } ! ! function nbSOAP_Envelope($body) ! { ! $body = trim($body); ! if(substr($body,0,10) != "<soap:Body") ! return false; ! $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ! $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; ! $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; ! $soapXML .= $body; ! $soapXML .= "\n</soap:Envelope>\n"; ! return $soapXML; ! } ! ?> \ No newline at end of file --- 1,156 ---- ! <?php ! /***************************************************************************** ! The purpose of this library is to provide a very simple, interoperable ! SOAP implentation for PHP that is not dependent on any optional libraries and ! can function with both PHP version 4.3 and PHP version 5. ! This library is expected to be used with generated code from ws_gen and ! requires nb_easyxml.php. ! *****************************************************************************/ ! ! class nbSOAPFault ! { ! var $faultcode; ! var $faultstring; ! var $faultdetail; ! ! function nbSOAPFault($faultcode, $faultstring, $faultdetail) ! { ! $this->faultcode = $faultcode; ! $this->faultstring = $faultstring; ! $this->faultdetail = $faultdetail; ! $this->faultactor = $_SERVER['PHP_SELF']; ! } ! ! function soapify() ! { ! $out = "<soap:Fault>\n"; ! $out .= "<faultcode>".$this->faultcode."</faultcode>\n"; ! $out .= "<faultstring>".$this->faultstring."</faultstring>\n"; ! $out .= "<faultactor>".$this->faultactor."</faultactor>\n"; ! $out .= "<faultdetail>".$this->faultdetail."</faultdetail>\n"; ! $out .= "</soap:Fault>"; ! return $out; ! } ! } ! ! function desoap_nbSOAPFault($xmp, $cp) ! { ! return new nbSOAPFault("","",""); ! } ! ! ! class nbSOAP ! { ! //# this is just a placeholder for now, eventually it will ! // hold serialization methods for inbuilt types and ! // the SOAP request functions. ! } ! ! // HTTP 1.1 version; under development, not ready for use ! function nbSOAP_request11($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; //## ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! //# this part needs to properly check the length of response, and ! //# time out neatly if there's too long a delay. ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! while ((!feof($sock))&&($cl < strlen($contents))) ! { ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! echo "<pre>" . htmlentities($contents) . "</pre>"; ! return $contents; ! ! } ! ! function nbSOAP_request10($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! while (!feof($sock)) ! { ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging ! return $contents; ! ! } ! ! function nbSOAP_Envelope($body) ! { ! $body = trim($body); ! if(substr($body,0,10) != "<soap:Body") ! return false; ! $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ! $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; ! $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; ! $soapXML .= $body; ! $soapXML .= "\n</soap:Envelope>\n"; ! return $soapXML; ! } ! ! function encodeXMLSafeString($in) ! { ! // this is virtually the same as htmlspecialchars, however I've made my own version to ! // ensure it always matches the decodeXMLSafeString function. ! $plain = array("&", "<", ">", "\""); ! $code = array("&", "<", ">", """); ! return str_replace($plain, $code, strval($in)); ! } ! ! function decodeXMLSafeString($in) ! { ! $code = array("<", ">", """, "&"); ! $plain = array("<", ">", "\"", "&"); ! return str_replace($code, $plain, $in); ! } ! ?> \ No newline at end of file Index: nb_easyxml_lite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/nb_easyxml_lite.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** nb_easyxml_lite.php 28 Jul 2005 13:38:01 -0000 1.1.2.1 --- nb_easyxml_lite.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 *************** *** 1,524 **** ! <?PHP ! ! /*!< This set of classes and function is to provide a simple method of ! * dealing with XML that does not depend on optional libraries ! */ ! ! define("START_TAG",1); ! define("END_TAG",2); ! define("CLOSED_TAG",3); ! define("CONTENT",4); [...1021 lines suppressed...] ! ! function getAttribute($index, $attribname) ! { ! if((is_array($this->entities[$index]->attribs))&&(array_key_exists($attribname,$this->entities[$index]->attribs))) ! return $this->entities[$index]->attribs[$attribname]; ! else ! return ""; ! } ! ! }; ! ! function nb_easyxmldoc($inp) ! { ! $dom = new nb_easyxml; ! $dom->parsein($inp); ! return $dom; ! } ! ?> \ No newline at end of file Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/index.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** index.php 28 Jul 2005 13:38:01 -0000 1.1.2.1 --- index.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 *************** *** 1,16 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ! <html><head><title>RQP 1.0 test</title></head> ! ! <body> ! ! <?php ! include("RQPv1p0Client.php"); ! ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = "http://localhost/RQPv1p0/RQPv1p0Server.php"; ! $serverInfo = $rqpserver->RQP_ServerInformation(); ! echo serialize($serverInfo); ! ! ?> ! </body> </html> \ No newline at end of file --- 1,16 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ! <html><head><title>RQP 1.0 test</title></head> ! ! <body> ! ! <?php ! include("RQPv1p0Client.php"); ! ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = "http://localhost/RQPv1p0/RQPv1p0Server.php"; ! $serverInfo = $rqpserver->RQP_ServerInformation(); ! echo serialize($serverInfo); ! ! ?> ! </body> </html> \ No newline at end of file |
From: pkiddie <pk...@us...> - 2005-07-28 15:04:12
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7780/scripts Modified Files: Tag: development_xmlrqp stackXML.php Log Message: Added a changelog with history of changes, Nialls latest RQP code, and some changes to integrate this RQP code Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -C2 -d -r1.13.2.1 -r1.13.2.2 *** stackXML.php 28 Jul 2005 13:57:17 -0000 1.13.2.1 --- stackXML.php 28 Jul 2005 15:03:49 -0000 1.13.2.2 *************** *** 1,4 **** <?php ! require_once('domit/xml_domit_include.php'); /** --- 1,4 ---- <?php ! require_once('other/domit/xml_domit_include.php'); /** *************** *** 383,387 **** * @return the XSD filename representing the schema - only returned if xml was able to be written out */ ! function stack_schema_write_question_metadata($directory) { global $stackQuestion; --- 383,387 ---- * @return the XSD filename representing the schema - only returned if xml was able to be written out */ ! /*function stack_schema_write_question_metadata($directory) { global $stackQuestion; *************** *** 420,1259 **** return $schema_file_name; ! } ! ! /** ! * Creates the root element of an XML schema definition ! * IMPORTANT TO CALL FIRST BEFORE CREATION OF METADATA ELEMENTS ! * ! * @param string $rootElement The root element to create ! * @return string root element as XML string ! */ ! function stack_schema_create_root($rootElement) ! { ! return "<xs:element name=".'"'.$rootElement.'">'. ! '<xs:complexType>'; ! } ! ! /** ! * Terminates the root element of an XML schema definition ! * ! * @return string root element termination as an XML string ! */ ! function stack_schema_escape_root() ! { ! return '</xs:complexType>'. ! '</xs:element>'; ! } ! ! /** ! * Writes the current stackQuestion metadata structure to an XML string ! * ! * Iterates through each of the fields within the stackQuestion array. If the type 'meta' is detected, (ignoring the internal SQL ! * questionID and body), the relevant documentation is looked up and a schema element is written out, of the correct type ! * ! * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. ! * ! * @param ! * @return the XML string representing the entire metadata schema ! */ ! function stack_schema_create_question_metadata() ! { ! global $sqlToSchemaMapping,$stackQuestion; //use definitive stackQuestion data structure ! ! include('../../stackstd.php'); ! ! $options = stack_options_set(array()); ! $filename = stack_lang_filename($options,'doc/en_doc.php'); //Include documentation to document fields if it is available ! include($filename); ! ! $xml = ""; ! ! //Do not export questionID - internal SQL variable ! if (array_key_exists('questionID',$stackQuestion)) { ! unset($stackQuestion['questionID']); ! } ! ! //Do not export body - internal SQL variable. ! if (array_key_exists('questionBody',$stackQuestion)) { ! unset($stackQuestion['questionBody']); ! } ! ! //Create a sequence of metadata tags ! $xml.='<xs:sequence>'; ! ! foreach($stackQuestion as $arrayKey=>$questionField) //Iterate through sub array of each array object ! { ! //First check there is a type associated with that field and that the stackQuestion field is metadata ! if (!empty($questionField['type']) && ($questionField['type']=='meta')) { ! ! //Check that a metadata tag has been supplied and do not write out if tag has not been supplied ! if (empty($questionField['metatag'])) ! { ! echo'No metadata tag for stackQuestion field: '.$arrayKey.'<br> As a consequence it has not been written to the XML metadata schema<br>'; ! } ! ! else ! { ! //If metadata is not a selection from a list of specified types ! if (empty($questionField['values'])) ! { ! //Create XML schema fragment ! //Documentation available for column ! if (!empty($questionField['doc'])) { ! $xml.=stack_schema_write_element_document($questionField['metatag'],$questionField['mysql'],$questionField['doc']); ! ! } ! ! //Documentation not available for column ! else { ! //echo "Doucmentation not avilable!"; ! $xml.=stack_schema_write_element($questionField['metatag'],$questionField['mysql']); ! } ! } ! ! //The values field is not empty ! else ! { ! //Create XML schema fragment, and default possible enumeration simpleTypes to be the lower case ! //of the current metadata tag ! if (!empty($questionField['doc'])) { ! $xml.=stack_schema_write_element_document_enum_type($questionField['metatag'],strtolower($questionField['metatag']),$questionField['doc']); ! } ! ! //Documentation not available for column ! else { ! $xml.=stack_schema_write_element_enum_type($questionField['metatag'],strtolower($questionField['metatag'])); ! } ! ! //Furthermore, need to create ! } ! ! ! } ! } ! } ! ! //Terminate a sequence of metadata tags ! $xml.='</xs:sequence>'; ! ! //We must now tag the 'metadata' tag with a version attribute ! $xml.= stack_schema_write_attribute('version', true); ! ! return $xml; ! } ! ! /** ! * Constructs an XML schema attribute ! * Example: <xs:attribute name="version" use="required"> ! * <xs:simpleType> ! * <xs:restriction base="xs:string"> ! * <xs:pattern value="[1-9]+[0-9]*\.[0-9]+" /> ! * </xs:restriction> ! * </xs:simpleType> ! * </xs:attribute> ! * ! * ! * @param string $attribName The name of the attribute to be written to XML schema ! * @param bool $isRequired Flag indicating whether attribute is mandatory ! * @return string XML string representing schema attribute ! */ ! function stack_schema_write_attribute($attribName, $isRequired) ! { ! $xml=""; ! ! if ($isRequired) ! { ! $xml='<xs:attribute name = "'.$attribName.'" use = "required">'. ! stack_schema_write_version_simpletype(). ! '</xs:attribute>'; ! ! } ! ! else ! { ! $xml='<xs:attribute name = "'.$attribName.'" use = "optional">'. ! stack_schema_write_version_simpletype(). ! '</xs:attribute>'; ! } ! ! return $xml; ! } ! ! /** ! * Writes a 'version' XML string based on a schema attribute ! * ! * @return string a simpleType encapsulating version convention: M.N, where M is major version, N is minor ! */ ! function stack_schema_write_version_simpletype() ! { ! $xml=""; ! $versionFilter="[1-9]+[0-9]*\.[0-9]+"; ! ! $xml = '<xs:simpleType> ! <xs:restriction base = "xs:string"> ! <xs:pattern value = "'.$versionFilter.'"/> ! </xs:restriction> ! </xs:simpleType>'; ! ! return $xml; ! } ! ! /** ! * Writes a given field within stackQuestion as a schema element, with a representative XML schema datatype ! * ! * First ensure a 'datatype' has been declared otherwise default to a string. If a datatype has been declared then convert to upper case. ! * Then seperate the first 'word' of the datatype, is this contains the important SQL datatype, and remove any array indicators from the ! * datatype. ! * ! * Example: ! * <xs:element name="Keyword" type="xs:string"/> ! * ! * @param string $elementName The name of the schema element ! * @param string $elementType The datatype of the schema element to be represented ! * @return string $xml the XML string representing the schema element ! */ ! function stack_schema_write_element($elementName, $elementType) ! { ! global $sqlToSchemaMapping; ! ! //Error checking code ! //1. If there is no type associated with the element, then default to a string ! if (empty($elementType)) ! { ! ! //SQL type - text = XML schema type - string ! $elementType='TEXT'; ! } ! ! //2. Ensure element type is upper case to ensure comparison array (SQL->XML variable) will work. ! else ! { ! $elementType = strtoupper($elementType); ! } ! ! //3. Now we are only interested in the first word of the SQL datatype in order to convert to XML datatype, hence explode ! //Make sensitive to white space ! $elementDataType = explode(" ", $elementType); ! ! //4. But we also can have SQL datatypes which give array length - CHAR(22) for example - we are not interested in this ! //Make sensitive to open bracket ! $elementDataType = explode("(", $elementDataType[0]); ! ! //echo $sqlToSchemaMapping[$elementDataType[0]]; ! ! return "<xs:element name=".'"'.$elementName.'"'.' type="xs:'.$sqlToSchemaMapping[$elementDataType[0]].'"/>'; ! } ! ! /** ! * Writes a given field within stackQuestion as a schema element, with a representative XML schema datatype, and documentation for that element ! * ! * First ensure a 'datatype' has been declared otherwise default to a string. If a datatype has been declared then convert to upper case. ! * Then seperate the first 'word' of the datatype, is this contains the important SQL datatype, and remove any array indicators from the ! * datatype. ! * ! * Example: ! * <xs:element name="Keyword" type="xs:string"> ! * <xs:annotation> ! * <xs:documentation>Keywords, for searching over banks of questions. Note that any question with the keyword 'demo' will appear ! * as a demo question for guest users and students to try and edit.</xs:documentation> ! * </xs:annotation> ! * </xs:element> ! * ! * @param string $elementName The name of the schema element ! * @param string $elementType The datatype of the schema element to be represented ! * @return string $xml the XML string representing the schema element ! */ ! function stack_schema_write_element_document($elementName, $elementType, $documentTag) ! { ! global $sqlToSchemaMapping; ! ! //Error checking code ! //1. If there is no type associated with the element, then default to a string ! if (empty($elementType)) ! { ! ! //SQL type - text = XML schema type - string ! $elementType='TEXT'; ! } ! ! //2. Ensure element type is upper case to ensure comparison array (SQL->XML variable) will work. ! else ! { ! $elementType = strtoupper($elementType); ! } ! ! //3. Now we are only interested in the first word of the SQL datatype in order to convert to XML datatype, hence explode ! //Make sensitive to white space ! $elementDataType = explode(" ", $elementType); ! ! //4. But we also can have SQL datatypes which give array length - CHAR(22) for example - we are not interested in this ! //Make sensitive to open bracket ! $elementDataType = explode("(", $elementDataType[0]); ! ! $xml = "<xs:element name=".'"'.$elementName.'"'.' type="xs:'.$sqlToSchemaMapping[$elementDataType[0]].'">'; ! ! //Add documentation to element ! $xml.= '<xs:annotation><xs:documentation>'. ! $documentTag. ! '</xs:documentation></xs:annotation>'. ! '</xs:element>'; ! ! return $xml; ! } ! ! /** ! * Writes a field within stackQuestion of 'list' type as an element which references a list of enumerated types within a simpleType XML ! * schema definition giving the possible values the field can take ! * ! * Example: ! * <xs:element name="LearningContext" type="learningcontext"/> ! * ! * @param string $elementName The name of the schema element ! * @param string $elementType The datatype of the possible enumerations ! * @return string the XML string representing the schema element ! */ ! function stack_schema_write_element_enum_type($elementName, $elementType) ! { ! //Error checking code ! //1. If there is no type associated with the element, return an empty string - this should not be possible ! if (empty($elementType)) ! { ! return ""; ! } ! ! else ! { ! return "<xs:element name=".'"'.$elementName.'"'.' type='.'"'.$elementType.'"'.'/>'; ! } ! } ! ! /** ! * Writes a field within stackQuestion of 'list' type as an element which references a list of enumerated types within a simpleType XML ! * schema definition giving the possible values the field can take, along with documentation for that field - taken from stackQuestion['field']['doc']. ! * ! * Example: ! * <xs:element name="LearningContext" type="learningcontext"> ! * <xs:annotation> ! * <xs:documentation>Describes the educational context of the intended target audience of the resource. ! * User defined list type</xs:documentation> ! * </xs:annotation> ! * </xs:element> ! * ! * @param string $elementName The name of the schema element ! * @param string $elementType The datatype of the possible enumerations ! * @return string $xml the XML string representing the schema element ! */ ! function stack_schema_write_element_document_enum_type($elementName, $elementType, $documentTag) ! { ! //Error checking code ! //1. If there is no type associated with the element, then return an empty string - cannot continue! ! if (empty($elementType)) ! { ! ! return ""; ! } ! ! //Otherwise elementType is given the lowercase of the metadata tag - correct XML schema construct. ! else ! { ! ! $xml = "<xs:element name=".'"'.$elementName.'"'.' type='.'"'.$elementType.'">'; ! ! //Add documentation to element ! $xml.= '<xs:annotation><xs:documentation>'. ! $documentTag. ! '</xs:documentation></xs:annotation>'. ! '</xs:element>'; ! ! return $xml; ! } ! } ! ! //This function like before iterates through each of the metadata values and if a list type has been detected write this out! ! ! /** ! * Writes the current stackQuestion enumeration types to an XML string ! * ! * Iterates through each of the fields within the stackQuestion array. If the type 'meta' is detected, (ignoring the internal SQL ! * questionID and body), and a list of values exist, an XML schema simpleType is created which encapsulates these. ! * ! * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. ! * ! * @return string $xml the XML string representing the entire metadata schema ! */ ! function stack_schema_create_question_enum_types() ! { ! global $stackQuestion; ! ! $xml = ""; ! ! foreach($stackQuestion as $arrayKey=>$questionField) //Iterate through sub array of each array object ! { ! //Array item is metadata ! if (!empty($questionField['type']) && $questionField['type']=='meta') { ! ! //check to see whether an enum type of values needs to be written out ! if (!empty($questionField['values'])) ! { ! //Check that a metadata tag has been supplied and do not write out if tag has not been supplied ! if (empty($questionField['metatag'])) ! { ! echo'No metadata tag for stackQuestion field: '.$arrayKey.'.<br> As a consequence this enum type has not been written to the XML metadata schema'; ! } ! ! else ! { ! $xml.=stack_schema_create_simpletype(strtolower($questionField['metatag']),$questionField['values']); ! } ! } ! } ! } ! ! return $xml; ! } ! ! /** ! * Creates the XML schema simple type containing a list of possible enumerations for the selected type ! * ! * Iterates through each of the fields within the stackQuestion array. If the type 'meta' is detected, (ignoring the internal SQL ! * questionID and body), and a list of values exist, an XML schema simpleType is created which encapsulates these. ! * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. ! * Example: ! * <xs:simpleType name="language"> ! * <xs:annotation> ! * <xs:documentation>ISO 639 languages</xs:documentation> ! * </xs:annotation> ! * <xs:restriction base="xs:string"> ! * <xs:length value="2" /> ! * <xs:enumeration value="en" /> ! * <xs:enumeration value="fr" /> ! * <xs:enumeration value="nl" /> ! * <xs:enumeration value="es" /> ! * </xs:restriction> ! * </xs:simpleType> ! * @param string $simpleTypeName the name of the field - usually lower case derivative of 'metatag' ! * @param array $possibleValues the possible enumerations of that field ! * @return string $xml the XML string representing the entire simpleType ! */ ! function stack_schema_create_simpletype($simpleTypeName,$possibleValues) ! { ! //Begin element definition ! $xml = "<xs:simpleType name=".'"'.$simpleTypeName.'"'.">"; ! $xml.= '<xs:restriction base="xs:string">'; ! ! foreach ($possibleValues as $value) //Iterate through each of the possible values ! { ! $xml.= "<xs:enumeration value=".'"'.$value.'"'."/>"; //Add to XML enumeration ! } ! ! //Terminate element definition ! $xml.= "</xs:restriction></xs:simpleType>"; ! ! return $xml; ! } ! ! /** ! * Writes an XML schema file of the current stackQuiz metadata tags ! * ! * XML schema used within STACK to validate quizzes on import/export, and provide a definition of the metadata document ! * ! * @param string $directory The directory to store the XSD file (web server must have permissions) ! * @return the XSD filename representing the schema - only returned if xml was able to be written out ! */ ! function stack_schema_write_quiz_metadata($directory) ! { ! global $stackQuiz; ! ! $schema_file_name='stack_quiz_metadata-'.$stackQuiz['version'].'.xsd'; //File name of schema has version number of stackQuiz clearly identified ! ! //<TODO: Check if is compatible!!> ! $xml_file_handle = fopen($directory."\\".$schema_file_name,"w"); ! ! if (!$xml_file_handle) ! { ! echo "File could not be opened for writing. Please contact the network administrator."; ! return ''; ! } ! ! else ! { ! //Write the XML schema header - same for all XML schemas - with version number. ! //XML metadata files which validate against this schema will also have a version number ! $xml = '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="'.$stackQuiz['version'].'">'. ! "\n". ! '<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>'. ! //Create root element 'metadata'. ! stack_schema_create_root("metadata"). ! stack_schema_create_quiz_metadata(). ! stack_schema_escape_root(). ! stack_schema_create_quiz_enum_types(). ! //End of schema ! '</xs:schema>'; ! ! //write out xml string ! fputs($xml_file_handle,$xml); ! //close xml file ! fclose($xml_file_handle); ! } ! ! return $schema_file_name; ! } ! ! /** ! * Writes the current stackQuiz metadata structure to an XML string ! * ! * Iterates through each of the fields within the stackQuiz array. If the type 'meta' is detected, (ignoring the internal SQL ! * questionID and body), the relevant documentation is looked up and a schema element is written out, of the correct type ! * ! * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. ! * ! * @param ! * @return the XML string representing the entire metadata schema ! */ ! function stack_schema_create_quiz_metadata() ! { ! global $sqlToSchemaMapping,$stackQuiz; ! ! include('../../stackstd.php'); ! ! $options = stack_options_set(array()); ! $filename = stack_lang_filename($options,'doc/en_doc.php'); //Include documentation to document fields if it is available ! include($filename); ! ! $xml = ""; ! ! //Do not export quizID - internal SQL variable ! if (array_key_exists('quizid',$stackQuiz)) { ! unset($stackQuiz['questionID']); ! } ! ! //Create a sequence of metadata tags ! $xml.='<xs:sequence>'; ! ! foreach($stackQuiz as $arrayKey=>$quizField) //Iterate through sub array of each array object ! { ! //First check there is a type associated with that field and that the stackQuestion field is metadata ! if (!empty($quizField['type']) && ($quizField['type']=='meta')) { ! ! //Check that a metadata tag has been supplied and do not write out if tag has not been supplied ! if (empty($quizField['metatag'])) ! { ! echo'No metadata tag for stackQuiz field: '.$arrayKey.'<br> As a consequence it has not been written to the XML metadata schema<br>'; ! } ! ! else ! { ! //If metadata is not a selection from a list of specified types ! if (empty($quizField['values'])) ! { ! //Create XML schema fragment ! //Documentation available for column ! if (!empty($quizField['doc'])) { ! $xml.=stack_schema_write_element_document($quizField['metatag'],$quizField['mysql'],$quizField['doc']); ! ! } ! ! //Documentation not available for column ! else { ! //echo "Doucmentation not avilable!"; ! $xml.=stack_schema_write_element($quizField['metatag'],$quizField['mysql']); ! } ! } ! ! //The values field is not empty ! else ! { ! //Create XML schema fragment, and default possible enumeration simpleTypes to be the lower case ! //of the current metadata tag ! if (!empty($quizField['doc'])) { ! $xml.=stack_schema_write_element_document_enum_type($quizField['metatag'],strtolower($quizField['metatag']),$quizField['doc']); ! } ! ! //Documentation not available for column ! else { ! $xml.=stack_schema_write_element_enum_type($quizField['metatag'],strtolower($quizField['metatag'])); ! } ! ! //Furthermore, need to create ! } ! } ! } ! } ! ! //Terminate a sequence of metadata tags ! $xml.='</xs:sequence>'; ! ! //We must now tag the 'metadata' tag with a version attribute ! $xml.= stack_schema_write_attribute('version', true); ! ! return $xml; ! } ! ! /** ! * Writes the current stackQuiz enumeration types to an XML string ! * ! * Iterates through each of the fields within the stackQuiz array. If the type 'meta' is detected, (ignoring the internal SQL ! * questionID and body), and a list of values exist, an XML schema simpleType is created which encapsulates these. ! * ! * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. ! * ! * @return string $xml the XML string representing the entire metadata schema ! */ ! function stack_schema_create_quiz_enum_types() ! { ! global $stackQuiz; ! ! $xml = ""; ! ! foreach($stackQuiz as $arrayKey=>$quizField) //Iterate through sub array of each array object ! { ! //Array item is metadata ! if (!empty($quizField['type']) && $quizField['type']=='meta') { ! ! //check to see whether an enum type of values needs to be written out ! if (!empty($quizField['values'])) ! { ! //Check that a metadata tag has been supplied and do not write out if tag has not been supplied ! if (empty($quizField['metatag'])) ! { ! echo'No metadata tag for stackQuestion field: '.$arrayKey.'.<br> As a consequence this enum type has not been written to the XML metadata schema'; ! } ! ! else ! { ! $xml.=stack_schema_create_simpletype(strtolower($quizField['metatag']),$quizField['values']); ! } ! } ! } ! } ! ! return $xml; ! } ! ! /** ! * Creates question metadata for the specified question when using PHP4. Use of proprietary XmlDocument class. ! * ! * References the question metadata schema within the XML file along with the schema/stackQuestion version in use. Then iterates through ! * each of the fields within the instantiated question array. If the type 'meta' is detected, (ignoring the internal SQL questionID and body), ! * the value of this field is written out. ! * ! * @param string $questionSchemaLocation The location of the question metadata schema for which this XML file should reflect ! * @param string $questionSchemaVersion The version of the question metadata schema in use ! * @param array $question The instantiated question from which the metadata fields should be grabbed for ! * @param string $directory The directory to store the question metadata XML file ! * @param string $filename The filename of the question metadata XML file. ! * @return void ! */ ! function stack_xml_create_question_metadata_v4($questionSchemaLocation,$questionSchemaVersion,$question,$directory,$filename) ! { ! global $stackQuestion; ! ! // Don't export questionID within metadata ! if (array_key_exists('questionID',$question)) { ! unset($question['questionID']); ! } ! ! //Dont export questionBody within metadata ! if (array_key_exists('questionBody',$question)) { ! unset($question['questionID']); ! } ! ! // Make sure the question is validated. ! // stack_question_validate($question,$errors); ! ! $questionMetadata = new XmlDocument(); //Using simple XML writer for phpV4 ! ! $questionMetadata->CreateRootNodeFromSchema('metadata', //Root element called metadata ! 'xsi', //Default schema namespace ! $schemaLocation,//Where schema resides (local or global??) ! $schemaVersion);//Schema version ! ! if (is_array($question)) ! { ! //Check that a field is of type 'meta', and write out to XML file ! foreach($question as $key => $metaField) { ! if ('meta' == $metaField['type']) { ! $questionMetadata->CreateElementNode($key,$metaField); ! } ! } ! } ! ! $questionMetadata->WriteXml($directory,$filename); ! } ! ! /** ! * Creates quiz metadata for the specified question when using PHP4. Use of proprietary XmlDocument class. ! * ! * References the quiz metadata schema within the XML file along with the schema/stackQuiz version in use. Then iterates through ! * each of the fields within the instantiated quiz array. If the type 'meta' is detected, (ignoring the internal SQL quizID), ! * the value of this field is written out. ! * ! * @param string $quizSchemaLocation The location of the quiz metadata schema for which this XML file should reflect ! * @param string $quizSchemaVersion The version of the quiz metadata schema in use ! * @param array $quiz The instantiated quiz from which the metadata fields should be grabbed for ! * @param string $directory The directory to store the quiz metadata XML file ! * @param string $filename The filename of the quiz metadata XML file. ! * @return void ! */ ! function stack_xml_create_quiz_metadata_v4($quizSchemaLocation,$quizSchemaVersion,$quiz,$directory,$filename) ! { ! global $stackQuiz; ! ! if (array_key_exists('quizid',$quiz)) { ! unset($quiz['quizid']); ! } ! ! $quizMetadata = new XmlDocument(); //Using simple XML writer for phpV4 ! ! $quizMetadata->CreateRootNodeFromSchema('metadata', //Root element called metadata ! 'xsi', //Default schema namespace ! $schemaLocation,//Where schema resides (local or global??) ! $schemaVersion);//Schema version ! ! if (is_array($quiz)) ! { ! //Check that a field is of type 'meta', and write out to XML file ! foreach($quiz as $key => $metaField) { ! if ('meta' == $metaField['type']) { ! $quizMetadata->CreateElementNode($key,$metaField); ! } ! } ! } ! ! $quizMetadata->WriteXml($directory,$filename); ! } ! ! /** ! * Creates question metadata for the specified question when using PHP5. Use of DOM XML. ! * ! * References the question metadata schema within the XML file along with the schema/stackQuestion version in use. Then iterates through ! * each of the fields within the instantiated question array. If the type 'meta' is detected, (ignoring the internal SQL questionID and body), ! * the value of this field is written out. ! * ! * @param string $questionSchemaLocation The location of the question metadata schema for which this XML file should reflect ! * @param string $questionSchemaVersion The version of the question metadata schema in use ! * @param array $question The instantiated question from which the metadata fields should be grabbed for ! * @param string $directory The directory to store the question metadata XML file ! * @param string $filename The filename of the question metadata XML file. ! * @return void ! */ ! function stack_xml_create_question_metadata_v5($questionSchemaLocation,$questionSchemaVersion,$question,$directory,$filename) ! { ! global $stackQuestion; ! ! // Don't export questionID within metadata ! if (array_key_exists('questionID',$question)) { ! unset($question['questionID']); ! } ! ! //Dont export questionBody within metadata ! if (array_key_exists('questionBody',$question)) { ! unset($question['questionID']); ! } ! ! // Make sure the question is validated. ! // stack_question_validate($question,$errors); ! ! $dom = new DomDocument(); ! ! //Create root metadata node ! $root = $dom->createElement("metadata"); ! ! //PHP v5.0.4 stable - incorrect definition for createAttribute, only takes 1 param. ! //Therefore we set value after instantiating object ! //Create reference to stack question metadata schema ! $rootNamespace = $dom->createAttribute('xmlns:xsi'); ! $rootNamespace->value = "http://www.w3.org/2001/XMLSchema-instance"; ! ! $rootNamespaceUri = $dom->createAttribute('xsi:noNamespaceSchemaLocation'); ! $rootNamespaceUri->value = $schemaLocation; ! ! $rootVersion = $dom->createAttribute('version'); ! $rootVersion->value = $schemaVersion; ! ! $root->appendChild($rootNamespace); ! $root->appendChild($rootNamespaceUri); ! $root->appendChild($rootVersion); ! ! if (is_array($question)) ! { ! //Check that a field is of type 'meta', and write out to XML file ! foreach($question as $key => $metaField) { ! if ('meta' == $metaField['type']) { ! $metaElement = $dom->createElement($key,$metaField); ! $root->appendChild($metaElement); ! } ! } ! } ! ! $dom->appendChild($root); ! ! $dom->save($directory.$filename); ! } ! ! /** ! * Creates quiz metadata for the specified question when using PHP5. Use of DOM XML extensions. ! * ! * References the quiz metadata schema within the XML file along with the schema/stackQuiz version in use. Then iterates through ! * each of the fields within the instantiated quiz array. If the type 'meta' is detected, (ignoring the internal SQL quizID), ! * the value of this field is written out. ! * ! * @param string $quizSchemaLocation The location of the quiz metadata schema for which this XML file should reflect ! * @param string $quizSchemaVersion The version of the quiz metadata schema in use ! * @param array $quiz The instantiated quiz from which the metadata fields should be grabbed for ! * @param string $directory The directory to store the quiz metadata XML file ! * @param string $filename The filename of the quiz metadata XML file. ! * @return void ! */ ! function stack_xml_create_quiz_metadata_v5($quizSchemaLocation,$quizSchemaVersion,$quiz,$directory,$filename) ! { ! global $stackQuiz; ! ! // Don't export questionID within metadata ! if (array_key_exists('quizid',$quiz)) { ! unset($quiz['quizid']); ! } ! ! // Make sure the question is validated. ! // stack_question_validate($question,$errors); ! ! $dom = new DomDocument(); ! ! //Create root metadata node ! $root = $dom->createElement("metadata"); ! ! //PHP v5.0.4 stable - incorrect definition for createAttribute, only takes 1 param. ! //Therefore we set value after instantiating object ! //Create reference to stack question metadata schema ! $rootNamespace = $dom->createAttribute('xmlns:xsi'); ! $rootNamespace->value = "http://www.w3.org/2001/XMLSchema-instance"; ! ! $rootNamespaceUri = $dom->createAttribute('xsi:noNamespaceSchemaLocation'); ! $rootNamespaceUri->value = $schemaLocation; ! ! $rootVersion = $dom->createAttribute('version'); ! $rootVersion->value = $schemaVersion; ! ! $root->appendChild($rootNamespace); ! $root->appendChild($rootNamespaceUri); ! $root->appendChild($rootVersion); ! ! if (is_array($question)) ! { ! //Check that a field is of type 'meta', and write out to XML file ! foreach($quiz as $key => $metaField) { ! if ('meta' == $metaField['type']) { ! $metaElement = $dom->createElement($key,$metaField); ! $root->appendChild($metaElement); ! } ! } ! } ! ! $dom->appendChild($root); ! ! $dom->save($directory.$filename); ! } ! ! //Checks the question schema version against the actual value held in stackQuestion, for regularity /** --- 420,424 ---- return $schema_file_name; ! }*/ /** *************** *** 1398,1402 **** stack_schema_create_question(). stack_schema_escape_root(). ! //stack_schema_create_question_enum_types(). //End of schema '</xs:schema>'; --- 563,567 ---- stack_schema_create_question(). stack_schema_escape_root(). ! stack_schema_create_question_enum_types(). //End of schema '</xs:schema>'; *************** *** 2339,2383 **** } - //Writes XML schema file for the current stackQuestion tags excluding the metadata tags - function stack_schema_write_question($directory) - { - global $stackQuestion, $stack_ver; - $stackVer = $stack_ver['release']; - - $schema_file_name='stack_question-'.$stackVer.'.xsd'; - - //<TODO: Check if is compatible!!> - $xml_file_handle = fopen($directory."\\".$schema_file_name,"w"); - - if (!$xml_file_handle) - { - echo "File could not be opened for writing. Please contact the network administrator."; - return ''; - } - - else - { - //Write the XML schema header - same for all XML schemas - with version number. - //XML metadata files which validate against this schema will also have a version number - $xml = '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="'.$stackVer.'">'. - "\n". - '<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>'. - //Create root element 'metadata'. - stack_schema_create_root("assessmentItem"). - stack_schema_create_question(). - stack_schema_escape_root(). - //stack_schema_create_question_enum_types(). - //End of schema - '</xs:schema>'; - - //write out xml string - fputs($xml_file_handle,$xml); - //close xml file - fclose($xml_file_handle); - } - - return $schema_file_name; - } - function stack_schema_create_question() { --- 1504,1507 ---- |
From: pkiddie <pk...@us...> - 2005-07-28 15:04:02
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7780 Added Files: Tag: development_xmlrqp changelog.txt Log Message: Added a changelog with history of changes, Nialls latest RQP code, and some changes to integrate this RQP code --- NEW FILE: changelog.txt --- Version history - Added new question metadata to stackQuestion.php - Added new question metadata term documentation to en_doc.php - Put identifiers within language documentation (lang/en/doc/en_doc) for get_string to operate on question/quiz metadata terms - Process control for Windows: - Ensure cross compatibility with Windows 95/98/ME - external DLLs MSVCP71, MSVCR71, MFC71 check on legality of distributing with STACK package - Processes in Windows 98 labelled differently to Windows XP: to be resolved (FULL) - Added new question/quiz metadata to SQL server - Created installation script (stackUpdateDatabase.php) for existing users based on MySQL queries - Changed 'date last edited' to datetime format - Added 'unspecified' to metadata fields not required - Added front end to allow access to question/quiz metadata fields - Added to help_popup.php for stackQuiz documentation - Use of STACK version tag from stackstd to identify out of date schemas - STACK Readme updated with new installation documentation directory - Stakc installation script: checks for presence of stack_std before allowing user to access their stack web site etc. - Some documentation additions. Known issues: Process running times do not seem to correlate in Windows 98 stackUpdateDatabase is run before the database is set up on a fresh installation of STACK Order of question fields in stackQuestion is important - must relate to the database entries. confusing under windows how to make sure CAS is working added a couple of comments. Interface issues: 19. Select all and delete quiz? 20. Separate quizzes into different types? Todo: - Exporting an individual question, a list of questions and a quiz - Importing an individual question, a list of questions and a quiz - Import tag needs to go on quiz UI - Rather than STACK not correctly installed, how about showing the installation documentation - use of index.php for this, check - for the presence of a completed installation - RQP faults encapsulated within SOAP specific faults. |
From: pkiddie <pk...@us...> - 2005-07-28 13:57:26
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23253/scripts Modified Files: Tag: development_xmlrqp stackXML.php Log Message: Resolving conflicts Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** stackXML.php 22 Jul 2005 12:47:41 -0000 1.13 --- stackXML.php 28 Jul 2005 13:57:17 -0000 1.13.2.1 *************** *** 1,4 **** <?php ! /** * Defines XML handling within STACK --- 1,5 ---- <?php ! require_once('domit/xml_domit_include.php'); ! /** * Defines XML handling within STACK [...1017 lines suppressed...] --- 2395,2398 ---- *************** *** 1429,1432 **** --- 2404,2408 ---- if($questionField['type']=='other') { + //Check questionfieldkey is either options or potentioal responses, if not echo a warning to the developer //foreach($arrayKey as } *************** *** 1436,1443 **** { if(!empty($questionField['doc'])) { - print_r($arrayKey); - print_r($questionField['mysql']); - print_r($questionField['doc']); - $xml.=stack_schema_write_element_document($arrayKey,$questionField['mysql'],$questionField['doc']); } --- 2412,2415 ---- |
From: pkiddie <pk...@us...> - 2005-07-28 13:49:44
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackQuestion.php Log Message: Clear conflicts and cosmetic changes to stackAuthor Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29 retrieving revision 1.29.2.1 diff -C2 -d -r1.29 -r1.29.2.1 *** stackAuthor.php 25 Jul 2005 14:11:25 -0000 1.29 --- stackAuthor.php 28 Jul 2005 13:49:33 -0000 1.29.2.1 *************** *** 60,98 **** } - //<PDK> Added new function for stackQuestion fields - /** - * Generates the portion of the HTML question edit form for editing metadata of with an array of fields - * - * Checks that specified field is of type meta and that an array of values is present. If so, draw a list - * box with all the fields. As these fields contain optional data - they default to 'unspecified' - * - * @param string $name The name of the field in the form - * @param string $opt The option key - * @param mixed $optval The currently set value - * @param int $sz The size of the answer boxes - * @return void - */ - //$qfield,$question[$qfield],$errors, qfield = questionLanguage - function stack_question_edit_metadata_form($name,$opt,$optval,$sz=8) { - global $stackQuestion; - - $fields = $stackQuestion[$opt]; - //Must be of type meta - if ('meta'==$fields['type']) { - if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag - echo "\n<select name=\"$name\">\n"; - if ('default'==$optval){echo " <option value='default' selected>default</option>\n";} - else {echo " <option value='default'>default</option>\n";} - - foreach ($fields['values'] as $vals) { - if ($vals==$optval) {echo " <option value='$vals' selected>$vals</option>\n";} - else {echo " <option value='$vals'>$vals</option>\n";} - } - - echo " </select>\n"; - } - } - } - /** * Build the form to edit a list of STACK options. --- 60,63 ---- *************** *** 102,118 **** * @param array $options Their current values * @param string $fieldname The name of the field in the form - * @param boolean $fragment Is this a fragment, or a complete table? * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$fragment=TRUE) { global $stackOptions; ! if ($fragment) { ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! } ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); --- 67,80 ---- * @param array $options Their current values * @param string $fieldname The name of the field in the form * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname) { global $stackOptions; ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); *************** *** 121,125 **** echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } --- 83,87 ---- echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } *************** *** 138,144 **** } ! if ($fragment) { ! echo "\n</table>\n\n\n"; ! } } --- 100,104 ---- } ! echo "\n</table>\n\n\n"; } *************** *** 187,190 **** --- 147,152 ---- global $stack_stand_alone,$stackQuestion,$stackOptions,$debug,$user; + show_array($question); + //<PDK> Now datetime $t=time(); $dts = strftime('%c',$t); // Format the string. *************** *** 214,221 **** <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> --- 176,183 ---- <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> *************** *** 225,231 **** <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! </table> "; ! // HACK: the field type in the database does not // allow these to be edited yet. --- 187,193 ---- <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! </table> "; ! // HACK: the field type in the database does not // allow these to be edited yet. *************** *** 382,447 **** echo "\n<hr />\n"; ! ! //<PDK> Insert user definable metadata here ! $qfield='questionLanguage'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! $qfield='questionLearningContext'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! ! $qfield='questionDifficulty'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetency'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetencyLevel'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionExcerciseType'; ! $qfield_name = "question[{$qfield}]"; ! echo "<br /><b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionTimeAllocated'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionTimeAllocated' value='".sf($question,'questionTimeAllocated')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionRights'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionRights' value='".sf($question,'questionRights')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! echo "\n<hr />\n"; --- 344,353 ---- echo "\n<hr />\n"; ! ! //List of metadata tags ! $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', ! 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list); //Create all metadata fields on question form ! echo "\n<hr />\n"; *************** *** 763,782 **** } // Timestamp this edit echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; ! // Edit the quiz echo "\n<table>\n"; foreach ($stackQuiz as $key => $fields) { ! $err = ''; ! echo "<tr><td><b>{$fields['descript']}</b></td>\n"; ! if ('quizid' == $key) { ! echo "<td><input type=\"hidden\" name=\"quiz[$key]\" value=\"{$quiz[$key]}\" alt=\"$key\" />{$quiz[$key]}</td><td>".$err.'</td></tr>'; ! } else if ('quizOptions' == $key){ ! echo '</tr>'; ! } else { ! echo "<td><input type=\"text\" name=\"quiz[$key]\" size=\"35\" value=\"".nsf($quiz,$key)."\" alt=\"$key\" /></td><td>".$err.'</td></tr>'; } } echo "\n</table>\n"; --- 669,702 ---- } + //<PDK> Now datetime + $t=time(); + $dts = strftime('%c',$t); // Format the string. + // Timestamp this edit echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; + + //<PDK> Hidden metadata + echo "<input type='hidden' name='quizDateLastEdited' value='$t' />\n + <input type='hidden' name='quizPublisher' value='".sf($quiz,'quizPublisher')."' />\n + <input type='hidden' name='type' value='".sf($quiz,'type')."' />\n + <input type='hidden' name='quizFormat' value='".sf($quiz,'quizFormat')."' />\n"; ! // Edit the quiz - dont iterate through metadata tags! echo "\n<table>\n"; foreach ($stackQuiz as $key => $fields) { ! //Check that within current field there is no type tag, otherwise skip ! if (empty($fields['type'])){ ! $err = ''; ! echo "<tr><td><b>{$fields['descript']}</b></td>\n"; ! if ('quizid' == $key) { ! echo "<td><input type=\"hidden\" name=\"quiz[$key]\" value=\"{$quiz[$key]}\" alt=\"$key\" />{$quiz[$key]}</td><td>".$err.'</td></tr>'; ! } else if ('quizOptions' == $key){ ! echo '</tr>'; ! } else { ! echo "<td><input type=\"text\" name=\"quiz[$key]\" size=\"35\" value=\"".nsf($quiz,$key)."\" alt=\"$key\" /></td><td>".$err.'</td></tr>'; ! } } } + echo "\n</table>\n"; *************** *** 830,834 **** --- 750,761 ---- stack_options_edit_form($options_headings,$options_list,$quiz_options,$fieldname); + + //Check if quiz has metadata set + // $fieldname = 'quiz' + $metadata_list = array('quizLanguage','quizLearningContext','quizDifficulty','quizCompetency', + 'quizCompetencyLevel','quizTimeAllocated','quizExcerciseType','quizRights'); + stack_quiz_metadata_edit_form($quiz, $metadata_list); + // The end of the form! *************** *** 955,957 **** --- 882,1047 ---- } + //<PDK> Added new function for stackQuestion fields + /** + * Generates a portion of HTML which allows the editing of a particular metadata field. + * + * Checks that specified field is of type meta and that an array of values is present. If so, draw a list + * box with all the fields. As these fields contain optional data - they default to 'unspecified'. + * If an array of values is not present, we default to text box entry. + * + * @param string $name The name of the field in the form + * @param string $opt The option key + * @param mixed $optval The currently set value + * @param int $sz The size of the answer boxes + * @return void + */ + function stack_question_edit_metadata_field($name,$opt,$optval,$sz=8) { + global $stackQuestion; + + $fields = $stackQuestion[$opt]; + //Must be of type meta + if ('meta'==$fields['type']) { + if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag + echo "\n<select name=\"$name\">\n"; + if ('default'==$optval){echo " <option value='default' selected>default</option>\n";} + else {echo " <option value='default'>default</option>\n";} + + foreach ($fields['values'] as $vals) { + if ($vals==$optval) {echo " <option value='$vals' selected>$vals</option>\n";} + else {echo " <option value='$vals'>$vals</option>\n";} + } + + echo " </select>\n"; + } + + else { + echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />"; + } + } + } + + /** + * Construct the metadata part of the question edit form + * + * @param string $question The current question being edited + * @param array $metadata_list The list of question metadata to display + * @return void + */ + function stack_question_metadata_edit_form($question,$metadata_list) + { + global $stackQuestion; + + //Create table to put metadata on + echo "<table cellpadding='4'><tr> + <td> <b>".get_string('stackQuestion_questionMetadata','stack')."</b> </td> + <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> + <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; + + //Iterate through each field given in $metadata_list + foreach( $metadata_list as $k => $metadata) { + $descript = stack_question_edit_dispquestionfield($metadata); //Display tag with help + $fieldname= $metadata; + + echo " <td> $descript </td>\n <td>"; + @stack_question_edit_metadata_field($fieldname,$metadata,$question[$metadata]); //Display correct UI component for field + echo "</td>\n"; + + $defval = $stackQuestion[$metadata]['default']; //Retrieve the metadata's default value + + echo " <td> $defval </td>\n</tr>\n"; + } + + //print_r($question); + + echo "\n</table>\n\n\n"; + } + + /** + * Generates a portion of HTML which allows the editing of a particular quiz metadata field. + * + * Checks that specified field is of type meta and that an array of values is present. If so, draw a list + * box with all the fields. As these fields contain optional data - they default to 'unspecified'. + * If an array of values is not present, we default to text box entry. + * + * @param string $name The name of the field in the form + * @param string $opt The option key + * @param mixed $optval The currently set value + * @param int $sz The size of the answer boxes + * @return void + */ + function stack_quiz_edit_metadata_field($name,$opt,$optval,$sz=8) { + global $stackQuiz; + + $fields = $stackQuiz[$opt]; + //Must be of type meta + if ('meta'==$fields['type']) { + if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag + echo "\n<select name=\"$name\">\n"; + if ('default'==$optval){echo " <option value='default' selected>default</option>\n";} + else {echo " <option value='default'>default</option>\n";} + + foreach ($fields['values'] as $vals) { + if ($vals==$optval) {echo " <option value='$vals' selected>$vals</option>\n";} + else {echo " <option value='$vals'>$vals</option>\n";} + } + + echo " </select>\n"; + } + + else { + echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />"; + } //$fields = $stackQuiz[$opt]; + } + } + + /** + * Constructs the metadata part of the quiz edit form + * + * @param string $question The current quiz being edited + * @param array $metadata_list The list of quiz metadata to display + * @return void + */ + function stack_quiz_metadata_edit_form($quiz, $metadata_list) + { + global $stackQuiz; + + //Create table to put quiz metadata on + echo "<table cellpadding='4'><tr> + <td> <b>".get_string('stackQuestion_questionMetadata','stack')."</b> </td> + <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> + <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; + + //Iterate through each field given in $metadata_list + foreach( $metadata_list as $k => $metadata) { + $descript = stack_quiz_edit_dispquizfield($metadata); //Display tag with help + $fieldname= 'quiz'.'['.$metadata.']'; + + echo " <td> $descript </td>\n <td>"; + @stack_quiz_edit_metadata_field($fieldname,$metadata,$quiz[$metadata]); //Display correct UI component for field + echo "</td>\n"; + + $defval = $stackQuiz[$metadata]['default']; //Retrieve the metadata's default value + + echo " <td> $defval </td>\n</tr>\n"; + } + + echo "\n</table>\n\n\n"; + } + + /** + * Display the name of a quizField, in a link generating a popup window. + * + * @param string $field The field name + * @return string The link to the popup window + */ + function stack_quiz_edit_dispquizfield($field) { + global $stackQuiz; + + $fd='stackQuiz_'.$field; + + $fd=get_string($fd,'stack',''); + $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuiz');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; + return($strout); + } + ?> Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -C2 -d -r1.30 -r1.30.2.1 *** stackQuestion.php 22 Jul 2005 12:47:40 -0000 1.30 --- stackQuestion.php 28 Jul 2005 13:49:33 -0000 1.30.2.1 *************** *** 251,260 **** $stackQuestion['questionUserLastEdited']['metatag']='Creator'; - // 'Last edited on'; - $stackQuestion['questionDateLastEdited']['type']='meta'; - $stackQuestion['questionDateLastEdited']['required']='system'; - $stackQuestion['questionDateLastEdited']['mysql']='TIMESTAMP'; - $stackQuestion['questionDateLastEdited']['metatag']='Date'; - //<PDK> Metadata added - database updated //Publisher --- 251,254 ---- *************** *** 350,353 **** --- 344,353 ---- $stackQuestion['questionExcerciseType']['default']='unspecified'; + // 'Last edited on' - Must be last field, representative of database + $stackQuestion['questionDateLastEdited']['type']='meta'; + $stackQuestion['questionDateLastEdited']['required']='system'; + $stackQuestion['questionDateLastEdited']['mysql']='TIMESTAMP'; + $stackQuestion['questionDateLastEdited']['metatag']='Date'; + //////////////////////////////////// // $stackQuestionInst |
From: pkiddie <pk...@us...> - 2005-07-28 13:38:10
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19108/scripts/rqp Added Files: Tag: development_xmlrqp RQPv1p0Server.php index.php nb_easyxml_lite.php nb_soapfuncs.php rqp_util.php Log Message: Adding Nialls modified scripts --- NEW FILE: rqp_util.php --- <?php /** * Stack RQP utility functions * Not part of the RQP Server/Client combo but necessary to interact with RQP * * @package stackRQP * @subpackage Stack */ // Utility functions // /** * Converts an associative array of variables into an array of key-value * objects suitable for RQP * * Creates an array of {@link RQPVar} objects from an associative array * of variables. * @param array $vars Associative array of variables. * @return array Returns an array of objects with the key property set to * the key of the corresponding entry in the vars parameter and the values * property set to the corresponding value. */ function MakeRQPVars($vars) { if (!count($vars)) return array(); array_walk($vars, create_function('&$val, $key', '$obj->identifier = $key; $obj->values = (is_array($val) ? array_values($val) : array($val)); $val = $obj;')); return array_values($vars); } /** * Converts an array of name-value objects as used by RQP into an * associative array of variables. * * Creates an associative array of responses from an array of * {@link RQPInput} objects. * @param array $vars Array of {@link RQPInput} objects. * @return array Returns an associative array with the key of each element * set to the name property of the corresponding object and the value set to * the value property of the corresponding object. */ function FlattenRQPInputs($vars) { if (!is_array($vars)) return array(); $return = array(); foreach ($vars as $var) { $var = (object) $var; // sort out nuSOAP encoding weirdness if (!empty($var->name)) { $return[$var->name] = $var->value; } } return $return; } /** * Converts an array of key-value objects as used by RQP into an * associative array of variables. * * Creates an associative array of variables from an array of {@link RQPVar} * objects. * @param array $vars Array of {@link RQPVar} objects. * @return array Returns an associative array with the key of each element * set to the key property of the corresponding object and the value set to * the values property of the corresponding object. */ function FlattenRQPVars($vars) { if (!is_array($vars)) return array(); $return = array(); foreach ($vars as $var) { $var = (object) $var; // sort out nuSOAP encoding weirdness if (!empty($var->identifier)) { if (1 === count($var->values)) $return[$var->identifier] = $var->values[0]; else $return[$var->identifier] = array_values($var->values); } } return $return; } /** * Interprets source for the all operations which need it. * * @param string $source The item source. * @return array $item The item is returned. */ function source_handler($source, &$format, &$errors, $item_information=FALSE) { global $stack_web_url; $item = NULL; if ('' == trim($source)) { // No source supplied return MakeRQPFault(MakeRQPError('emptySource', 'No item source supplied.'), 'No item source supplied.'); } // We need to use the source supplied, and had beter interpret the format. if ('' === $format) { // format not specified; we are asked to make our best guess if (stristr($source,'<assessmentItem>')) { $format = STACK_URI_FORMAT_XML; } else { $format = STACK_URI_FORMAT_FLAT; } } switch ($format) { case STACK_URI_FORMAT_XML: $itemTemp = stack_xml_parse_question_string($source); $item = $itemTemp['assessmentItem']; $questionBody = addslashes(base64_serialize($itemTemp)); break; case STACK_URI_FORMAT_FLAT: $questionBody = $source; $item = stack_db_decodebody($questionBody); break; default: // Invalid format return MakeRQPFault(MakeRQPError('unknownFormat', '`' . $format . '\' is not a format which STACK can use.'), 'Unknown source format.'); } // By this stage we should have an $item. // Validate item $errors = array(); stack_question_validate($item,$errors); // HACK: throwing a SOAP error here will break the itemInformation operation..... if (count($errors) > 0) { // $errstr should be generated on the client side // $errstr = stack_question_errstr($errors); if (!$item_information) return MakeRQPFault(MakeRQPError('invalidSource', 'The item is invalid.', $errors)); } // HACK: Items no longer need GUIDS so just generate one if it is not set if (empty($item['questionGUID'])) { $item['questionGUID'] = stack_generate_guid($stack_web_url); } $item['questionID'] = 0; // For test and RQP questions only return $item; } /** * Creates an RQP error object. * * An {@link RQPError} object is created to represent the error condition. * @param string $id The identifier for the error (this will be prefixed * with the error URI). * @param string $description Human readable description of the error * reprensented by the id. * @param mixed $detail Machine readable information about the error. * @return RQPError The error object created. */ function MakeRQPError($id, $description='', $detail='') { $error = new RQPError; $error->identifier = RQP_URI_ERROR . $id; $error->message = $description; $error->detail = $detail; return $error; } /** * Checks if a value is an RQP error object. * * The value is tested for being an object and if it is an object for being * of class {@link RQPError}. * @param mixed $value The value to be tested. * @return boolean Returns true if the value is an object of class * {@link RQPError}, false otherwise. */ if (floor(phpversion()) > 4) { function IsRQPError($value) { if (is_object($value)) { if ('RQPError' === get_class($value)) { return true; } } return false; } } else { // get_class returns the class name in lowercase under PHP 4 function IsRQPError($value) { if (is_object($value)) { if ('rqperror' === get_class($value)) { return true; } } return false; } } /** * Creates an RQP style SOAP fault object. * * Creates a SOAP fault object with an RQP error object describing the * error using the SOAP detail field. * @param object $error The {@link RQPError} object describing the error. * @param string $description Human readable description of the error * reprensented by the id field of the error object. * @return SoapFault The SOAP fault object. */ function MakeRQPFault($error, $description='') { $errorID = substr($error->id, strlen(RQP_URI_ERROR)); switch ($errorID) { case 'emptySource': case 'unknownFormat': case 'invalidSource': case 'invalidTemplateVariables': $who = 'Client'; break; default: $who = 'Server'; break; } if (empty($description)) $description = $errorID; return make_soap_fault($who, 'RQP error: '.$description, '', $error); } ?> --- NEW FILE: RQPv1p0Server.php --- <?php include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); include("rqp_util.php"); //Stack/RQP utility functions /********* Data structures used by this web service ********* * * type ServerInformationDType{ * ['identifier']=>anyURI * ['name']=>string * ['description']=>string * ['rqpVersion']=>string * ['studentDocs']=>anyURI * ['teacherDocs']=>anyURI * ['operations']=>array(string, ...) * ['serverProperties']=>array({ * ['key']=>string * ['val']=>string * }, ...) [...1174 lines suppressed...] } else $ret .= $this->soapify_anyURI($input, "anyURI") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_anyURIArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); $cidx = $xml->FindNextPeer($cidx); } } } ?> --- NEW FILE: nb_soapfuncs.php --- <?php /***************************************************************************** The purpose of this library is to provide a very simple, interoperable SOAP implentation for PHP that is not dependent on any optional libraries and can function with both PHP version 4.3 and PHP version 5. This library is expected to be used with generated code from ws_gen and requires nb_easyxml.php. *****************************************************************************/ class nbSOAP { //# this is just a placeholder for now, eventually it will // hold serialization methods for inbuilt types and // the SOAP request functions. } // HTTP 1.1 version; under development, not ready for use function nbSOAP_request11($URI, $SOAPAction, $data) { $contents = ""; $urldata = parse_url($URI); if(!array_key_exists('port', $urldata)) $urldata['port']=80; $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; $request .= "Host: ". $urldata['host'] ."\r\n"; $request .= "Accept: */*\r\n"; $request .= "User-Agent: PHP-script\r\n"; $request .= "Content-Type: text/xml; charset=utf-8\r\n"; $request .= "Content-length: " . strlen($data) . "\r\n"; $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; $request .= $data; $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); //echo "<pre>".htmlentities($request)."</pre>"; //## if($sock == false) { return false; } else { fputs($sock, $request); //# this part needs to properly check the length of response, and //# time out neatly if there's too long a delay. $cl = strlen($contents); $contents .= fread($sock, 8192); while ((!feof($sock))&&($cl < strlen($contents))) { $cl = strlen($contents); $contents .= fread($sock, 8192); } fclose($sock); } echo "<pre>" . htmlentities($contents) . "</pre>"; return $contents; } function nbSOAP_request10($URI, $SOAPAction, $data) { $contents = ""; $urldata = parse_url($URI); if(!array_key_exists('port', $urldata)) $urldata['port']=80; $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; $request .= "Host: ". $urldata['host'] ."\r\n"; $request .= "Accept: */*\r\n"; $request .= "User-Agent: PHP-script\r\n"; $request .= "Content-Type: text/xml; charset=utf-8\r\n"; $request .= "Content-length: " . strlen($data) . "\r\n"; $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; $request .= $data; $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) { return false; } else { fputs($sock, $request); while (!feof($sock)) { $contents .= fread($sock, 8192); } fclose($sock); } //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } function nbSOAP_Envelope($body) { $body = trim($body); if(substr($body,0,10) != "<soap:Body") return false; $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; $soapXML .= $body; $soapXML .= "\n</soap:Envelope>\n"; return $soapXML; } ?> --- NEW FILE: nb_easyxml_lite.php --- <?PHP /*!< This set of classes and function is to provide a simple method of * dealing with XML that does not depend on optional libraries */ define("START_TAG",1); define("END_TAG",2); define("CLOSED_TAG",3); define("CONTENT",4); define("XML_ERROR",0); define("XML_DECLARATION",5); // <?xml define("XML_DOCTYPE",6); // <!DOCTYPE ... > define("XML_INSTRUCTION",7); // <? define("XML_CDATA",8); // <[CDATA[ ... ]]> define("XML_COMMENT",9); // <!-- ... --> /*! Base class from which tag and content classes are derived. Never used directly. */ class nb_xml_part{ var $type; //!< Indicates the type of entity - tag, content etc. var $depth; //!< Indicates how deep in the xml tree this entity is. //! A 'pure virtual' function. Derived classes impliment their own version. function dump() { return "<font color='red'>This should never be called!</font><br>"; } }; //! Class for tags in the list of the XML. class nb_xml_tag extends nb_xml_part{ var $tagname; //!< The name of the tag, no namespace prefix var $attribs; //!< An associative array containing attributes keyed by name var $cleansource; //!< the tidy source for the tag. // Next four lines added 28Jun05 NSFB var $nsURI; //!< The namespace URI of the tag if it exists var $nsPrefix; //!< The namespace prefix of the tag if it was used // this is only really meaningful in start elements, potentially used in closed though var $nsDetail; //!< an array of namespaces declared here ['!'] used as prefix for default; /*! Constructor takes a XML tag (without < >) sets $tagname, * $type (START_TAG|END_TAG|CLOSED_TAG), and $attribs, * an associative array of attributes. */ function nb_xml_tag($tagsource) { // initialise to default values $this->nsDetail = array(); $this->nsPrefix = ""; $this->nsURI = false; // "" would be empty, false is undefined // tidy up the ends and make sure the < and > are gone. $tagsource=trim($tagsource); if($tagsource[0]=="<") { $tagsource = substr($tagsource,1); } if($tagsource[strlen($tagsource)-1]==">") { $tagsource = substr($tagsource,0,strlen($tagsource)-1); } $tagsource=trim($tagsource); $this->cleansource=$tagsource; // now check what sort of tag it is... // echo $tagsource[0]; // debug switch($tagsource[0]) { case '?': if(substr($tagsource,0,4)=="?xml"){ $this->type = XML_DECLARATION;} else{ $this->type = XML_INSTRUCTION;} break; case '!': if(substr($tagsource,0,8)=="!DOCTYPE"){ $this->type = XML_DOCTYPE;} elseif(substr($tagsource,0,3)=="!--"){ $this->type = XML_COMMENT;} else{ $this->type = XML_ERROR;} break; case '[': if(substr($tagsource,0,7)=="[CDATA["){ $this->type = XML_CDATA;} else{ $this->type = XML_ERROR;} break; case '/': $this->type = END_TAG; $this->tagname = substr($tagsource,1); // split off namespace part if it exists, added 28Jun05 NSFB if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; break; default: //it's a normal tag! if($tagsource[strlen($tagsource)-1]=='/'){ $this->type = CLOSED_TAG; $tagsource = substr($tagsource,0,strlen($tagsource)-1); } else{ $this->type = START_TAG;} // need to extract name and attributes here. if(strpos($tagsource," ")==false) { $nm=$tagsource; $attrs=""; } else list($nm,$attrs)=explode(" ",$tagsource,2); $attrs = preg_replace("/\s+/"," ",$attrs); $attrs = str_replace("= \"","=\"",$attrs); $attrs = str_replace(" =\"","=\"",$attrs); $attrs=trim($attrs); while(strlen($attrs)>2) { if((strpos($attrs," ")!==false)&&((strpos($attrs," ")<strpos($attrs,"=")))) //== would indicate end of attribs, no val { list($attrname,$attrs)=explode(" ",$attrs,2); $attrval=true; } else { list($attrname,$attrs)=explode("=",$attrs,2); $echar=$attrs[0]; $attrs=trim($attrs); if(($echar=="\"")||($echar=="'")) { $attrs = substr($attrs,1); list($attrval,$attrs)=explode($echar,$attrs,2); } else list($attrval,$attrs)=explode(" ",$attrs,2); if($attrval=="") $attrval=true; } $this->attribs[trim($attrname)]=$attrval; $attrs=trim($attrs); // do the namespace collecting stuff, added 28Jun05, NSFB if(strpos($attrname,":")!==false) list($attrname, $prefix) = explode(":",$attrname,2); else $prefix = ""; // so there's a key use this instead of ""; if($attrname=="xmlns") { $this->nsDetail[$prefix] = trim($attrval); } // end of namespace collecting stuff } $this->tagname = $nm; if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; // alocate namespace URI if possible , added 28Jun05, NSFB if(array_key_exists($this->nsPrefix,$this->nsDetail)) $this->nsURI = $this->nsDetail[$this->nsPrefix]; break; } } /*! Creates a tidy version of the tag for output. Start, end and closed tags are all correctly formated. Attributes will not nessesaraly be in the original order. \return A string containing the well formated tag. */ function dump() { switch($this->type) { case START_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } return $rstr.">"; break; case CLOSED_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } else { if(strlen($this->attribs)>0){$rstr .= " ".$this->attribs;} } return $rstr."/>"; break; case END_TAG: return "</".$this->tagname.">"; break; default: return "<".$this->cleansource.">"; break; } } }; /*! Class for content in the XML list - content is everything between tags, but does not include child tags, they become the next item in the list. */ class nb_xml_content extends nb_xml_part{ var $content; /*! constructor takes the content and sets the block type. \param $source is the content. */ function nb_xml_content($source) { $this->content = $source; $this->type = CONTENT; } //! returns the content. function dump() { return $this->content; } } /*! The main class of the XML library reads in XML and provides methods for manipulating it. The XML is held as a list of tags and content, each with a type and depth. */ class nb_easyxml { var $entities; var $source; // C++ private: equiv /*! Get a 'block' of xml from $this->source, either a tag or DATA/CDATA starting * from $point, update point to first char after the 'block' */ function getblock(&$point) { if($this->source[$point]=='<') { //print("<br>tag at $point<br>");//debug switch($this->source[$point+1]) { case '?': $estr = '?'.'>'; // split to be nice to PHP parser; break; case '!': if(substr($this->source,$point+1,3)=="!--"){ $estr = "-->";} elseif($this->source[$point+2]=="["){ $estr = "]]>";} else{ $estr = ">";} break; default: $estr = ">"; break; } $epoint = strpos($this->source,$estr,$point); if($epoint === false) { $point = strlen($this->source); return ""; } $epoint += strlen($estr); $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } else { $epoint = strpos($this->source,'<',$point); if($epoint === false) { $epoint = strlen($this->source); } $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } } // C++ protected: equiv /*! Parses XML into the list and does a limited amount of checking. Not really intended to be used from outside the library. \param $source is the xml to be parsed. */ function parsein($source) { $this->entities=""; // this clears out old data. $this->source = $source; $prspt=0; // counter for where in the xml the parser has got to (PaRSe PoinT). $level=0; // how far down the xml tree I am! $nsInfo = array(); // namespace allocation array while($prspt < strlen($this->source)) { $block = $this->getblock($prspt); $printblk = htmlentities($block); // echo "<p><b>".$prspt."</b> ".strlen($block)."<br>".$printblk."</p>";//debug if($block[0] == '<') { $tagcls = new nb_xml_tag($block); $tagcls->depth = $level; if($tagcls->type== START_TAG) { $tagatlev[$level]=$tagcls->tagname; //printf("At level $level got tag '$tagcls->tagname'<br>"); // debug $level++; // store namespace info $nsInfo[$level] = $tagcls->nsDetail; $testlev = $level - 1; // no need to test this level as tag parser does it. while(($tagcls->nsURI === false)&&($testlev >= 0)) { if(array_key_exists($tagcls->nsPrefix, $nsInfo[$testlev])) $tagcls->nsURI = $nsInfo[$testlev][$tagcls->nsPrefix]; $testlev--; } //printf("At level $level got tag '$tagcls->tagname' in namespace {$tagcls->nsURI}<br>"); // debug } $this->entities[] = $tagcls; //$sz = sizeof($this->entities); //debug //echo $this->entities[$sz-1]->depth.": tag - ".$tagcls->tagname."<br>"; // debug if($tagcls->type== END_TAG) { $level--; if($tagatlev[$level]!=$tagcls->tagname) { die("XML error - unmatching start and end tags (/".$tagatlev[$level]." expected, found /".$tagcls->tagname.")"); } } } else { $tblock = trim($block); if($tblock != "") // eliminate all whitespace blocks. { $contcls = new nb_xml_content($block); $contcls->depth = $level; $this->entities[] = $contcls; //echo $contcls->depth.": some content<br>"; // debug } } } } /*! Finds the root tag of the xml. \return the index of the root tag. */ function root() { $index=0; while(($index<=sizeof($this->entities))&&($this->entities[$index]->type!=START_TAG)) { $index++; } if($index<=sizeof($this->entities)){ return $index;} else{ return false;} } /*! Finds the index of the first occurence of a tag after an index point. \param $tagnm is the tag name to search for \param $startpt is the point to start the search from (defaults to 0) \return the index of the first occurence of the tag or false */ function findElement($tagnm, $startpt=0, $namespace = false) { $n = $startpt; $found = false; while(($n < sizeof($this->entities))&&($found===false)) { if(($this->entities[$n]->type==START_TAG)&&($this->entities[$n]->tagname==$tagnm)) { if(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) $found=true; } if($found==false) $n++; } if($found===true){ return $n; } else{ return false;} } function getContent($idx) { if($this->entities[$idx]->type==CLOSED_TAG) return ""; elseif($this->entities[$idx]->type==START_TAG) { $n = $idx+1; $rstr = ""; while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$idx]->depth)) { if($this->entities[$n]->type==CONTENT) //# need to deal with CDATA too { $rstr .= $this->entities[$n]->dump(); } $n++; } return $rstr; } else return false; } /*! Finds either an immediate child or a peer (same depth) tag. If $tagnm is "" (default) the first child or peer tag is returned, otherwise only one with a matching name. This is the basic function for FindChildTag, FindNextPeerTag etc. This should be considered private, nicer functions exist that call this. \return index of the found tag or false. */ function findclosetag($parent, $tagnm="", $child=false, $namespace=false) { if($parent===false) die("false passed as parent in findclosetag"); $n = $parent+1; $seekdepth=$this->entities[$parent]->depth; //echo "$n parent [$parent], depth $seekdepth;<br>"; if($child) $seekdepth++; $found = false; while(($n < sizeof($this->entities))&&($found===false)&&($this->entities[$n]->depth>=$seekdepth)) { if((($this->entities[$n]->type==START_TAG)|| ($this->entities[$n]->type==CLOSED_TAG)) &&($this->entities[$n]->depth==$seekdepth) &&(($tagnm=="")||($this->entities[$n]->tagname==$tagnm)) &&(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) ){ $found=true;} else{ $n++;} } if($found===true){ return $n; } else{ return false;} } /*! Finds imediate child tags of a particular tag (indicated by index). The tag index returned will either be the first child tag, or the first with a particular name. \param $parent is the index of the tag to find children of. \param $tagnm if provided is the tagname of child to search for. \return the index of the child tag or false */ function findChildElement($parent, $tagnm="", $namespace=false) { return $this->findclosetag($parent, $tagnm, true, $namespace); } /*! Finds the next peer tag of a particular tag (indicated by index) The tag index returned will either be the first peer tag, or the first with a particular name. \param $searchfrom is the index of the tag to search from. \param $tagnm is the tagname of peer to search for - if not given returns the first child index \return the index of the child tag or false */ function findNextPeer($searchfrom, $tagnm="", $namespace=false) { return $this->findclosetag($searchfrom, $tagnm, false, $namespace); } /*! Converts a block into a string of XML. The block goes from the start tag index provided to the matching end tag. \param $tagnum is the index of the start tag of the block to be dumped \return a string containing the block of XML */ function dumpblock($tagnum) { if($tagnum===false) return ""; $n = $tagnum+1; $rstr = $this->entities[$tagnum]->dump(); while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$tagnum]->depth)) { $rstr .= $this->entities[$n]->dump(); $n++; } return $rstr; } function getName($index) { return $this->entities[$index]->tagname; } function getNamespace($index) { return $this->entities[$index]->nsURI; } function getAttribute($index, $attribname) { if((is_array($this->entities[$index]->attribs))&&(array_key_exists($attribname,$this->entities[$index]->attribs))) return $this->entities[$index]->attribs[$attribname]; else return ""; } }; function nb_easyxmldoc($inp) { $dom = new nb_easyxml; $dom->parsein($inp); return $dom; } ?> --- NEW FILE: index.php --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>RQP 1.0 test</title></head> <body> <?php include("RQPv1p0Client.php"); $rqpserver = new RQPv1p0(); $rqpserver->Url = "http://localhost/RQPv1p0/RQPv1p0Server.php"; $serverInfo = $rqpserver->RQP_ServerInformation(); echo serialize($serverInfo); ?> </body> </html> |
From: pkiddie <pk...@us...> - 2005-07-28 13:36:37
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18607/scripts Modified Files: Tag: development_xmlrqp stackUtility.php Log Message: Cosmetic changes to installation file, and changes to readme text Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.30.2.1 retrieving revision 1.30.2.2 diff -C2 -d -r1.30.2.1 -r1.30.2.2 *** stackUtility.php 28 Jul 2005 13:18:27 -0000 1.30.2.1 --- stackUtility.php 28 Jul 2005 13:36:23 -0000 1.30.2.2 *************** *** 1071,1077 **** else { ! return false; ! } } - ?> --- 1071,1075 ---- else { ! return false; } } ?> |
From: pkiddie <pk...@us...> - 2005-07-28 13:36:37
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18607 Modified Files: Tag: development_xmlrqp readme.txt Log Message: Cosmetic changes to installation file, and changes to readme text Index: readme.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/readme.txt,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** readme.txt 13 Mar 2005 14:58:21 -0000 1.1 --- readme.txt 28 Jul 2005 13:36:22 -0000 1.1.2.1 *************** *** 1,59 **** ! Stack - README.TXT FILE ! ! =============================================================== ! Copyright (C) 2004 by Christopher J Sangwin ! COPYRIGHT NOTICE: ! All content in this file may not be copied (partly or as a ! whole), or re-used in other applications, without the ! express written permission of the copyright holder. ! =============================================================== ! ! INTRODUCTION: ! =============================================================== ! ! Stack is a computer aided assessment system, which uses computer ! algebra to process responses of students. This means that the ! student has to provide an answer of their own, and cannot select ! from a list of teacher provided answers. We believe this is ! pedagogically more honest. ! ! SYSTEM REQUIREMENTS: ! =============================================================== ! ! Stack is a collection of PHP scripts, which make use of ! - MySQL database, ! - Maxima CAS, ! - TtH for display of LaTeX ! - GnuPlot for grpahics. ! ! For precise details see the install instructions. ! ! HOW TO INSTALL STACK: ! =============================================================== ! ! The install instructions, and requirements, are contained in the ! file ! ! /stackroot/public_html/doc/install.php ! ! ! KNOWN PROBLEMS: ! =============================================================== ! None ! ! ! Bugs, comments & suggestions: ! =============================================================== ! If you have a question, make sure ! that you have READ the HELP file first, If you can can't find ! the answer to your question, please consult the FAQ page at the ! CDex home page. If you still have problems, you can send me an ! e-mail at san...@us... ! ! Warranty & licence: ! =============================================================== ! ! see LICENCE.TXT for GNU license ! ! ! ======= ### ====== --- 1,118 ---- ! Stack - README.TXT FILE ! ! ! ! =============================================================== ! ! Copyright (C) 2004 by Christopher J Sangwin ! ! COPYRIGHT NOTICE: ! ! All content in this file may not be copied (partly or as a ! ! whole), or re-used in other applications, without the ! ! express written permission of the copyright holder. ! ! =============================================================== ! ! ! ! INTRODUCTION: ! ! =============================================================== ! ! ! ! Stack is a computer aided assessment system, which uses computer ! ! algebra to process responses of students. This means that the ! ! student has to provide an answer of their own, and cannot select ! ! from a list of teacher provided answers. We believe this is ! ! pedagogically more honest. ! ! ! ! SYSTEM REQUIREMENTS: ! ! =============================================================== ! ! ! ! Stack is a collection of PHP scripts, which make use of ! ! - MySQL database, ! ! - Maxima CAS, ! ! - TtH for display of LaTeX ! ! - GnuPlot for grpahics. ! ! ! ! For precise details see the install instructions. ! ! ! ! HOW TO INSTALL STACK: ! ! =============================================================== ! ! ! ! The install instructions, and requirements, are contained in the ! ! file ! ! ! ! /stackroot/lang/en/doc/install.php ! ! ! ! ! ! KNOWN PROBLEMS: ! ! =============================================================== ! ! None ! ! ! ! ! ! Bugs, comments & suggestions: ! ! =============================================================== ! ! If you have a question, make sure ! ! that you have READ the HELP file first, If you can can't find ! ! the answer to your question, please consult the FAQ page at the ! ! CDex home page. If you still have problems, you can send me an ! ! e-mail at san...@us... ! ! ! ! Warranty & licence: ! ! =============================================================== ! ! ! ! see LICENCE.TXT for GNU license ! ! ! ! ! ! ======= ### ====== ! |
From: pkiddie <pk...@us...> - 2005-07-28 13:36:37
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18607/scripts/install Modified Files: Tag: development_xmlrqp stackUpdateDatabase.php Log Message: Cosmetic changes to installation file, and changes to readme text Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.php,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** stackUpdateDatabase.php 18 Jul 2005 12:09:12 -0000 1.3 --- stackUpdateDatabase.php 28 Jul 2005 13:36:22 -0000 1.3.2.1 *************** *** 6,10 **** <?php ! require_once('stackstd.php'); /** This PHP script simply adds new fields to mySQL for metadata. This affects both questions and quizzes --- 6,12 ---- <?php ! ! //<PDK> edited here as fresh installation fails to load stackstd ! require_once('../../stackstd.php'); /** This PHP script simply adds new fields to mySQL for metadata. This affects both questions and quizzes |
From: pkiddie <pk...@us...> - 2005-07-28 13:36:30
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18607/lang/en/doc Modified Files: Tag: development_xmlrqp about_install.php Log Message: Cosmetic changes to installation file, and changes to readme text Index: about_install.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/about_install.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** about_install.php 14 Jul 2005 18:44:54 -0000 1.2 --- about_install.php 28 Jul 2005 13:36:21 -0000 1.2.2.1 *************** *** 1,384 **** ! <?php ! /** ! * Details of how to install STACK. ! * ! * @package documentation ! * @subpackage Stack ! * ! */ ! ! ?> [...1146 lines suppressed...] ! ! ! These classifications are given in the file, ! ! <tt>maximafun.php</tt>, which you can and should edit. <em>Once ! ! you have edited this file, you need to execute the file ! ! <tt>initmaxima.php</tt> to re-create ! ! <tt>CASkeywords.php</tt>.</em> (This in turn has been generated ! ! directly from the Maxima docs using another script, which you ! ! need not use). ! ! ! ! </p> ! |
Update of /cvsroot/stack/stack-1-0/other/domit/documentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15524/other/domit/documentation Added Files: Tag: development_xmlrqp DOMIT.html DOMIT_Attr.html DOMIT_CDATASection.html DOMIT_Cache.html DOMIT_CharacterData.html DOMIT_ChildNodes_Interface.html DOMIT_Comment.html DOMIT_DOMException.html DOMIT_DOMImplementation.html DOMIT_Doctor.html DOMIT_Document.html DOMIT_DocumentFragment.html DOMIT_DocumentType.html DOMIT_Element.html DOMIT_GetElementsByPath.html DOMIT_GetElementsByTagName.html DOMIT_NamedNodeMap.html DOMIT_NamedNodeMap_Attr.html DOMIT_Node.html DOMIT_NodeList.html DOMIT_Parser.html DOMIT_ProcessingInstruction.html DOMIT_TextNode.html DOMIT_Utilities.html DOMIT_tutorial_000.html DOMIT_tutorial_001.html DOMIT_tutorial_002.html DOMIT_tutorial_003.html DOMIT_tutorial_004.html DOMIT_tutorial_005.html DOMIT_tutorial_006.html DOMIT_tutorial_007.html DOMIT_tutorial_008.html DOMIT_tutorial_009.html DOMIT_tutorial_010.html DOMIT_tutorial_011.html DOMIT_tutorial_012.html DOMIT_tutorial_013.html DOMIT_tutorial_014.html DOMIT_tutorial_015.html DOMIT_tutorial_016.html DOMIT_tutorial_017.html DOMIT_tutorial_018.html DOMIT_tutorial_019.html DOMIT_tutorial_020.html DOMIT_tutorial_021.html DOMIT_tutorial_022.html DOMIT_tutorial_023.html DOMIT_tutorial_024.html DOMIT_tutorial_025.html DOMIT_tutorial_026.html DOMIT_tutorial_027.html DOMIT_tutorial_028.html DOMIT_tutorial_029.html DOMIT_tutorial_030.html DOMIT_tutorial_031.html DOMIT_tutorial_032.html DOMIT_tutorial_033.html DOMIT_tutorial_034.html DOMIT_tutorial_035.html DOMIT_tutorial_036.html DOMIT_tutorial_037.html DOMIT_tutorial_038.html UIDGenerator.html classy_builder.html classy_builder.swf docstyles.css functions.js license.txt menu.html menu_tutorial.html package_DOMIT.html package_SAXY.html Log Message: Added the DOMIT library for XML schema creation/parsing --- NEW FILE: DOMIT_Comment.html --- <html> <head></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="classDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Class DOMIT_Comment</td> </tr> <tr> <td class="regular">A class representing the DOM Comment node (not present in DOMIT! Lite).</td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>yes<br /><b>isAbstract? </b>no</p></td> </tr> <tr> <td class="regular"><p><b>Inheritance tree: </b></p><p><center><br /><a href="DOMIT_Node.html">DOMIT_Node</a><br /><span class="branch">|</span><br /><a href="DOMIT_CharacterData.html">DOMIT_CharacterData</a><br /><span class="branch">|</span><br /><a href="DOMIT_Comment.html">DOMIT_Comment</a></center></p></td> </tr> <tr> <td class="regular"><p><b>Known subclasses: </b></p><p>None</p></td> </tr> <tr> <td class="regular"><p><b>Source file: </b>xml_domit_parser.php</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="constructorDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Constructor</td> </tr> <tr> <td class="regular">Initializes DOMIT_Comment variables and those of the superclass.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&DOMIT_Comment($text)</span></p></td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>no</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Fields</td> </tr> <tr> <td class="subsectionHeader">nodeName</td> </tr> <tr> <td class="regular">The name of the current node. For DOMIT_Comment, nodeName is #comment.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>String</p></td> </tr> <tr> <td class="subsectionHeader">nodeValue</td> </tr> <tr> <td class="regular">The value of the current node. For DOMIT_Comment, this represents the comment text contained in the node.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>String</p></td> </tr> <tr> <td class="subsectionHeader">nodeType</td> </tr> <tr> <td class="regular">An integer representing the type of the current node. For DOMIT_Comment, nodeType is 8.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>int</p></td> </tr> <tr> <td class="subsectionHeader">parentNode</td> </tr> <tr> <td class="regular">A reference to the node of which the current node is a child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">previousSibling</td> </tr> <tr> <td class="regular">A reference to the node prior to the current node in the childNodes list. Null if the current node is the first child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">nextSibling</td> </tr> <tr> <td class="regular">A reference to the node after the current node in the childNodes list. Null if the current node is the last child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">ownerDocument</td> </tr> <tr> <td class="regular">A reference to the DOMIT_Document. Null if the node has not yet been added to the document.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Document.html">DOMIT_Document</a></p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Fields</td> </tr> <tr> <td class="subsectionHeader">uid</td> </tr> <tr> <td class="regular">A unique id assigned to each node. Note that this id is non-persistent.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>int</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Methods</td> </tr> <tr> <td class="subsectionHeader">getText</td> </tr> <tr> <td class="regular">Returns the node value of the text node</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">getText()</span></p></td> </tr> <tr> <td class="subsectionHeader">setText</td> </tr> <tr> <td class="regular">Sets the nodeValue to the contents of $data.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">setText($data)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p><a href="string.html">string</a> <span class="parameter">data</span> - The text data of the node.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>The data added as the nodeValue of the comment node.</p><p><span class="code">$someComment->setText('This is a comment');</span></p></td> </tr> <tr> <td class="subsectionHeader">cloneNode</td> </tr> <tr> <td class="regular">Returns a copy of the specified node, and if $deep is set to true, all nodes below it in the hierarchy.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&cloneNode($deep)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>boolean <span class="parameter">deep</span> - True if the children below the cloned node are also to be cloned.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - The cloned node, with a clone of all subnodes if $deep is set to true.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>In the following example, a node named $styleTemplate is cloned, presumably so the user can create a new style based on the characteristics of the original node.</p><p><span class="code">$newStyle =& styleTemplate->cloneNode(false);</span></p></td> </tr> <tr> <td class="subsectionHeader">toString</td> </tr> <tr> <td class="regular">Generates an unformatted (single line, no whitespace) string representation of the comment.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">toString($htmlSafe = false)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>boolean <span class="parameter">htmlSafe</span> - If true, returns an html formatted representation of the string.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>String - A string representation of the comment.</p> </td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Methods</td> </tr> <tr> <td class="subsectionHeader">toArray</td> </tr> <tr> <td class="regular">Returns the text of the comment.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">toArray()</span></p></td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="string.html">string</a> - The text of the comment.</p> </td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: menu_tutorial.html --- <html> <head> <style type="text/css"> body { font-family: Arial, Verdana, sans; font-size: 8px; color: #000000; font-weight: normal; } td.sectionHeader { font-size: 12px; font-weight: bold; background-color: #E9DB6C; } td.subsectionHeader { font-size: 12px; font-weight: bold; background-color: #FFCC66; } td.regular { font-size: 12px; font-weight: normal; background-color: #FFFFFF; } td.params { font-size: 12px; font-weight: normal; background-color: #FFFFB5; } a:link { color: #CC9900; font-size: 12px; } a:visited { color: #CC9900; font-size: 12px; } a:hover { color: #000000; font-size: 12px; } a:active { color: #CC9900; font-size: 12px; } .code { font-family: Courier, monospace; color: #3366CC; } .parameter { font-weight: bold; color: #3366CC; } </style> <script language="javascript"> function displayClass(wName) { parent.classes.location = wName; } //displayClass </script> </head> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="menu"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="80%" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Menu</td> </tr> <tr> <td class="subsectionHeader">Package DOMIT</td> </tr> <tr> <td class="regular"> <a href="#" onclick="displayClass('DOMIT_tutorial_000.html')">Overview</a></td> </tr> <tr> <td class="subsectionHeader">Class List</td> </tr> <tr> <td class="regular"> <p><a href="#" onclick="displayClass('DOMIT_CDATASection.html')">DOMIT_CDATASection</a></p> <p><a href="#" onclick="displayClass('DOMIT_Document.html')">DOMIT_Document</a></p> <p><a href="#" onclick="displayClass('DOMIT_Element.html')">DOMIT_Element</a></p> <p><a href="#" onclick="displayClass('DOMIT_Node.html')">DOMIT_Node</a></p> <p><a href="#" onclick="displayClass('DOMIT_Parser.html')">DOMIT_Parser</a></p> <p><a href="#" onclick="displayClass('DOMIT_TextNode.html')">DOMIT_TextNode</a></p> <p><a href="#" onclick="displayClass('UIDGenerator.html')">UIDGenerator</a></p> </td> </tr> <tr> <td class="subsectionHeader">DOMIT Tutorial</td> </tr> <tr> <td class="regular"> <a href="#" onclick="displayClass('DOMIT_tutorial_000.html')">Take the DOMIT! tutorial.</a></td> </tr> <tr> <td class="subsectionHeader">ClassyDoc Utilities</td> </tr> <tr> <td class="regular"> <a href="#" onclick="displayClass('classy_builder.html')">Build / Edit a Package</a></td> </tr> </table> </td> </tr> </table> </div> </center> </body> </html> --- NEW FILE: DOMIT_NamedNodeMap_Attr.html --- <html> <head></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="classDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Class DOMIT_NamedNodeMap_Attr</td> </tr> <tr> <td class="regular">Provides a container for an unordered list of Attr nodes that can be accessed by their nodeNames.</td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>yes<br /><b>isAbstract? </b>no</p></td> </tr> <tr> <td class="regular"><p><b>Inheritance tree: </b></p><p><center><br /><a href="DOMIT_NamedNodeMap.html">DOMIT_NamedNodeMap</a><br /><span class="branch">|</span><br /><a href="DOMIT_NamedNodeMap_Attr.html">DOMIT_NamedNodeMap_Attr</a></center></p></td> </tr> <tr> <td class="regular"><p><b>Known subclasses: </b></p><p>None</p></td> </tr> <tr> <td class="regular"><p><b>Source file: </b>xml_domit_nodemaps.php</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="constructorDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Constructor</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Fields</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Fields</td> </tr> <tr> <td class="subsectionHeader">arNodeMap</td> </tr> <tr> <td class="regular">An associative array containing the list of DOMIT_Nodes.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>array</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Methods</td> </tr> <tr> <td class="subsectionHeader">item</td> </tr> <tr> <td class="regular">Returns the node at the specified index (0-based).</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&item($index)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>int <span class="parameter">index</span> - The index of the DOMIT_Node to be returned.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - The DOMIT_Node at the index specified, or null if nothing is found at that location.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>The third node in the node list is returned:</p><p><span class="code">$thirdNode =& myNodeList->item(2);</span></p></td> </tr> <tr> <td class="subsectionHeader">getLength</td> </tr> <tr> <td class="regular">Returns the number of nodes in the node map.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">getLength()</span></p></td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>int - The number of nodes in the node map.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>The number of nodes in the node map are returned:</p><p><span class="code">$numNodes = myNodeMap->getLength();</span></p></td> </tr> <tr> <td class="subsectionHeader">getNamedItem</td> </tr> <tr> <td class="regular">Gets the node with the specified nodeName from the list, or returns null.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&getNamedItem($name)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>String <span class="parameter">node</span> - The name of the node to be retrieved.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - The node to be returned.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>A node named "param" is returned from $myNodeMap:</p><p><span class="code">$returnedNode =& myNodeMap->getNamedItem("param");</span></p></td> </tr> <tr> <td class="subsectionHeader">setNamedItem</td> </tr> <tr> <td class="regular">Adds the specified node to the node map, using its nodeName as key. Overwrites an existing named item.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&setNamedItem(&$arg)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> <span class="parameter">arg</span> - The node to be added.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - Null, or the node that was overwritten if this is the case.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>A node is added to $myNodeMap:</p><p><span class="code">myNodeMap->setNamedItem($aNode);</span></p></td> </tr> <tr> <td class="subsectionHeader">removeNamedItem</td> </tr> <tr> <td class="regular">Removes the node with the specified nodeName from the node map.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&removeNamedItem($name)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>String <span class="parameter">name</span> - The nodeName of the node to be removed.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - The node that was just removed, or null if it wasn't found.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>A node named "param" is removed from $myNodeMap:</p><p><span class="code">$returnedNode =& myNodeMap->removeNamedItem("param");</span></p></td> </tr> <tr> <td class="subsectionHeader">toArray</td> </tr> <tr> <td class="regular">Returns an associative array representing the attributes list.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">toArray()</span></p></td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>array - An associative array representing the attributes list.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>Prints out an associative array representing the attributes list.</p><p><span class="code">print_r($myElement->attributes->toArray());</span></p></td> </tr> <tr> <td class="subsectionHeader">forHTML</td> </tr> <tr> <td class="regular">Formats a string for presentation as HTML.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">forHTML($str, $doPrint = false)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>String <span class="parameter">str</span> - The string to be formatted.</p> <p>boolean <span class="parameter">doPrint</span> - True if the string is to be sent directly to output.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>String - The HTML formatted string.</p> </td> </tr> <tr> <td class="subsectionHeader">toString</td> </tr> <tr> <td class="regular">Generates an unformatted (single line, no whitespace) string representation of the NamedNodeMap.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">toString($htmlSafe = false, $subEntities=false)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>boolean <span class="parameter">htmlSafe</span> - True if HTML readable output is desired.</p> <p>boolean <span class="parameter">subEntities</span> - True if illegal xml characters in text nodes and attributes should be converted to entities.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>String - An unformatted (single line, no whitespace) string representation of the NamedNodeMap.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>An unformatted string representation of the NamedNodeMap will be printed here:</p><p><span class="code">echo (htmlentities($myNodeMap->toString());</span></p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Methods</td> </tr> <tr> <td class="subsectionHeader">createClone</td> </tr> <tr> <td class="regular">Used by cloneNode() to generate a new instance of a DOMIT_NamedNodeMap containing the same data as the original.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&createClone($deep)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>boolean <span class="parameter">deep</span> - True if all subnodes are to be cloned.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_NamedNodeMap.html">DOMIT_NamedNodeMap</a> - A new DOMIT_NamedNodeMap</p> </td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: DOMIT_TextNode.html --- <html> <head></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="classDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Class DOMIT_TextNode</td> </tr> <tr> <td class="regular">A class representing the DOM TextNode.</td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>yes<br /><b>isAbstract? </b>no</p></td> </tr> <tr> <td class="regular"><p><b>Inheritance tree: </b></p><p><center><br /><a href="DOMIT_Node.html">DOMIT_Node</a><br /><span class="branch">|</span><br /><a href="DOMIT_CharacterData.html">DOMIT_CharacterData</a><br /><span class="branch">|</span><br /><a href="DOMIT_TextNode.html">DOMIT_TextNode</a></center></p></td> </tr> <tr> <td class="regular"><p><b>Known subclasses: </b></p><p>None</p></td> </tr> <tr> <td class="regular"><p><b>Source file: </b>xml_domit_parser.php</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="constructorDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Constructor</td> </tr> <tr> <td class="regular">Initializes DOMIT_TextNode variables and those of the superclass.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&DOMIT_TextNode($data)</span></p></td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>no</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Fields</td> </tr> <tr> <td class="subsectionHeader">nodeName</td> </tr> <tr> <td class="regular">The name of the current node. For DOMIT_TextNode, nodeName is #text.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>String</p></td> </tr> <tr> <td class="subsectionHeader">nodeValue</td> </tr> <tr> <td class="regular">The value of the current node. For DOMIT_TextNode, this represents the text contained in the node.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>String</p></td> </tr> <tr> <td class="subsectionHeader">nodeType</td> </tr> <tr> <td class="regular">An integer representing the type of the current node. For DOMIT_TextNode, nodeType is 3.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>int</p></td> </tr> <tr> <td class="subsectionHeader">parentNode</td> </tr> <tr> <td class="regular">A reference to the node of which the current node is a child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">previousSibling</td> </tr> <tr> <td class="regular">A reference to the node prior to the current node in the childNodes list. Null if the current node is the first child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">nextSibling</td> </tr> <tr> <td class="regular">A reference to the node after the current node in the childNodes list. Null if the current node is the last child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">ownerDocument</td> </tr> <tr> <td class="regular">A reference to the DOMIT_Document. Null if the node has not yet been added to the document.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Document.html">DOMIT_Document</a></p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Fields</td> </tr> <tr> <td class="subsectionHeader">uid</td> </tr> <tr> <td class="regular">A unique id assigned to each node. Note that this id is non-persistent.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>int</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Methods</td> </tr> <tr> <td class="subsectionHeader">splitText</td> </tr> <tr> <td class="regular">Splites the text node into two adjacent text nodes, based on the index specified.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">splitText($offset)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>int <span class="parameter">offset</span> - The point at which to split the text.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_TextNode.html">DOMIT_TextNode</a> - The new DOMIT_TextNode.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>The text will be split into two text nodes at its 4th character:</p><p><span class="code">$myTextNode =& $aTextNode->splitText(4););</span></p></td> </tr> <tr> <td class="subsectionHeader">getText</td> </tr> <tr> <td class="regular">Returns the node value of the text node</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">getText()</span></p></td> </tr> <tr> <td class="subsectionHeader">setText</td> </tr> <tr> <td class="regular">Sets the nodeValue to the contents of $data.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">setText($data)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p><a href="string.html">string</a> <span class="parameter">data</span> - The text data of the node.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>The data added as the nodeValue of the text node.</p><p><span class="code">$someTextNode->setText('This is some data');</span></p></td> </tr> <tr> <td class="subsectionHeader">cloneNode</td> </tr> <tr> <td class="regular">Returns a copy of the specified node, and if $deep is set to true, all nodes below it in the hierarchy.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&cloneNode($deep)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>boolean <span class="parameter">deep</span> - True if the children below the cloned node are also to be cloned.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - The cloned node, with a clone of all subnodes if $deep is set to true.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>In the following example, a node named $styleTemplate is cloned, presumably so the user can create a new style based on the characteristics of the original node.</p><p><span class="code">$newStyle =& styleTemplate->cloneNode(false);</span></p></td> </tr> <tr> <td class="subsectionHeader">toString</td> </tr> <tr> <td class="regular">Generates an unformatted (single line, no whitespace) string representation of the text node and all children.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">toString($htmlSafe = false, $subEntities = false)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p>boolean <span class="parameter">htmlSafe</span> - If true, returns an html formatted representation of the string.</p> <p>boolean <span class="parameter">subEntities</span> - True if illegal xml characters should be converted to entities.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>String - An unformatted (single line, no whitespace) string representation of the text node and all children.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>An unformatted string representation of the text node will be printed here:</p><p><span class="code">echo ($myTextNode->toString(true);</span></p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Methods</td> </tr> <tr> <td class="subsectionHeader">toArray</td> </tr> <tr> <td class="regular">Returns an array representation of the text node (its nodeValue).</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">toArray()</span></p></td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="string.html">string</a> - nodeValue</p> </td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: classy_builder.swf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: DOMIT_tutorial_031.html --- <html> <head><script type="text/javascript" src="functions.js"></script></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="tutorial"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader"><script type="text/javascript"> document.write(getTutorialTitle()); </script></td> </tr> <tr> <td class="subsectionHeader"><center> <script type="text/javascript"> document.write(generateMenu(31)); </script> </center></td> </tr> <tr> <td class="subsectionHeader">Namespaces and Attributes</td> </tr> <tr> <td class="regular"> <p>With a namespace aware parser, attributes are accessed and manipulated with a special set of namespace sensitive methods.</p> <p><b><u>getAttributeNS</u></b><p> <p>The <span class="code">getAttributeNS</span> method allows you to get the value of an attribute, by passing in the namespace URI and local name. If the attribute does not exist, an empty string is returned.</p> <p><pre class="code"> $myElement->getAttributeNS('http://www.engageinteractive.com/tests', 'score'); </pre></p> <p><b><u>setAttributeNS</u></b><p> <p>The <span class="code">setAttributeNS</span> method allows you to set the value of an existing attribute. A new attribute is created if one does not already exist. You must pass in the namespace URI and a qualified name along with the attribute value.</p> <p><pre class="code"> $myElement->setAttributeNS('http://www.engageinteractive.com/tests', 'ei:score', '95'); </pre></p> <p><b><u>removeAttributeNS</u></b><p> <p>The <span class="code">removeAttributeNS</span> method will remove the specified attribute if it exists. You must pass in the namespace URI and local name.</p> <p><pre class="code"> $myElement->removeAttributeNS('http://www.engageinteractive.com/tests', 'score'); </pre></p> <p><b><u>hasAttributeNS</u></b><p> <p>The <span class="code">hasAttributeNS</span> method returns true if the specified attribute exists. You must pass in the namespace URI and local name.</p> <p><pre class="code"> $doesExist = $myElement->hasAttributeNS('http://www.engageinteractive.com/tests', 'score'); </pre></p> <p><b><u>getAttributeNodeNS</u></b><p> <p>The <span class="code">getAttributeNodeNS</span> method will return a reference to the specified attribute node, or null if the node does not exist. You must pass in the namespace URI and local name. </p> <p><pre class="code"> $myAttribute =& $myElement->getAttributeNodeNS('http://www.engageinteractive.com/tests', 'score'); </pre></p> <p><b><u>setAttributeNodeNS</u></b><p> <p>The <span class="code">setAttributeNodeNS</span> method will append an attribute node to the attribute list of an element.</p> <p><pre class="code"> $myAttribute =& $xmldoc->createAttributeNS('http://www.engageinteractive.com/tests', 'ei:score'); $myElement->setAttributeNode($myAttribute); </pre></p> </td></tr> <tr> <td class="subsectionHeader"><center> <script type="text/javascript"> document.write(generateMenu(31)); </script> </center></td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com/opensource.html" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: DOMIT_tutorial_003.html --- <html> <head><script type="text/javascript" src="functions.js"></script></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="tutorial"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader"><script type="text/javascript"> document.write(getTutorialTitle()); </script></td> </tr> <tr> <td class="subsectionHeader"><center> <script type="text/javascript"> document.write(generateMenu(3)); </script> </center></td> </tr> <tr> <td class="subsectionHeader">The DOM Document</td> </tr> <tr> <td class="regular"><p>A DOM structure consists of a tree-like collection of objects called "Nodes" and a set of methods that one can use to traverse this hierarchy. The top-level object is referred to as a "Document". </p> <p>A DOM Document can be created from an XML string, like the following description of a person's cd music collection:</p> <p> <pre class="code"> <cdlibrary> <cd id="0001"> <name>Robbie Fulks</name> <title>Couples in Trouble</title> </cd> <cd id="0002"> <name>Richard Thompson</name> <title>Mock Tudor</title> </cd> <cd id="0003"> <name>Keller Williams</name> <title>Laugh</title> </cd> </cdlibrary> </pre></p> </td> </tr> <tr> <td class="subsectionHeader"><center> <script type="text/javascript"> document.write(generateMenu(3)); </script> </center></td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com/opensource.html" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: DOMIT_tutorial_038.html --- <html> <head><script type="text/javascript" src="functions.js"></script></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="tutorial"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader"><script type="text/javascript"> document.write(getTutorialTitle()); </script></td> </tr> <tr> <td class="subsectionHeader"><center> <script type="text/javascript"> document.write(generateMenu(38)); </script> </center></td> </tr> <tr> <td class="subsectionHeader">Contact</td> </tr> <tr> <td class="regular"><br /><br /><br /><p>Please visit the <a href="http://www.engageinteractive.com/domit/" target="_child"><b>DOMIT!</b> homepage</a>.<br /><br /><br /> </p> </td> </tr> <tr> <td class="subsectionHeader"><center> <script type="text/javascript"> document.write(generateMenu(38)); </script> </center></td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com/opensource.html" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: DOMIT_GetElementsByTagName.html --- <html> <head></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="classDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Class DOMIT_GetElementsByTagName</td> </tr> <tr> <td class="regular">For the generation of simple, unique ids</td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>yes<br /><b>isAbstract? </b>no</p></td> </tr> <tr> <td class="regular"><p><b>Inheritance tree: </b></p><p><center><a href="DOMIT_GetElementsByTagName.html">DOMIT_GetElementsByTagName</a> (top level class)</center></p></td> </tr> <tr> <td class="regular"><p><b>Known subclasses: </b></p><p>None</p></td> </tr> <tr> <td class="regular"><p><b>Source file: </b>xml_domit_getelementsbytagname.php</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="constructorDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Constructor</td> </tr> <tr> <td class="regular">Instantiates a new UIDGenerator object. Probably best to use this statically.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">UIDGenerator()</span></p></td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>yes</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Fields</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Fields</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Methods</td> </tr> <tr> <td class="subsectionHeader">generateUID</td> </tr> <tr> <td class="regular">Returns a unique id using the uniqid PHP function.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">generateUID()</span></p></td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p>String - A unique 17 character alphanumeric id, prefixed with the word "node". Its value is based on the current time in microseconds.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>A unique id can be generated by calling generateUID() with UIDGenerator as a static class:</p><p><span class="code">$newNodeID = UIDGenerator::generateUID();</span></p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Methods</td> </tr> </table> </td> </tr> </table> </div> <br /> <p class="docblurb">Documentation generated by <b>ClassyDoc</b>, using the <b>DOMIT!</b> and <b>SAXY</b> parsers.<br /> Please visit <a href="http://www.engageinteractive.com" target="_child">Engage Interactive</a> to download free copies.</p> <br /> </center> </body> </html> --- NEW FILE: DOMIT_Element.html --- <html> <head></head> <link rel="stylesheet" href="docstyles.css" /> <body bgcolor="#FFE394"> <br /><br /> <center> <div class="classDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Class DOMIT_Element</td> </tr> <tr> <td class="regular">A class representing the DOM Element.</td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>yes<br /><b>isAbstract? </b>no</p></td> </tr> <tr> <td class="regular"><p><b>Inheritance tree: </b></p><p><center><br /><a href="DOMIT_Node.html">DOMIT_Node</a><br /><span class="branch">|</span><br /><a href="DOMIT_ChildNodes_Interface.html">DOMIT_ChildNodes_Interface</a><br /><span class="branch">|</span><br /><a href="DOMIT_Element.html">DOMIT_Element</a></center></p></td> </tr> <tr> <td class="regular"><p><b>Known subclasses: </b></p><p>None</p></td> </tr> <tr> <td class="regular"><p><b>Source file: </b>xml_domit_parser.php</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="constructorDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Constructor</td> </tr> <tr> <td class="regular">Initializes DOMIT_Element variables and those of the superclass.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&DOMIT_Element($tagName)</span></p></td> </tr> <tr> <td class="regular"><p><b>isPublic? </b>no</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateConstantsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Constants</td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Fields</td> </tr> <tr> <td class="subsectionHeader">nodeName</td> </tr> <tr> <td class="regular">The name of the current node. For DOMIT_Element,the name of the tag.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>String</p></td> </tr> <tr> <td class="subsectionHeader">nodeValue</td> </tr> <tr> <td class="regular">The value of the current node. Null for DOMIT_Element.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>String</p></td> </tr> <tr> <td class="subsectionHeader">nodeType</td> </tr> <tr> <td class="regular">An integer representing the type of the current node. For DOMIT_Element, nodeType is 1.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>int</p></td> </tr> <tr> <td class="subsectionHeader">parentNode</td> </tr> <tr> <td class="regular">A reference to the node of which the current node is a child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">childNodes</td> </tr> <tr> <td class="regular">An array of node references of which the current node is parent. Null if the current node has no children.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>array</p></td> </tr> <tr> <td class="subsectionHeader">firstChild</td> </tr> <tr> <td class="regular">A reference to the first node in the childNodes list. Null if the current node has no children.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">lastChild</td> </tr> <tr> <td class="regular">A reference to the last node in the childNodes list. Null if the current node has no children.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">previousSibling</td> </tr> <tr> <td class="regular">A reference to the node prior to the current node in the childNodes list. Null if the current node is the first child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">nextSibling</td> </tr> <tr> <td class="regular">A reference to the node after the current node in the childNodes list. Null if the current node is the last child.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Node.html">DOMIT_Node</a></p></td> </tr> <tr> <td class="subsectionHeader">attributes</td> </tr> <tr> <td class="regular">A list of attributes for the current element (in DOMIT! Lite this is an associative array).</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_NamedNodeMap_Attr.html">DOMIT_NamedNodeMap_Attr</a></p></td> </tr> <tr> <td class="subsectionHeader">ownerDocument</td> </tr> <tr> <td class="regular">A reference to the DOMIT_Document. Null if the node has not yet been added to the document.</td> </tr> <tr> <td class="regular"><p><b>Type: </b><a href="DOMIT_Document.html">DOMIT_Document</a></p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="privateFieldsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Private Fields</td> </tr> <tr> <td class="subsectionHeader">uid</td> </tr> <tr> <td class="regular">A unique id assigned to each node. Note that this id is non-persistent.</td> </tr> <tr> <td class="regular"><p><b>Type: </b>int</p></td> </tr> </table> </td> </tr> </table> </div> <br /><br /><br /> <div class="publicMethodsDescription"> <table class="outer" border="0" cellspacing="0" cellpadding="0" width="440" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="8"> <tr> <td class="sectionHeader">Public Methods</td> </tr> <tr> <td class="subsectionHeader">appendChild</td> </tr> <tr> <td class="regular">Adds the specified node as a child of the current DOMIT_Element.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">appendChild(&$child)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p><a href="DOMIT_Element.html">DOMIT_Element</a> <span class="parameter">child</span> - The node that is to be appended.</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Element.html">DOMIT_Element</a> - The appended DOMIT_Elementnode.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>A child node is appended to the $myElement node:</p><p><span class="code">$myElement->appendChild($elementNode);</span></p></td> </tr> <tr> <td class="subsectionHeader">insertBefore</td> </tr> <tr> <td class="regular">Inserts node $newChild before $refChild in the childNodes of $this. If $refChild does not exist, $newChild is appended to the node chain.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">&insertBefore(&$newChild, &$refChild)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> <span class="parameter">newChild</span> - The new node to be added</p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> <span class="parameter">refChild</span> - The existing node before which the new node will be added</p> </td> </tr> <tr> <td class="regular"><p><b>Returns:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> - A reference to the new node being added.</p> </td> </tr> <tr> <td class="regular"><p><b>Example: </b> </p><p>The following example inserts a "Book" node named $goodNovel before another named $okNovel in a childNodes list named $bestSellers.</p><p><span class="code">$bestSellers->insertBefore($goodNovel, $okNovel);</span></p></td> </tr> <tr> <td class="subsectionHeader">replaceChild</td> </tr> <tr> <td class="regular">Replaces node $oldChild with $newChild.</td> </tr> <tr> <td class="regular"><p><b>Signature: </b><span class="code">replaceChild(&$newChild, &$oldChild)</span></p></td> </tr> <tr> <td class="regular"><p><b>Parameters:</b></p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> <span class="parameter">newChild</span> - The new node that is to replace the old node.</p> <p><a href="DOMIT_Node.html">DOMIT_Node</a> <span class="parameter">oldChild</span> - The old node that is to be replaced by the new node.</p> </td> </tr> <tr> <td class="regul... [truncated message content] |
Update of /cvsroot/stack/stack-1-0/other/domit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15524/other/domit Added Files: Tag: development_xmlrqp changelog.txt docs.html domit.html domitBanner.gif license.txt php_file_utilities.php php_http_client_generic.php php_http_client_include.php php_http_connector.php php_http_exceptions.php php_http_proxy.php testing_domit.css testing_domit.php timer.php tutorial.html xml_domit_cache.php xml_domit_doctor.php xml_domit_getelementsbypath.php xml_domit_include.php xml_domit_lite_include.php xml_domit_lite_parser.php xml_domit_nodemaps.php xml_domit_parser.php xml_domit_shared.php xml_domit_utilities.php xml_saxy_lite_parser.php xml_saxy_parser.php xml_saxy_shared.php Log Message: Added the DOMIT library for XML schema creation/parsing --- NEW FILE: docs.html --- <html> <head> <title>DOMIT! Documentation</title> </head> <frameset cols="300,*" frameborder="0" border="0"> <frame src="documentation/menu.html" name="menu" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <frame src="documentation/DOMIT.html" name="classes" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <noframes> <body> Your browser does not support frames. </body> </noframes> </frameset> </html> --- NEW FILE: xml_domit_lite_parser.php --- <?php /** * DOMIT! Lite is a non-validating, but lightweight and fast DOM parser for PHP * @package domit-xmlparser * @subpackage domit-xmlparser-lite * @version 0.18 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** current version of DOMIT! Lite */ define ('DOMIT_LITE_VERSION', '0.18'); [...1768 lines suppressed...] $pre = strtoupper(substr($data, 0, 3)); switch ($pre) { case '<![': //cdata section coming if ($this->preserveCDATA) { $this->inCDATASection = true; } break; case ']]>': //cdata remnant - ignore $currentNode =& $this->xmlDoc->createCDATASection($this->parseContainer); $this->lastChild->appendChild($currentNode); $this->inCDATASection = false; $this->parseContainer = ''; break; } } } //defaultDataElement } //DOMIT_Parser ?> --- NEW FILE: xml_saxy_shared.php --- <?php /** * SAXY_Parser_Base is a base class for SAXY and SAXY Lite * @package saxy-xmlparser * @version 0.87 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/saxy/ SAXY Home Page * SAXY is Free Software **/ /** the initial characters of a cdata section */ define('SAXY_SEARCH_CDATA', '![CDATA['); /** the length of the initial characters of a cdata section */ define('SAXY_CDATA_LEN', 8); /** the initial characters of a notation */ define('SAXY_SEARCH_NOTATION', '!NOTATION'); /** the initial characters of a doctype */ define('SAXY_SEARCH_DOCTYPE', '!DOCTYPE'); /** saxy parse state, just before parsing an attribute */ define('SAXY_STATE_ATTR_NONE', 0); /** saxy parse state, parsing an attribute key */ define('SAXY_STATE_ATTR_KEY', 1); /** saxy parse state, parsing an attribute value */ define('SAXY_STATE_ATTR_VALUE', 2); /** * The base SAX Parser class * * @package saxy-xmlparser * @author John Heinstein <joh...@nb...> */ class SAXY_Parser_Base { /** @var int The current state of the parser */ var $state; /** @var int A temporary container for parsed characters */ var $charContainer; /** @var Object A reference to the start event handler */ var $startElementHandler; /** @var Object A reference to the end event handler */ var $endElementHandler; /** @var Object A reference to the data event handler */ var $characterDataHandler; /** @var Object A reference to the CDATA Section event handler */ var $cDataSectionHandler = null; /** @var boolean True if predefined entities are to be converted into characters */ var $convertEntities = true; /** @var Array Translation table for predefined entities */ var $predefinedEntities = array('&' => '&', '<' => '<', '>' => '>', '"' => '"', ''' => "'"); /** @var Array User defined translation table for entities */ var $definedEntities = array(); /** * Constructor for SAX parser */ function SAXY_Parser_Base() { $this->charContainer = ''; } //SAXY_Parser_Base /** * Sets a reference to the handler for the start element event * @param mixed A reference to the start element handler */ function xml_set_element_handler($startHandler, $endHandler) { $this->startElementHandler = $startHandler; $this->endElementHandler = $endHandler; } //xml_set_element_handler /** * Sets a reference to the handler for the data event * @param mixed A reference to the data handler */ function xml_set_character_data_handler($handler) { $this->characterDataHandler =& $handler; } //xml_set_character_data_handler /** * Sets a reference to the handler for the CDATA Section event * @param mixed A reference to the CDATA Section handler */ function xml_set_cdata_section_handler($handler) { $this->cDataSectionHandler =& $handler; } //xml_set_cdata_section_handler /** * Sets whether predefined entites should be replaced with their equivalent characters during parsing * @param boolean True if entity replacement is to occur */ function convertEntities($truthVal) { $this->convertEntities = $truthVal; } //convertEntities /** * Appends an array of entity mappings to the existing translation table * * Intended mainly to facilitate the conversion of non-ASCII entities into equivalent characters * * @param array A list of entity mappings in the format: array('&' => '&'); */ function appendEntityTranslationTable($table) { $this->definedEntities = $table; } //appendEntityTranslationTable /** * Gets the nth character from the end of the string * @param string The text to be queried * @param int The index from the end of the string * @return string The found character */ function getCharFromEnd($text, $index) { $len = strlen($text); $char = $text{($len - 1 - $index)}; return $char; } //getCharFromEnd /** * Parses the attributes string into an array of key / value pairs * @param string The attribute text * @return Array An array of key / value pairs */ function parseAttributes($attrText) { $attrText = trim($attrText); $attrArray = array(); $maybeEntity = false; $total = strlen($attrText); $keyDump = ''; $valueDump = ''; $currentState = SAXY_STATE_ATTR_NONE; $quoteType = ''; for ($i = 0; $i < $total; $i++) { $currentChar = $attrText{$i}; if ($currentState == SAXY_STATE_ATTR_NONE) { if (trim($currentChar != '')) { $currentState = SAXY_STATE_ATTR_KEY; } } switch ($currentChar) { case "\t": if ($currentState == SAXY_STATE_ATTR_VALUE) { $valueDump .= $currentChar; } else { $currentChar = ''; } break; case "\x0B": //vertical tab case "\n": case "\r": $currentChar = ''; break; case '=': if ($currentState == SAXY_STATE_ATTR_VALUE) { $valueDump .= $currentChar; } else { $currentState = SAXY_STATE_ATTR_VALUE; $quoteType = ''; $maybeEntity = false; } break; case '"': if ($currentState == SAXY_STATE_ATTR_VALUE) { if ($quoteType == '') { $quoteType = '"'; } else { if ($quoteType == $currentChar) { if ($this->convertEntities && $maybeEntity) { $valueDump = strtr($valueDump, $this->predefinedEntities); $valueDump = strtr($valueDump, $this->definedEntities); } $attrArray[trim($keyDump)] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; } else { $valueDump .= $currentChar; } } } break; case "'": if ($currentState == SAXY_STATE_ATTR_VALUE) { if ($quoteType == '') { $quoteType = "'"; } else { if ($quoteType == $currentChar) { if ($this->convertEntities && $maybeEntity) { $valueDump = strtr($valueDump, $this->predefinedEntities); $valueDump = strtr($valueDump, $this->definedEntities); } $attrArray[trim($keyDump)] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; } else { $valueDump .= $currentChar; } } } break; case '&': //might be an entity $maybeEntity = true; $valueDump .= $currentChar; break; default: if ($currentState == SAXY_STATE_ATTR_KEY) { $keyDump .= $currentChar; } else { $valueDump .= $currentChar; } } } return $attrArray; } //parseAttributes /** * Parses character data * @param string The character data */ function parseBetweenTags($betweenTagText) { if (trim($betweenTagText) != ''){ $this->fireCharacterDataEvent($betweenTagText); } } //parseBetweenTags /** * Fires a start element event * @param string The start element tag name * @param Array The start element attributes */ function fireStartElementEvent($tagName, $attributes) { call_user_func($this->startElementHandler, $this, $tagName, $attributes); } //fireStartElementEvent /** * Fires an end element event * @param string The end element tag name */ function fireEndElementEvent($tagName) { call_user_func($this->endElementHandler, $this, $tagName); } //fireEndElementEvent /** * Fires a character data event * @param string The character data */ function fireCharacterDataEvent($data) { if ($this->convertEntities && ((strpos($data, "&") != -1))) { $data = strtr($data, $this->predefinedEntities); $data = strtr($data, $this->definedEntities); } call_user_func($this->characterDataHandler, $this, $data); } //fireCharacterDataEvent /** * Fires a CDATA Section event * @param string The CDATA Section data */ function fireCDataSectionEvent($data) { call_user_func($this->cDataSectionHandler, $this, $data); } //fireCDataSectionEvent } //SAXY_Parser_Base ?> --- NEW FILE: xml_domit_shared.php --- <?php /** * @package domit-xmlparser * @version 0.98 * @copyright (C) 2004 John Heinstein. All rights reserved * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { /* Path to DOMIT! files */ define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } //Nodes /** DOM Element nodeType */ define('DOMIT_ELEMENT_NODE', 1); /** DOM Attr nodeType */ define('DOMIT_ATTRIBUTE_NODE', 2); /** DOM Text nodeType */ define('DOMIT_TEXT_NODE', 3); /** DOM CDATA Section nodeType */ define('DOMIT_CDATA_SECTION_NODE', 4); /** DOM Entity Reference nodeType */ define('DOMIT_ENTITY_REFERENCE_NODE', 5); /** DOM Entity nodeType */ define('DOMIT_ENTITY_NODE', 6); /** DOM Processing Instruction nodeType */ define('DOMIT_PROCESSING_INSTRUCTION_NODE', 7); /** DOM Comment nodeType */ define('DOMIT_COMMENT_NODE', 8); /** DOM Document nodeType */ define('DOMIT_DOCUMENT_NODE', 9); /** DOM DocType nodeType */ define('DOMIT_DOCUMENT_TYPE_NODE', 10); /** DOM Document Fragment nodeType */ define('DOMIT_DOCUMENT_FRAGMENT_NODE', 11); /** DOM Notation nodeType */ define('DOMIT_NOTATION_NODE', 12); //DOM Level 1 Exceptions /** DOM error: array index out of bounds */ define('DOMIT_INDEX_SIZE_ERR', 1); /** DOM error: text doesn't fit into a DOMString */ define('DOMIT_DOMSTRING_SIZE_ERR', 2); /** DOM error: node can't be inserted at this location */ define('DOMIT_HIERARCHY_REQUEST_ERR', 3); /** DOM error: node not a child of target document */ define('DOMIT_WRONG_DOCUMENT_ERR', 4); /** DOM error: invalid character specified */ define('DOMIT_INVALID_CHARACTER_ERR', 5); /** DOM error: data can't be added to current node */ define('DOMIT_NO_DATA_ALLOWED_ERR', 6); /** DOM error: node is read-only */ define('DOMIT_NO_MODIFICATION_ALLOWED_ERR', 7); /** DOM error: node can't be found in specified context */ define('DOMIT_NOT_FOUND_ERR', 8); /** DOM error: operation not supported by current implementation */ define('DOMIT_NOT_SUPPORTED_ERR', 9); /** DOM error: attribute currently in use elsewhere */ define('DOMIT_INUSE_ATTRIBUTE_ERR', 10); //DOM Level 2 Exceptions /** DOM error: attempt made to use an object that is no longer usable */ define('DOMIT_INVALID_STATE_ERR', 11); /** DOM error: invalid or illegal string specified */ define('DOMIT_SYNTAX_ERR', 12); /** DOM error: can't modify underlying type of node */ define('DOMIT_INVALID_MODIFICATION_ERR', 13); /** DOM error: attempt to change node in a way incompatible with namespaces */ define('DOMIT_NAMESPACE_ERR', 14); /** DOM error: operation unsupported by underlying object */ define('DOMIT_INVALID_ACCESS_ERR', 15); //DOMIT! Exceptions /** DOM error: attempt to instantiate abstract class */ define('DOMIT_ABSTRACT_CLASS_INSTANTIATION_ERR', 100); /** DOM error: attempt to call abstract method */ define('DOMIT_ABSTRACT_METHOD_INVOCATION_ERR', 101); /** DOM error: can't perform this action on or with Document Fragment */ define('DOMIT_DOCUMENT_FRAGMENT_ERR', 102); /** *@global Object Instance of the UIDGenerator class */ $GLOBALS['uidFactory'] = new UIDGenerator(); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_nodemaps.php'); /** * Generates unique ids for each node * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class UIDGenerator { /** @var int A seed value for generating uids */ var $seed; /** @var int A tally of the number of uids generated */ var $counter = 0; /** * UIDGenerator constructor */ function UIDGenerator() { $this->seed = 'node' . time(); } //UIDGenerator /** * Generates a unique id * @return uid */ function generateUID() { return ($this->seed . $this->counter++); } //generateUID } //UIDGenerator /** * A DOMIT! exception handling class * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_DOMException { /** * Raises the specified exception * @param int The error number * @param string A string explanation of the error */ function raiseException($errorNum, $errorString) { $errorMessage = 'Error: ' . $errorNum . "\n " . $errorString; if ((!isset($GLOBALS['DOMIT_ERROR_FORMATTING_HTML'])) || ($GLOBALS['DOMIT_ERROR_FORMATTING_HTML'] == true)) { $errorMessage = "<p><pre>" . $errorMessage . "</pre></p>"; } die($errorMessage); } //raiseException } //DOMIT_DOMException /** * A class representing the DOM Implementation node * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_DOMImplementation { function hasFeature($feature, $version = null) { if (strtoupper($feature) == 'XML') { if (($version == '1.0') || ($version == '2.0') || ($version == null)) { return true; } } return false; } //hasFeature /** * Creates a new DOMIT_Document node and appends a documentElement with the specified info * @param string The namespaceURI of the documentElement * @param string The $qualifiedName of the documentElement * @param Object A document type node * @return Object The new document fragment node */ function &createDocument($namespaceURI, $qualifiedName, &$docType) { $xmldoc =& new DOMIT_Document(); $documentElement =& $xmldoc->createElementNS($namespaceURI, $qualifiedName); $xmldoc->setDocumentElement($documentElement); if ($docType != null) { $xmldoc->doctype =& $docType; } return $xmldoc; } //createDocument /** * Creates a new DOMIT_DocumentType node (not yet implemented!) * @param string The $qualifiedName * @param string The $publicID * @param string The $systemID * @return Object The new document type node */ function &createDocumentType($qualifiedName, $publicID, $systemID) { //not yet implemented DOMIT_DOMException::raiseException(DOMIT_NOT_SUPPORTED_ERROR, ('Method createDocumentType is not yet implemented.')); } //createDocumentType } //DOMIT_DOMImplementation ?> --- NEW FILE: xml_domit_doctor.php --- <?php /** * DOMIT! Doctor is a set of utilities for repairing malformed XML * @package domit-xmlparser * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ /** * A (static) class containing utilities for repairing malformed XML * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class domit_doctor { /** * Looks for illegal ampersands and converts them to entities * @param string The xml text to be repaired * @return string The repaired xml text */ function fixAmpersands($xmlText) { $xmlText = trim($xmlText); $startIndex = -1; $processing = true; $illegalChar = '&'; while ($processing) { $startIndex = strpos($xmlText, $illegalChar, ($startIndex + 1)); if ($startIndex !== false) { $xmlText = domit_doctor::evaluateCharacter($xmlText, $illegalChar, ($startIndex + 1)); } else { $processing = false; } } return $xmlText; } //fixAmpersands /** * Evaluates whether an ampersand should be converted to an entity, and performs the conversion * @param string The xml text * @param string The (ampersand) character * @param int The character index immediately following the ampersand in question * @return string The repaired xml text */ function evaluateCharacter($xmlText, $illegalChar, $startIndex) { $total = strlen($xmlText); $searchingForCDATASection = false; for ($i = $startIndex; $i < $total; $i++) { $currChar = substr($xmlText, $i, 1); if (!$searchingForCDATASection) { switch ($currChar) { case ' ': case "'": case '"': case "\n": case "\r": case "\t": case '&': case "]": $searchingForCDATASection = true; break; case ";": return $xmlText; break; } } else { switch ($currChar) { case '<': case '>': return (substr_replace($xmlText, '&', ($startIndex - 1) , 1)); break; case "]": return $xmlText; break; } } } return $xmlText; } //evaluateCharacter } //domit_doctor ?> --- NEW FILE: xml_domit_parser.php --- <?php /** * DOMIT! is a non-validating, but lightweight and fast DOM parser for PHP * @package domit-xmlparser * @subpackage domit-xmlparser-main * @version 0.99 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** current version of DOMIT! */ define ('DOMIT_VERSION', '0.99'); [...3306 lines suppressed...] * @param string The namespace prefix * @param string The namespace uri */ function startNamespaceDeclaration(&$parser, $prefix, $uri) { //make uri lower case because Expat forces it to upper case for some reason $this->namespaceURIMap[strtolower($uri)] = $prefix; } //startNamespaceDeclaration /** * Catches an end namespace declaration event * @param Object A reference to the current SAX parser * @param string The namespace prefix */ function endNamespaceDeclaration(&$parser, $prefix) { //do nothing; could remove from map, but would hardly be optimal } //endNamespaceDeclaration } //DOMIT_Parser ?> --- NEW FILE: xml_domit_getelementsbypath.php --- <?php /** * @package domit-xmlparser * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** Separator for elements path */ define('GET_ELEMENTS_BY_PATH_SEPARATOR', '/'); /** Constant for an absolute path search (starting at the document root) */ define('GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE', 0); /** Constant for a relative path search (starting at the level of the calling node) */ define('GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE', 1); /** Constant for a variable path search (finds all matches, regardless of place in the hierarchy) */ define('GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE', 2); /** * getElementsByPath is a simple utility for path-based access to nodes in a DOMIT! document. */ class DOMIT_GetElementsByPath { /** @var Object The node from which the search is called */ var $callingNode; /** @var int The type of search to be performed, i.e., relative, absolute, or variable */ var $searchType; /** @var Object The node that is the current parent of the search */ var $contextNode; /** @var array An array containing a series of path segments for which to search */ var $arPathSegments = array(); /** @var Object A DOMIT_NodeList of matching nodes */ var $nodeList; /** @var Object The index of the current node of the search */ var $targetIndex; /** @var Object if true, the search will be aborted once the first match is found */ var $abortSearch = false; /** * Constructor - creates an empty DOMIT_NodeList to store matching nodes */ function DOMIT_GetElementsByPath() { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_nodemaps.php'); $this->nodeList =& new DOMIT_NodeList(); } //DOMIT_GetElementsByPath /** * Parses the supplied "path"-based pattern * @param Object The node from which the search is called * @param string The pattern * @param int The node level of the current search * @return Object The NodeList containing matching nodes */ function &parsePattern(&$node, $pattern, $nodeIndex = 0) { $this->callingNode =& $node; $pattern = trim($pattern); $this->determineSearchType($pattern); $this->setContextNode(); $this->splitPattern($pattern); $this->targetIndex = $nodeIndex; $totalSegments = count($this->arPathSegments); if ($totalSegments > 0) { if ($this->searchType == GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE) { $arContextNodes =& $this->contextNode->ownerDocument->getElementsByTagName($this->arPathSegments[0]); $totalContextNodes = $arContextNodes->getLength(); for ($i = 0; $i < $totalContextNodes; $i++) { $this->selectNamedChild($arContextNodes->item($i), 1); } } else { if ($this->searchType == GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE) { if ($this->contextNode->nodeName == $this->arPathSegments[0]) { if (count($this->arPathSegments) == 1) { $this->nodeList->appendNode($this->contextNode); } else { $this->selectNamedChild($this->contextNode, 1); } } } else if ($this->searchType == GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE) { $this->selectNamedChild($this->contextNode, 0); } } } if ($nodeIndex > 0) { if ($nodeIndex <= $this->nodeList->getLength()) { return $this->nodeList->item(($nodeIndex - 1)); } else { return null; } } return $this->nodeList; } //parsePattern /** * Determines the type of search to be performed: absolute, relative, or variable * @param string The pattern */ function determineSearchType($pattern) { $firstChar = $pattern{0}; if ($firstChar != GET_ELEMENTS_BY_PATH_SEPARATOR) { //relative path $this->searchType = GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE; } else { $secondChar = $pattern{1}; if ($secondChar != GET_ELEMENTS_BY_PATH_SEPARATOR) { //absolute path $this->searchType = GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE; } else { //variable path $this->searchType = GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE; } } } //determineSearchType /** * Sets the context node, i.e., the node from which the search begins */ function setContextNode() { switch($this->searchType) { case GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE: $this->contextNode =& $this->callingNode->ownerDocument->documentElement; break; case GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE: if ($this->callingNode->uid != $this->callingNode->ownerDocument->uid) { $this->contextNode =& $this->callingNode; } else { $this->contextNode =& $this->callingNode->ownerDocument->documentElement; } break; case GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE: $this->contextNode =& $this->callingNode->ownerDocument->documentElement; break; } } //setContextNode /** * Splits the supplied pattern into searchable segments * @param string The pattern */ function splitPattern($pattern) { switch($this->searchType) { case GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE: $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, 1)); break; case GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE: $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, 0)); break; case GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE: $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, 2)); break; } } //splitPattern /** * Matches the current path segment against the child nodes of the current context node * @param Object The context node * @param int The index in the arPathSegments array of the current path segment */ function selectNamedChild(&$node, $pIndex) { if (!$this->abortSearch) { if ($pIndex < count($this->arPathSegments)) { //not at last path segment $name = $this->arPathSegments[$pIndex]; $numChildren = $node->childCount; for ($i = 0; $i < $numChildren; $i++) { $currentChild =& $node->childNodes[$i]; if ($currentChild->nodeName == $name) { $this->selectNamedChild($currentChild, ($pIndex + 1)); } } } else { $this->nodeList->appendNode($node); if ($this->targetIndex == $this->nodeList->getLength()) { $this->abortSearch = true; } } } } //selectNamedChild } //DOMIT_GetElementsByPath /** * getElementsByAttributePath is a temporary utility requested by a DOMIT! user for path-based access to attributes in a DOMIT! document. * This class may be absent from future versions of DOMIT! */ class DOMIT_GetElementsByAttributePath { /** @var Object A DOMIT_NodeList of matching attribute nodes */ var $nodeList; /** * Constructor - creates an empty DOMIT_NodeList to store matching nodes */ function DOMIT_GetElementsByAttributePath() { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_nodemaps.php'); $this->nodeList =& new DOMIT_NodeList(); } //DOMIT_GetElementsByAttributePath /** * Matches the current path segment against the child nodes of the current context node * @param Object The context node * @param string The pattern * @param int The index of the current path segment */ function &parsePattern(&$node, $pattern, $nodeIndex = 0) { $beginSquareBrackets = strpos($pattern, '['); if ($beginSquareBrackets != 0) { $path = substr($pattern, 0, $beginSquareBrackets); $attrPattern = substr($pattern, (strpos($pattern, '@') + 1)); $attrPattern = substr($attrPattern, 0, strpos($attrPattern, ')')); $commaIndex = strpos($attrPattern, ','); $key = trim(substr($attrPattern, 0, $commaIndex)); $value = trim(substr($attrPattern, ($commaIndex + 1))); $value = substr($value, 1, (strlen($value) - 2)); $gebp = new DOMIT_GetElementsByPath(); $myResponse =& $gebp->parsePattern($node, $path); $total = $myResponse->getLength(); for ($i = 0; $i < $total; $i++) { $currNode =& $myResponse->item($i); if ($currNode->hasAttribute($key)) { if ($currNode->getAttribute($key) == $value) { $this->nodeList->appendNode($currNode); } } } } if ($nodeIndex == 0) { return $this->nodeList; } else { if ($nodeIndex <= $this->nodeList->getLength()) { return $this->nodeList->item(($nodeIndex - 1)); } else { $this->nodeList = new DOMIT_NodeList(); return $this->nodeList; } } } //parsePattern } //DOMIT_GetElementsByAttributePath ?> --- NEW FILE: xml_domit_nodemaps.php --- <?php /** * DOMIT node maps are structures for storing and accessing collections of DOMIT_Nodes. * @package domit-xmlparser * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** * A DOM NodeList implementation * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_NodeList { /** @var Array A container for the nodes in the list */ var $arNodeList = array(); /** * Return the node at the specified index * @param int The index of the requested node * @return Object A reference to the requested node, or null */ function &item($index) { if ($index < $this->getLength()) { return $this->arNodeList[$index]; } return null; } //item /** * Returns the number of nodes in the list * @return int The number of nodes in the list */ function getLength() { return count($this->arNodeList); } //getLength /** * Appends a node to the list * @return Object The appended node */ function &appendNode(&$node) { $this->arNodeList[] =& $node; return $node; } //appendNode /** * Removes the specified node from the list * @param Object A reference to the node to be removed * @return Object A reference to the removed node */ function &removeNode(&$node) { $total = $this->getLength(); $returnNode = null; $found = false; for ($i = 0; $i < $total; $i++) { if (!$found) { if ($node->uid == $this->arNodeList[$i]->uid) { $found = true; $returnNode=& $node; } } if ($found) { if ($i == ($total - 1)) { unset($this->arNodeList[$i]); } else { $this->arNodeList[$i] =& $this->arNodeList[($i + 1)]; } } } return $returnNode; } //$removeNode /** * Formats a string for presentation as HTML * @param string The string to be formatted * @param boolean True if the string is to be sent directly to output * @return string The HTML formatted string */ function forHTML($str, $doPrint = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); return DOMIT_Utilities::forHTML($str, $doPrint); } //forHTML /** * Generates an array representation of the node and its children * @return Array A representation of the node and its children */ function toArray() { return $this->arNodeList; } //toArray /** * Copies a node and/or its children * @param boolean True if all child nodes are also to be cloned * @return Object A copy of the node and/or its children */ function &createClone($deep = false) { $className = get_class($this); $clone =& new $className(); foreach ($this->arNodeList as $key => $value) { $currNode =& $this->arNodeList[$key]; $clone->arNodeList[$key] =& $currNode->cloneNode($deep); } return $clone; } //createClone /** * Generates a string representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeList as $key => $value) { $currNode =& $this->arNodeList[$key]; $result .= $currNode->toString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toString } //DOMIT_NodeList /** * A DOM NamedNodeMap implementation * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_NamedNodeMap { /** @var Array A container for the nodes in the map */ var $arNodeMap = array(); /** @var Array A numerical index to the keys of the mapped nodes */ var $indexedNodeMap = array(); /** @var boolean True if the list has been modified and $indexedNodeMap needs reindexing */ var $isDirty = true; /** * Gets a node with the specifed name * @param string The name of the node * @return mixed A reference to the requested node, or null */ function &getNamedItem($name) { if (isset($this->arNodeMap[$name])) { return $this->arNodeMap[$name]; } return null; } //getNamedItem /** * Reindexes the numerical index for the named node map */ function reindexNodeMap() { $this->indexedNodeMap = array(); foreach ($this->arNodeMap as $key => $value) { $this->indexedNodeMap[] = $key; } $this->isDirty = false; } //reindexNodeMap /** * Assigns a node to the list * @param Object A reference to the node to be assigned * @return Object A reference to the assigned node */ function &setNamedItem(&$arg) { $returnNode = null; if (isset($this->arNodeMap[$arg->nodeName])) { $returnNode =& $this->arNodeMap[$arg->nodeName]; } else { $this->isDirty = true; } $this->arNodeMap[$arg->nodeName] =& $arg; return $returnNode; } //setNamedItem /** * Removes a node from the list, by name * @param string The name of the node to be removed * @return mixed A reference to the removed node, or null */ function &removeNamedItem($name) { $returnNode = null; if (isset($this->arNodeMap[$name])) { $returnNode =& $this->arNodeMap[$name]; unset($this->arNodeMap[$name]); $this->isDirty = true; } return $returnNode; } //removeNamedItem /** * Gets a node with the specifed name, taking into account namespaces * @param string The namespaceURI of the node * @param string The localName of the node * @return mixed A reference to the requested node, or null */ function &getNamedItemNS($namespaceURI, $localName) { $key = $this->getKeyNS($namespaceURI, $localName); if (isset($this->arNodeMap[$key])) { return $this->arNodeMap[$key]; } return null; } //getNamedItemNS /** * Assigns a node to the list, using its namespaceURI and localName * @param Object A reference to the node to be assigned * @return Object A reference to the assigned node */ function &setNamedItemNS(&$arg) { $returnNode = null; $key = $this->getKeyNS($arg->namespaceURI, $arg->localName); if (isset($this->arNodeMap[$key])) { $returnNode =& $this->arNodeMap[$key]; } else { $this->isDirty = true; } $this->arNodeMap[$key] =& $arg; return $returnNode; } //setNamedItemNS /** * Removes a node from the list, by name, by local name and namespace URI * @param string The namespaceURI of the node to be removed * @param string The localName of the node to be removed * @return mixed A reference to the removed node, or null */ function &removeNamedItemNS($namespaceURI, $localName) { $returnNode = null; $key = $this->getKeyNS($namespaceURI, $localName); if (isset($this->arNodeMap[$key])) { $returnNode =& $this->arNodeMap[$key]; unset($this->arNodeMap[$key]); $this->isDirty = true; } return $returnNode; } //removeNamedItemNS /** * Returns the key of the NamedNodeMap, given the namespaceURI and localName * @param string The namespaceURI of the node to be removed * @param string The localName of the node to be removed * @return string The key of the NamedNodeMap */ function getKeyNS($namespaceURI, $localName) { if ($namespaceURI != '') { return $namespaceURI . ":" . $localName; } return $localName; } //getKeyNS /** * Return the node at the specified index * @param int The index of the requested node * @return mixed A reference to the requested node, or null */ function &item($index) { if ($this->isDirty) $this->reindexNodeMap(); return $this->arNodeMap[$this->indexedNodeMap[$index]]; } //item /** * Returns the number of nodes in the map * @return int The number of nodes in the map */ function getLength() { return count($this->arNodeMap); } //getLength /** * Formats a string for presentation as HTML * @param string The string to be formatted * @param boolean True if the string is to be sent directly to output * @return string The HTML formatted string */ function forHTML($str, $doPrint = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); return DOMIT_Utilities::forHTML($str, $doPrint); } //forHTML /** * Generates an array representation of the node and its children * @return Array A representation of the node and its children */ function toArray() { return $this->arNodeMap; } //toArray /** * Copies a node and/or its children * @param boolean True if all child nodes are also to be cloned * @return Object A copy of the node and/or its children */ function &createClone($deep = false) { $className = get_class($this); $clone =& new $className(); foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $clone->arNodeMap[$key] =& $currNode->cloneNode($deep); } return $clone; } //createClone /** * Generates a string representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $result .= $currNode->toString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toString } //DOMIT_NamedNodeMap /** * A NamedNodeMap with specialized funtionality for Attribute nodes * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_NamedNodeMap_Attr extends DOMIT_NamedNodeMap { /** * Generates an array representation of the node and its children * @return Array A representation of the node and its children */ function toArray() { $arReturn = array(); foreach ($this->arNodeMap as $key => $value) { $arReturn[$key] = $this->arNodeMap[$key]->getValue(); } return $arReturn; } //toArray /** * Generates a string representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $result .= $currNode->toString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toString } //DOMIT_NamedNodeMap_Attr ?> --- NEW FILE: tutorial.html --- <html> <head> <title>DOMIT! Documentation</title> </head> <frameset cols="300,*" frameborder="0" border="0"> <frame src="documentation/menu.html" name="menu" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <frame src="documentation/DOMIT_tutorial_000.html" name="classes" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <noframes> <body> Your browser does not support frames. </body> </noframes> </frameset> </html> --- NEW FILE: testing_domit.css --- body { color: #000000; background-color: #FFFFFF; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; } pre { font-family: Arial, Verdana, sans-serif; font-size: 12px; font-style: bold; } body a:link { color: darkgreen; font-family: Arial, Verdana, sans-serif; } body a:visited { color: darkgreen; font-family: Arial, Verdana, sans-serif; } img { text-align: center; border: 0; } h2 { color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 18px; font-style: bold; } .row0 { color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 12px; font-style: bold; } .row1 { color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 18px; font-style: bold; } --- NEW FILE: xml_domit_lite_include.php --- <?php /** * @package domit-xmlparser * @subpackage domit-xmlparser-lite * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ /** The file system path to the domit library */ define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_lite_parser.php'); ?> --- NEW FILE: php_file_utilities.php --- <?php if (!defined('PHP_TEXT_CACHE_INCLUDE_PATH')) { define('PHP_TEXT_CACHE_INCLUDE_PATH', (dirname(__FILE__) . "/")); } class php_file_utilities { /** * Retrieves binary or text data from the specified file * @param string The file path * @param string The attributes for the read operation ('r' or 'rb') * @return mixed he text or binary data contained in the file */ function &getDataFromFile($filename, $readAttributes, $readSize = 8192) { $fileContents = null; $fileHandle = @fopen($filename, $readAttributes); if($fileHandle){ do { $data = fread($fileHandle, $readSize); if (strlen($data) == 0) { break; } $fileContents .= $data; } while (true); fclose($fileHandle); } return $fileContents; } //getDataFromFile /** * Writes the specified binary or text data to a file * @param string The file path * @param mixed The data to be written * @param string The attributes for the write operation ('w' or 'wb') */ function putDataToFile($fileName, &$data, $writeAttributes) { $fileHandle = @fopen($fileName, $writeAttributes); if ($fileHandle) { fwrite($fileHandle, $data); fclose($fileHandle); } } //putDataToFile } //php_file_utilities ?> --- NEW FILE: php_http_client_include.php --- <?php define('PHP_HTTP_TOOLS_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_client_generic.php'); ?> --- NEW FILE: xml_saxy_lite_parser.php --- <?php /** * SAXY Lite is a non-validating, but lightweight and fast SAX parser for PHP, modelled on the Expat parser * @package saxy-xmlparser * @subpackage saxy-xmlparser-lite * @version 0.17 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/saxy/ SAXY Home Page * SAXY is Free Software **/ if (!defined('SAXY_INCLUDE_PATH')) { define('SAXY_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** current version of SAXY Lite */ define ('SAXY_LITE_VERSION', '0.17'); /** initial saxy lite parse state, before anything is encountered */ define('SAXY_STATE_NONE', 0); /** saxy lite parse state, processing main document */ define('SAXY_STATE_PARSING', 1); require_once(SAXY_INCLUDE_PATH . 'xml_saxy_shared.php'); /** * The SAX Parser class * * @package saxy-xmlparser * @subpackage saxy-xmlparser-lite * @author John Heinstein <joh...@nb...> */ class SAXY_Lite_Parser extends SAXY_Parser_Base { /** * Constructor for SAX parser */ function SAXY_Lite_Parser() { $this->SAXY_Parser_Base(); $this->state = SAXY_STATE_NONE; } //SAXY_Lite_Parser /** * Returns the current version of SAXY Lite * @return Object The current version of SAXY Lite */ function getVersion() { return SAXY_LITE_VERSION; } //getVersion /** * Processes the xml prolog, doctype, and any other nodes that exist outside of the main xml document * @param string The xml text to be processed * @return string The preprocessed xml text */ function preprocessXML($xmlText) { //strip prolog $xmlText = trim($xmlText); $total = strlen($xmlText); for ($i = 0; $i < $total; $i++) { if ($xmlText{$i} == '<') { switch ($xmlText{($i + 1)}) { case '?': case '!': break; default: $this->state = SAXY_STATE_PARSING; return (substr($xmlText, $i)); } } } } //preprocessXML /** * The controlling method for the parsing process * @param string The xml text to be processed * @return boolean True if parsing is successful */ function parse ($xmlText) { $xmlText = $this->preprocessXML($xmlText); $total = strlen($xmlText); for ($i = 0; $i < $total; $i++) { $currentChar = $xmlText{$i}; switch ($this->state) { case SAXY_STATE_PARSING: switch ($currentChar) { case '<': if (substr($this->charContainer, 0, SAXY_CDATA_LEN) == SAXY_SEARCH_CDATA) { $this->charContainer .= $currentChar; } else { $this->parseBetweenTags($this->charContainer); $this->charContainer = ''; } break; case '>': if ((substr($this->charContainer, 0, SAXY_CDATA_LEN) == SAXY_SEARCH_CDATA) && !(($this->getCharFromEnd($this->charContainer, 0) == ']') && ($this->getCharFromEnd($this->charContainer, 1) == ']'))) { $this->charContainer .= $currentChar; } else { $this->parseTag($this->charContainer); $this->charContainer = ''; } break; default: $this->charContainer .= $currentChar; } break; } } return true; } //parse /** * Parses an element tag * @param string The interior text of the element tag */ function parseTag($tagText) { $tagText = trim($tagText); $firstChar = $tagText{0}; $myAttributes = array(); switch ($firstChar) { case '/': $tagName = substr($tagText, 1); $this->fireEndElementEvent($tagName); break; case '!': $upperCaseTagText = strtoupper($tagText); if (strpos($upperCaseTagText, SAXY_SEARCH_CDATA) !== false) { //CDATA Section $total = strlen($tagText); $openBraceCount = 0; $textNodeText = ''; for ($i = 0; $i < $total; $i++) { $currentChar = $tagText{$i}; if (($currentChar == ']') && ($tagText{($i + 1)} == ']')) { break; } else if ($openBraceCount > 1) { $textNodeText .= $currentChar; } else if ($currentChar == '[') { //this won't be reached after the first open brace is found $openBraceCount ++; } } if ($this->cDataSectionHandler == null) { $this->fireCharacterDataEvent($textNodeText); } else { $this->fireCDataSectionEvent($textNodeText); } } else if (strpos($upperCaseTagText, SAXY_SEARCH_NOTATION) !== false) { //NOTATION node, discard return; } else if (substr($tagText, 0, 2) == '!-') { //comment node, discard return; } break; case '?': //Processing Instruction node, discard return; default: if ((strpos($tagText, '"') !== false) || (strpos($tagText, "'") !== false)) { $total = strlen($tagText); $tagName = ''; for ($i = 0; $i < $total; $i++) { $currentChar = $tagText{$i}; if (($currentChar == ' ') || ($currentChar == "\t") || ($currentChar == "\n") || ($currentChar == "\r") || ($currentChar == "\x0B")) { $myAttributes = $this->parseAttributes(substr($tagText, $i)); break; } else { $tagName .= $currentChar; } } if (strrpos($tagText, '/') == (strlen($tagText) - 1)) { //check $tagText, but send $tagName $this->fireStartElementEvent($tagName, $myAttributes); $this->fireEndElementEvent($tagName); } else { $this->fireStartElementEvent($tagName, $myAttributes); } } else { if (strpos($tagText, '/') !== false) { $tagText = trim(substr($tagText, 0, (strrchr($tagText, '/') - 1))); $this->fireStartElementEvent($tagText, $myAttributes); $this->fireEndElementEvent($tagText); } else { $this->fireStartElementEvent($tagText, $myAttributes); } } } } //parseTag /** * Returns the current error code (non-functional for SAXY Lite) * @return int The current error code */ function xml_get_error_code() { return -1; } //xml_get_error_code /** * Returns a textual description of the error code (non-functional for SAXY Lite) * @param int The error code * @return string The error message */ function xml_error_string($code) { return ""; } //xml_error_string } //SAXY_Lite_Parser ?> --- NEW FILE: php_http_client_generic.php --- <?php /** * PHP HTTP Tools is a library for working with the http protocol * php_http_client_generic represents a basic http client * @package php-http-tools * @version 0.2-pre * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/php_http_tools/ PHP HTTP Tools Home Page * PHP HTTP Tools are Free Software **/ if (!defined('PHP_HTTP_TOOLS_INCLUDE_PATH')) { define('PHP_HTTP_TOOLS_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** end-of-line character sequence as defined in HTTP spec */ define ('CRLF', "\r\n"); /** carriage return character */ define ('CR', "\r"); /** line feed character */ define ('LF', "\n"); //http read states for client /** beginning read state */ define('HTTP_READ_STATE_BEGIN', 1); /** state when reading headers */ define('HTTP_READ_STATE_HEADERS', 2); /** state when reading body of message */ define('HTTP_READ_STATE_BODY', 3); require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_exceptions.php'); /** * An HTTP Request class * * @package php-http-tools * @author John Heinstein <joh...@nb...> */ class php_http_request { /** @var object A reference to the headers object */ var $headers = null; /** @var string The requested method, e.g. GET, POST, HEAD */ var $requestMethod = 'POST'; /** @var string The requested path */ var $requestPath = ''; /** @var string The requested protocol */ var $protocol = 'HTTP'; /** @var string The version of the requested protocol */ var $protocolVersion= '1.1'; /** * Returns the headers object * @return object The headers object */ function &getHeaders() { return $this->headers; } //getHeaders /** * Sets the header to the specified value * @param string The header name * @param string The header value * @param boolean True if multiple headers with the same name are allowed */ function setHeader($name, $value, $allowMultipleHeaders = false) { $this->headers->setHeader($name, $value, $allowMultipleHeaders); } //setHeader /** * Default method for setting headers; meant to be overridden in subclasses */ function setHeaders() { //you will want to override this method $this->setHeader('User-Agent', 'PHP-HTTP-Client(Generic)/0.1'); $this->setHeader('Connection', 'Close'); } //setHeaders /** * Sets the request method, e.g., GET * @param string The name of the request method * @return boolean True if the version number is valid */ function setRequestMethod($method) { $method = strtoupper($method); switch ($method) { case 'POST': case 'GET': case 'HEAD': case 'PUT': $this->requestMethod = $method; return true; break; } return false; } //setRequestMethod /** * Sets the request path, e.g., http://www.engageinteractive.com/domit/test.xml * @param string The request path */ function setRequestPath($path) { $this->requestPath = $path; } //setRequestPath /** * Sets the version number of the protocol * @param string The version number * @return boolean True if the version number is valid */ function setProtocolVersion($version) { if (($version == '1.0') || ($version == '1.1')) { $this->protocolVersion = $version; return true; } return false; } //setProtocolVersion /** * Specifies a user name and password for basic authentication * @param string The user name * @param string The password */ function setAuthorization($user, $password) { $encodedChallengeResponse = 'Basic ' . base64_encode($this->user . ':' . $this->password); $this->setHeader('Authorization', $encodedChallengeResponse); } //setAuthorization } //php_http_request class php_http_client_generic extends php_http_request { /** @var object A reference to the connection object */ var $connection; /** @var string True if response headers are to be generated as an object */ var $responseHeadersAsObject = false; /** @var object The http response */ var $response = null; /** @var string A list of event names that can be fired by the client */ var $events = array('onRequest' => null, 'onRead' => null, 'onResponse' => null, 'onResponseHeaders' => null, 'onResponseBody' => null); /** * HTTP Client constructor * @param string The client connection host name, with or without its protocol prefix * @param string The client connection path, not including the host name * @param int The port to establish the client connection on * @param int The timeout value for the client connection */ function php_http_client_generic($host = '', $path = '/', $port = 80, $timeout = 0) { $this->connection =& new php_http_connection($host, $path, $port, $timeout); $this->headers =& new php_http_headers(); $this->requestPath = $path; $this->response =& new php_http_response(); $this->setHeaders(); } //php_http_client_generic /** * Specifies that the response headers array should be generated * @param boolean True if the response headers array should be built */ function generateResponseHeadersAsObject($responseHeadersAsObject) { $this->responseHeadersAsObject = $responseHeadersAsObject; if ($responseHeadersAsObject) { $this->response->headers =& new php_http_headers(); } } //generateResponseHeadersAsObject /** * Fires an http event that has been registered * @param string The name of the event, e.g., onRead * @param string The data to be passed to the event */ function fireEvent($target, $data) { if ($this->events[$target] != null) { call_user_func($this->events[$target], $data); } } //fireEvent /** * Sets which http events are to be fired * @param string The http event option to be set * @param string True if the event is to be fired * @param object A reference to a custom handler for the http event data */ function setHTTPEvent($option, $truthVal, $customHandler = null) { if ($customHandler != null) { $handler =& $customHandler; } else { $handler = array(&$this, 'defaultHTTPEventHandler'); } switch($option) { case 'onRequest': case 'onRead': case 'onResponse': case 'onResponseHeaders': case 'onResponseBody': $truthVal ? ($this->events[$option] =& $handler) : ($this->events[$option] = null); break; } } //setHTTPEvent /** * Evaluates whether the specified http event option is active * @param string The http event option to evaluate * @return boolean True if the specified option is active */ function getHTTPEvent($option) { switch($option) { case 'onRequest': case 'onRead': case 'onResponse': case 'onResponseHeaders': case 'onResponseBody': return ($this->events[$option] != null); break; } } //getHTTPEvent /** * The default http event handler; fired if no custom handler has been registered * @param string The event data */ function defaultHTTPEventHandler($data) { $this->printHTML($data); } //defaultHTTPEventHandler /** * Prints the data to the browser as preformatted, htmlentified output * @param string The data to be printed */ function printHTML($html) { print('<pre>' . htmlentities($html) . '</pre>'); } //printHTML /** * Establishes a client connection */ function connect() { if (!$this->headers->headerExists('Host')) { $this->setHeader('Host', $this->connection->host); } return $this->connection->connect(); } //connect /** * Disconnects the current client connection if one exists */ function disconnect() { return $this->connection->disconnect(); } //disconnect /** * Evaluated whether the current client is connected * @return boolean True if a connection exists */ function isConnected() { return $this->connection->isOpen(); } //isConnected /** * Performs an HTTP GET * @param string The target url */ function &get($url) { $this->setRequestMethod('GET'); $this->setRequestPath($url); $this->get_custom($url); $this->connect(); $result = $this->send(''); return $result; } //get /** * Handler for customizing the HTTP GET call * @param string The target url */ function get_custom($url) { //do nothing; meant to be overridden } //get_custom /** * Performs an HTTP POST * @param string The posted data */ function &post($data) { $this->setRequestMethod('POST'); $this->setHeader('Content-Type', 'text/html'); $this->post_custom($data); $this->connect(); return $this->send($data); } //post /** * Handler for customizing the HTTP POST call * @param string The post data */ function post_custom($data) { //do nothing; meant to be overridden } //post_custom /** * Performs an HTTP HEAD * @param string The target url */ function &head($url) { $this->setRequestMethod('HEAD'); $this->head_custom($url); $this->connect(); return $this->send(''); } //head /** * Handler for customizing the HTTP HEAD call * @param string The target url */ function head_custom($url) { //do nothing; meant to be overridden } //head_custom /** * Sends data through the client connection * @return string The body of the http response */ function &send($message) { $conn =& $this->connection; if ($conn->isOpen()) { //build header info $request = $this->requestMethod . ' ' . $this->requestPath . ' ' . $this->protocol . '/' . $this->protocolVersion . CRLF; $request .= $this->headers->toString() . CRLF; $request .= $message; //init variables $response = $headers = $body = ''; $readState = HTTP_READ_STATE_BEGIN; $this->fireEvent('onRequest', $request); //send request $connResource =& $conn->connection; fputs ($connResource, $request); //read response while (!feof($connResource)) { $data = fgets($connResource, 4096); $this->fireEvent('onRead', $data); switch ($readState) { case HTTP_READ_STATE_BEGIN: $this->response->statusLine = $data; $readState = HTTP_READ_STATE_HEADERS; break; case HTTP_READ_STATE_HEADERS: if (trim($data) == '') { //end of headers is signalled by a blank line $readState = HTTP_READ_STATE_BODY; } else { if ($this->responseHeadersAsObject) { $this->response->setUnformattedHeader($data); } else { $this->response->headers .= $data; } } break; case HTTP_READ_STATE_BODY: $this->response->message .= $data; break; } } $this->normalizeResponseIfChunked(); $headerString = is_object($this->response->headers) ? $this->response->headers->toString() : $this->response->headers; $this->fireEvent('onResponseHeaders', $headerString); $this->fireEvent('onResponseBody', $this->response->message); $this->fireEvent('onResponse', $this->response->headers . $this->response->message); return $this->response; } else { ... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-07-28 13:21:14
|
Update of /cvsroot/stack/stack-1-0/other/domit/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15190/examples Log Message: Directory /cvsroot/stack/stack-1-0/other/domit/examples added to the repository --> Using per-directory sticky tag `development_xmlrqp' |
From: pkiddie <pk...@us...> - 2005-07-28 13:21:14
|
Update of /cvsroot/stack/stack-1-0/other/domit/documentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15190/documentation Log Message: Directory /cvsroot/stack/stack-1-0/other/domit/documentation added to the repository --> Using per-directory sticky tag `development_xmlrqp' |
From: pkiddie <pk...@us...> - 2005-07-28 13:20:16
|
Update of /cvsroot/stack/stack-1-0/other/domit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15017/domit Log Message: Directory /cvsroot/stack/stack-1-0/other/domit added to the repository --> Using per-directory sticky tag `development_xmlrqp' |
From: pkiddie <pk...@us...> - 2005-07-28 13:18:36
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14725/scripts/install Modified Files: Tag: development_xmlrqp stacktest.php Log Message: Index: stacktest.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stacktest.php,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** stacktest.php 14 Jul 2005 18:44:55 -0000 1.5 --- stacktest.php 28 Jul 2005 13:18:27 -0000 1.5.2.1 *************** *** 117,121 **** echo "<font color='red'>No output from the CAS conversion.</font>"; } ! ?> --- 117,172 ---- echo "<font color='red'>No output from the CAS conversion.</font>"; } ! ! /***********************************************/ ! /* Creation of schemas */ ! /***********************************************/ ! ! require("{$stack_root}/scripts/stackXML.php"); ! $strout=""; ! ! echo "<h2>5. Create all XML schemas required by STACK</h2>"; ! ! echo "<p>We will attempt to create XML schemas for questions, quizzes, and their respective metadata. The results are:"; ! echo "<br />5.1 Creation of question schema"; ! ! $strout = stack_schema_write_question($stack_root); ! ! if ('' != $strout) { ! echo "<br /><font color='green'>Question metadata written to $strout.</font>"; ! } else { ! echo "<br /><font color='red'>No output from the CAS conversion.</font>"; ! } ! ! echo "<br />5.2 Creation of quiz schema"; ! $strout = ''; ! ! if ('' != $strout) { ! echo "<br /><font color='green'>Question metadata written to $strout.</font>"; ! } else { ! echo "<br /><font color='red'>No output from the CAS conversion.</font>"; ! } ! ! echo "<br />5.3 Creation of question metadata"; ! ! //Write the question metadata to the root of the webserver ! //$strout = stack_schema_write_metadata($stack_root); ! $strout = stack_schema_write_question_metadata($stack_root); ! ! if ('' != $strout) { ! echo "<br /><font color='green'>Question metadata written to $strout.</font>"; ! } else { ! echo "<br /><font color='red'>No output from the CAS conversion.</font>"; ! } ! ! echo "<br />5.4 Creation of quiz metadata"; ! ! $strout = stack_schema_write_quiz_metadata($stack_root); ! ! if ('' != $strout) { ! echo "<br /><font color='green'>Question metadata written to $strout.</font>"; ! } else { ! echo "<br /><font color='red'>No output from the CAS conversion.</font>"; ! } ! ?> |
From: pkiddie <pk...@us...> - 2005-07-28 13:18:36
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14725/scripts Modified Files: Tag: development_xmlrqp stackUtility.php Log Message: Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -C2 -d -r1.30 -r1.30.2.1 *** stackUtility.php 25 Jul 2005 11:24:08 -0000 1.30 --- stackUtility.php 28 Jul 2005 13:18:27 -0000 1.30.2.1 *************** *** 16,20 **** // (1) remove stackData.php - and its reference in stackstd.php // (2) remove stackSocketSend.php - and its reference in stackstd.php - // (3) Add a way of putting the standard GNUplot header in stackstd.php if ($stack_stand_alone) { require_once("{$stack_root}/scripts/moodlelib.php"); --- 16,19 ---- *************** *** 950,954 **** echo "<body>\n"; echo "<table><tr>\n"; ! echo "<td><img src=\"{$stack_web_url}pics/logo.png\" width=\"120\" alt=\"".get_string('StackLogo','stack','')."\" /></td>\n"; echo "<td><h1><font face=\"arial\">STACK</font></h1></td>\n</tr></table>\n<h1>$title</h1>\n"; } --- 949,953 ---- echo "<body>\n"; echo "<table><tr>\n"; ! echo "<td><img src=\"{$stack_web_url}pics/logo.png\" width=\"115\" alt=\"".get_string('StackLogo','stack','')."\" /></td>\n"; echo "<td><h1><font face=\"arial\">STACK</font></h1></td>\n</tr></table>\n<h1>$title</h1>\n"; } *************** *** 1054,1056 **** --- 1053,1077 ---- } + /** + * Retrieves the PHP version and returns to the caller the major revision + * + * @param void + * @return int phpVer The major revision of PHP in use + * false if this information not available + * + */ + function stack_php_version() { + + $phpVer = phpversion(); //Retrieve PHP version string + + //Retreive and return major revision of PHP + if (!empty($phpVer)) { + return $phpVer{0}; + } + + else { + return false; + } + } + ?> |
From: pkiddie <pk...@us...> - 2005-07-28 13:18:36
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14725 Modified Files: Tag: development_xmlrqp question_bank.php rqp_server.php Log Message: Index: rqp_server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/rqp_server.php,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** rqp_server.php 8 Apr 2005 15:10:29 -0000 1.4 --- rqp_server.php 28 Jul 2005 13:18:27 -0000 1.4.2.1 *************** *** 8,33 **** */ - // STACK specific code require_once('stackstd.php'); ! require_once($stack_root.'/scripts/rqp/rqp_calls.php'); require_once($stack_root.'/scripts/stackXML.php'); ! ! // Does this implementation offer others web services? if (!$stack_web_services_provide) { echo "This STACK server does not offer web services."; die(); ! } // Load nusoap if PHP 5 native support is not present. ! require_once($stack_root.'/scripts/rqp/uni_soap.php'); ! // Allow the WSDL to be returned by adding '?wsdl' to our URL ! if (isset($_GET['wsdl'])) ! handle_soap_wsdl_request($stack_root.'/scripts/rqp/rqp.wsdl', true); // Handle the SOAP request ! soap_serve($stack_root.'/scripts/rqp/rqp.wsdl', array('RQP_ServerInformation', 'RQP_ItemInformation', 'RQP_ProcessTemplate', 'RQP_Clone', 'RQP_SessionInformation', 'RQP_Render')); /** --- 8,37 ---- */ // STACK specific code require_once('stackstd.php'); ! //require_once($stack_root.'/scripts/rqp/rqp_calls.php'); ! require_once($stack_root.'/scripts/rqp/RQPv1p0Server.php'); require_once($stack_root.'/scripts/stackXML.php'); ! ! //Instance a new RQP server which deals with backend SOAP responses ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = "http://localhost/stack-1-0/rqp/RQPv1p0Server.php"; ! ! echo serialize($rqpserver->RQP_ServerInformation()); ! // Does this implementatio/n offer others web services? if (!$stack_web_services_provide) { echo "This STACK server does not offer web services."; die(); ! } // Load nusoap if PHP 5 native support is not present. ! //require_once($stack_root.'/scripts/rqp/uni_soap.php'); // Allow the WSDL to be returned by adding '?wsdl' to our URL ! //if (isset($_GET['wsdl'])) ! // handle_soap_wsdl_request($stack_root.'/scripts/rqp/rqp.wsdl', true); // Handle the SOAP request ! //soap_serve($stack_root.'/scripts/rqp/rqp.wsdl', array('RQP_ServerInformation', 'RQP_ItemInformation', 'RQP_ProcessTemplate', 'RQP_Clone', 'RQP_SessionInformation', 'RQP_Render')); /** *************** *** 60,66 **** * The first entry is the default. */ function RQP_ServerInformation() { ! $return = stack_rqp_ServerInformationCall(); ! return $return; } --- 64,70 ---- * The first entry is the default. */ + //<TODO> Update documentation for serverinformation function RQP_ServerInformation() { ! return $rqpserver->RQP_ServerInformation(); } Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** question_bank.php 25 Jul 2005 11:24:08 -0000 1.8 --- question_bank.php 28 Jul 2005 13:18:27 -0000 1.8.2.1 *************** *** 70,74 **** // questionbank_screen Begin again. - $admin = FALSE; if ('admin' == $user['username']) { --- 70,73 ---- *************** *** 202,206 **** include('html/pagehead.php'); ! switch ($action) { case 'delete': --- 201,205 ---- include('html/pagehead.php'); ! switch ($action) { case 'delete': |
From: pkiddie <pk...@us...> - 2005-07-28 11:14:34
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23193/scripts Modified Files: Tag: development_xml stackUtility.php Log Message: Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.28 retrieving revision 1.28.2.1 diff -C2 -d -r1.28 -r1.28.2.1 *** stackUtility.php 14 Jul 2005 18:31:23 -0000 1.28 --- stackUtility.php 28 Jul 2005 11:14:25 -0000 1.28.2.1 *************** *** 1055,1057 **** --- 1055,1079 ---- } + /** + * Retrieves the PHP version and returns to the caller the major revision + * + * @param void + * @return int phpVer The major revision of PHP in use + * false if this information not available + * + */ + function stack_php_version() { + + $phpVer = phpversion(); //Retrieve PHP version string + + //Retreive and return major revision of PHP + if (!empty($phpVer)) { + return $phpVer{0}; + } + + else { + return false; + } + } + ?> |
From: pkiddie <pk...@us...> - 2005-07-28 11:10:55
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22610/scripts Modified Files: Tag: development_xml stackXML.php Log Message: Updated order of question fields to reflect that of db Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** stackXML.php 20 Jun 2005 15:42:55 -0000 1.3 --- stackXML.php 28 Jul 2005 11:10:45 -0000 1.3.2.1 *************** *** 1,220 **** ! <?php ! ! /** ! * XML import and export of STACK questions. ! * ! * @package scripts ! * @subpackage Stack ! */ ! ! /** [...1587 lines suppressed...] ! $xml.=stack_schema_write_element_document($arrayKey,$questionField['mysql'],$questionField['doc']); ! } ! ! else { ! $xml.=stack_schema_write_element($arrayKey,$questionField['mysql']); ! } ! ! } ! } ! } ! ! //Terminate a sequence of metadata tags ! $xml.='</xs:sequence>'; ! ! //We must now tag the 'metadata' tag with a version attribute ! $xml.= stack_schema_write_attribute('version', true); ! ! return $xml; ! } ! ?> |
From: Chris S. <san...@us...> - 2005-07-25 14:11:35
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27037/scripts Modified Files: stackAuthor.php stackDatabase.php stackUser.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** stackDatabase.php 18 Jul 2005 12:09:12 -0000 1.33 --- stackDatabase.php 25 Jul 2005 14:11:25 -0000 1.34 *************** *** 1211,1214 **** --- 1211,1219 ---- } } + + if (array_key_exists('options',$user)) { + $user['options'] = base64_unserialize($user['options']); + } + return $user; } *************** *** 1237,1240 **** --- 1242,1249 ---- } + if (array_key_exists('options',$user)) { + $user['options'] = base64_unserialize($user['options']); + } + return $user; } *************** *** 1255,1258 **** --- 1264,1272 ---- $qu = ''; $quv = ''; + + if (array_key_exists('options',$user)) { + $user['options'] = base64_serialize($user['options']); + } + foreach ($stackUser as $key => $fields) { if (array_key_exists($key,$user)) { *************** *** 1293,1296 **** --- 1307,1315 ---- $qu = ''; + + if (array_key_exists('options',$user)) { + $user['options'] = base64_serialize($user['options']); + } + foreach ($stackUser as $key => $fields) { if (array_key_exists($key,$user)) { Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** stackAuthor.php 18 Jul 2005 10:44:17 -0000 1.28 --- stackAuthor.php 25 Jul 2005 14:11:25 -0000 1.29 *************** *** 80,87 **** //Must be of type meta if ('meta'==$fields['type']) { ! if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag ! echo "\n<select name=\"$name\">\n"; if ('default'==$optval){echo " <option value='default' selected>default</option>\n";} ! else {echo " <option value='default'>default</option>\n";} foreach ($fields['values'] as $vals) { --- 80,87 ---- //Must be of type meta if ('meta'==$fields['type']) { ! if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag ! echo "\n<select name=\"$name\">\n"; if ('default'==$optval){echo " <option value='default' selected>default</option>\n";} ! else {echo " <option value='default'>default</option>\n";} foreach ($fields['values'] as $vals) { *************** *** 91,95 **** echo " </select>\n"; ! } } } --- 91,95 ---- echo " </select>\n"; ! } } } *************** *** 102,115 **** * @param array $options Their current values * @param string $fieldname The name of the field in the form * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname) { global $stackOptions; ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); --- 102,118 ---- * @param array $options Their current values * @param string $fieldname The name of the field in the form + * @param boolean $fragment Is this a fragment, or a complete table? * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$fragment=TRUE) { global $stackOptions; ! if ($fragment) { ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! } ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); *************** *** 118,122 **** echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } --- 121,125 ---- echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } *************** *** 135,139 **** } ! echo "\n</table>\n\n\n"; } --- 138,144 ---- } ! if ($fragment) { ! echo "\n</table>\n\n\n"; ! } } *************** *** 209,216 **** <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> --- 214,221 ---- <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> *************** *** 220,226 **** <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! </table> "; ! // HACK: the field type in the database does not // allow these to be edited yet. --- 225,231 ---- <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! </table> "; ! // HACK: the field type in the database does not // allow these to be edited yet. *************** *** 377,442 **** echo "\n<hr />\n"; ! ! //<PDK> Insert user definable metadata here ! $qfield='questionLanguage'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! $qfield='questionLearningContext'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! ! $qfield='questionDifficulty'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetency'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetencyLevel'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionExcerciseType'; ! $qfield_name = "question[{$qfield}]"; ! echo "<br /><b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionTimeAllocated'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionTimeAllocated' value='".sf($question,'questionTimeAllocated')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionRights'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionRights' value='".sf($question,'questionRights')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! echo "\n<hr />\n"; --- 382,447 ---- echo "\n<hr />\n"; ! ! //<PDK> Insert user definable metadata here ! $qfield='questionLanguage'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! $qfield='questionLearningContext'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! ! $qfield='questionDifficulty'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetency'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetencyLevel'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionExcerciseType'; ! $qfield_name = "question[{$qfield}]"; ! echo "<br /><b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionTimeAllocated'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionTimeAllocated' value='".sf($question,'questionTimeAllocated')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionRights'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionRights' value='".sf($question,'questionRights')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! echo "\n<hr />\n"; Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stackUser.php 8 Jul 2005 16:56:23 -0000 1.11 --- stackUser.php 25 Jul 2005 14:11:25 -0000 1.12 *************** *** 25,28 **** --- 25,29 ---- $stackUser['firstaccess'] = ''; $stackUser['lastaccess'] = ''; + $stackUser['options'] = array(); /** *************** *** 135,145 **** } /** ! * Update the information of a particular user. * * @param array $errors The array to hold any errors * @return array $user The user's information. */ ! function stack_user_updateinfo(&$errors) { $user = ''; --- 136,147 ---- } + /** ! * Get the information about the current user from the $_POST. * * @param array $errors The array to hold any errors * @return array $user The user's information. */ ! function stack_user_info_ascertain(&$errors) { $user = ''; *************** *** 174,178 **** } - /** * Validates the information supplied by a user --- 176,179 ---- *************** *** 218,221 **** --- 219,255 ---- } + + /** + * Displays the update user info form. + * @param array $user The array containing the information about the user. + * @param array $errors The usual errors array. + * @param boolean $admin Is this being used by the admin user to edit a student's login details? + * @return void + */ + function stack_user_update_info($user, $errors,$admin=FALSE) { + global $stack_root,$stack_web_url; + include_once($stack_root.'/scripts/stackAuthor.php'); + include_once($stack_root.'/html/helpform.php'); + + echo '<h1>Update user information</h1>'; + echo "<form action=\"\" method=\"post\" name=\"register\" id=\"register\">"; + echo '<p>To update your information, please complete the following form.<p>'; + echo '<table><tr><td>Username </td><td><input type="hidden" name="user[username]" size="25" value="'.stack_s($user['username']).'" alt="User name" />'.stack_s($user['username']).'</td><td></td></tr>'; + stack_user_edit_form($user,$errors,$admin); + + // The code below allows the user['options'] to be set. This is currently unused. + // // Add options to the user form. + // $options_headings = array(''); + // $options_list = array('Language'); + // $fieldname = 'user[options]'; + // + // stack_options_edit_form($options_headings,$options_list,$user['options'],$fieldname,FALSE); + + echo '</table>'; + + echo '<input type="hidden" name="action" value="userupdate" /><input type="submit" value="Update" /></form>'; + } + + /** * Build the form to edit a STACK user. |
From: Chris S. <san...@us...> - 2005-07-25 14:11:34
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27037 Modified Files: user.php Log Message: Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** user.php 14 Jul 2005 18:31:23 -0000 1.2 --- user.php 25 Jul 2005 14:11:25 -0000 1.3 *************** *** 40,44 **** if ('userupdate' == $action) { ! $user_stu = stack_user_updateinfo($errors); } --- 40,44 ---- if ('userupdate' == $action) { ! $user_stu = stack_user_info_ascertain($errors); } |
From: Chris S. <san...@us...> - 2005-07-25 14:11:34
|
Update of /cvsroot/stack/stack-1-0/frontend_general In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27037/frontend_general Modified Files: front_end_display.php loginregister.php Log Message: Index: loginregister.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/loginregister.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** loginregister.php 14 Jul 2005 18:26:02 -0000 1.7 --- loginregister.php 25 Jul 2005 14:11:24 -0000 1.8 *************** *** 86,90 **** // Update user info if ('userupdate' == $action and $user['loggedin']) { ! $user = stack_user_updateinfo($errors); $user['loggedin'] = TRUE; $action = 'update_info'; --- 86,90 ---- // Update user info if ('userupdate' == $action and $user['loggedin']) { ! $user = stack_user_info_ascertain($errors); $user['loggedin'] = TRUE; $action = 'update_info'; Index: front_end_display.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/front_end_display.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** front_end_display.php 14 Jul 2005 18:19:56 -0000 1.5 --- front_end_display.php 25 Jul 2005 14:11:24 -0000 1.6 *************** *** 61,79 **** } - /** - * Displays the update user info form. - * @param array $user The array containing the information about the user. - * @param array $errors The usual errors array. - * @param boolean $admin Is this being used by the admin user to edit a student's login details? - * @return void - */ - function stack_user_update_info($user, $errors,$admin=FALSE) { - echo '<h1>Update user information</h1>'; - echo "<form action=\"\" method=\"post\" name=\"register\" id=\"register\">"; - echo '<p>To update your information, please complete the following form.<p>'; - echo '<table><tr><td>Username </td><td><input type="hidden" name="user[username]" size="25" value="'.stack_s($user['username']).'" alt="User name" />'.stack_s($user['username']).'</td><td></td></tr>'; - stack_user_edit_form($user,$errors,$admin); - echo '</table><input type="hidden" name="action" value="userupdate" /><input type="submit" value="Update" /></form>'; - } --- 61,64 ---- |