Changeset 34 for trunk/zoo-kernel/service_internal.c
- Timestamp:
- Oct 1, 2010, 1:41:53 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/service_internal.c
r33 r34 25 25 #include "service_internal.h" 26 26 27 void *addLangAttr(xmlNodePtr n,maps *m){ 28 map *tmpLmap=getMapFromMaps(m,"main","language"); 29 if(tmpLmap!=NULL) 30 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST tmpLmap->value); 31 else 32 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en-US"); 33 } 34 27 35 /* Converts a hex character to its integer value */ 28 36 char from_hex(char ch) { … … 281 289 xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsGetCapabilities_response.xsd"); 282 290 xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS"); 291 addLangAttr(n,m); 283 292 284 293 if(toto1!=NULL){ … … 512 521 xmlAddChild(nc2,nc4); 513 522 xmlAddChild(nc1,nc2); 514 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST buff);515 523 dcount++; 516 524 } … … 590 598 xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS"); 591 599 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.0.0"); 592 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");600 addLangAttr(n,m); 593 601 594 602 xmlDocSetRootElement(doc, n); … … 954 962 xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS"); 955 963 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.0.0"); 956 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en"); 964 addLangAttr(n,m); 965 957 966 char tmp[256]; 958 967 char url[1024]; … … 1046 1055 case SERVICE_SUCCEEDED: 1047 1056 nc1 = xmlNewNode(ns, BAD_CAST "ProcessSucceeded"); 1048 sprintf(sMsg, "Service \"%s\" run successfully.",serv->name);1057 sprintf(sMsg,_("Service \"%s\" run successfully."),serv->name); 1049 1058 nc3=xmlNewText(BAD_CAST sMsg); 1050 1059 xmlAddChild(nc1,nc3); … … 1054 1063 tmpStatus=getMapFromMaps(m,"lenv","status"); 1055 1064 xmlNewProp(nc1,BAD_CAST "percentCompleted",BAD_CAST tmpStatus->value); 1056 sprintf(sMsg, "ZOO Service \"%s\" is currently running. Please, reload this document to get the up-to-date status of the Service.",serv->name);1065 sprintf(sMsg,_("ZOO Service \"%s\" is currently running. Please, reload this document to get the up-to-date status of the Service."),serv->name); 1057 1066 nc3=xmlNewText(BAD_CAST sMsg); 1058 1067 xmlAddChild(nc1,nc3); … … 1060 1069 case SERVICE_ACCEPTED: 1061 1070 nc1 = xmlNewNode(ns, BAD_CAST "ProcessAccepted"); 1062 sprintf(sMsg, "Service \"%s\" was accepted by the ZOO Kernel and it run as a background task. Please consult the statusLocation attribtue providen in this document to get the up-to-date document.",serv->name);1071 sprintf(sMsg,_("Service \"%s\" was accepted by the ZOO Kernel and it run as a background task. Please consult the statusLocation attribtue providen in this document to get the up-to-date document."),serv->name); 1063 1072 nc3=xmlNewText(BAD_CAST sMsg); 1064 1073 xmlAddChild(nc1,nc3); … … 1077 1086 addToMap(errorMap,"text",te->value); 1078 1087 else 1079 addToMap(errorMap,"text", "No more information available");1088 addToMap(errorMap,"text",_("No more information available")); 1080 1089 nc3=createExceptionReportNode(m,errorMap,0); 1081 1090 xmlAddChild(nc1,nc3); 1082 1091 break; 1083 1092 default : 1084 printf( "error code not know : %i\n",status);1093 printf(_("error code not know : %i\n"),status); 1085 1094 //exit(1); 1086 1095 break; … … 1250 1259 // Extract Title required to be first element in the ZCFG file ! 1251 1260 nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name); 1252 nc3=xmlNewText(BAD_CAST tmp->value);1261 nc3=xmlNewText(BAD_CAST _ss(tmp->value)); 1253 1262 xmlAddChild(nc2,nc3); 1254 1263 xmlAddChild(nc1,nc2); … … 1256 1265 tmp=tmp->next; 1257 1266 nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name); 1258 nc3=xmlNewText(BAD_CAST tmp->value);1267 nc3=xmlNewText(BAD_CAST _ss(tmp->value)); 1259 1268 xmlAddChild(nc2,nc3); 1260 1269 xmlAddChild(nc1,nc2); … … 1352 1361 if(tmp1!=NULL){ 1353 1362 nc2 = xmlNewNode(ns_ows, BAD_CAST tmp2[j]); 1354 xmlAddChild(nc2,xmlNewText(BAD_CAST tmp1->value)); 1363 fprintf(stderr,"[%s] \n[%s]\n",tmp1->value,_ss(tmp1->value)); 1364 xmlAddChild(nc2,xmlNewText(BAD_CAST _ss(tmp1->value))); 1355 1365 xmlAddChild(root,nc2); 1356 1366 } … … 1389 1399 xmlDocPtr doc; 1390 1400 xmlChar *xmlbuff; 1391 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 1392 xmlNodePtr n,nc,nc1,nc2; 1401 xmlNodePtr n; 1393 1402 1394 1403 doc = xmlNewDoc(BAD_CAST "1.0"); … … 1405 1414 }else 1406 1415 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1407 1408 ns=xmlNewNs(NULL,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows"); 1409 n = xmlNewNode(ns, BAD_CAST "ExceptionReport"); 1410 ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows"); 1411 ns_xlink=xmlNewNs(n,BAD_CAST "http://www.w3.org/1999/xlink",BAD_CAST "xlink"); 1412 ns_xsi=xmlNewNs(n,BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi"); 1413 xmlNewProp(n,BAD_CAST "xsi:schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"); 1414 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en"); 1415 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0"); 1416 1417 nc = xmlNewNode(ns, BAD_CAST "Exception"); 1418 1419 map* tmp=getMap(s,"code"); 1420 if(tmp!=NULL) 1421 xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST tmp->value); 1422 else 1423 xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST "NoApplicableCode"); 1424 1425 tmp=getMap(s,"text"); 1426 nc1 = xmlNewNode(ns, BAD_CAST "ExceptionText"); 1427 nc2=NULL; 1428 if(tmp!=NULL){ 1429 xmlNodeSetContent(nc1, BAD_CAST tmp->value); 1430 } 1431 else{ 1432 xmlNodeSetContent(nc1, BAD_CAST "No debug message available"); 1433 } 1434 xmlAddChild(nc,nc1); 1435 xmlAddChild(n,nc); 1416 n=createExceptionReportNode(m,s,1); 1436 1417 xmlDocSetRootElement(doc, n); 1437 1438 1418 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 1439 1419 printf("%s",xmlbuff); … … 1441 1421 xmlFreeDoc(doc); 1442 1422 xmlFree(xmlbuff); 1443 xmlFreeNs(ns);1444 1423 xmlCleanupParser(); 1445 1424 } … … 1465 1444 xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"); 1466 1445 } 1467 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");1446 addLangAttr(n,m); 1468 1447 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0"); 1469 1448 … … 1483 1462 } 1484 1463 else{ 1485 xmlNodeSetContent(nc1, BAD_CAST "No debug message available");1464 xmlNodeSetContent(nc1, BAD_CAST _("No debug message available")); 1486 1465 } 1487 1466 xmlAddChild(nc,nc1); … … 1544 1523 toto=getMap(request_outputs->content,"value"); 1545 1524 if(toto==NULL){ 1546 map * errormap = createMap("text", "Unable to fetch any result");1525 map * errormap = createMap("text",_("Unable to fetch any result")); 1547 1526 addToMap(errormap,"code", "InternalError"); 1548 1527 printExceptionReportResponse(m,errormap); … … 1585 1564 lenv=getMapFromMaps(m,"lenv","message"); 1586 1565 if(lenv!=NULL) 1587 sprintf(tmp, "Unable to run the Service. The message returned back by the Service was the following : %s",lenv->value);1566 sprintf(tmp,_("Unable to run the Service. The message returned back by the Service was the following : %s"),lenv->value); 1588 1567 else 1589 sprintf(tmp, "Unable to run the Service. No more information was returned back by the Service.");1568 sprintf(tmp,_("Unable to run the Service. No more information was returned back by the Service.")); 1590 1569 errormap = createMap("text",tmp); 1591 1570 addToMap(errormap,"code", "InternalError");
Note: See TracChangeset
for help on using the changeset viewer.