00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "connectstring"
00012 #include "cgiClass.h"
00013 #include "Category.hpp"
00014
00015 typedef map<string,int> directionmap;
00016
00017
00018 int main(int argc, char ** argv)
00019 {
00020
00021 cgiScript script("text/xml",true);
00022 cgiInput & args = script.ClientArguments();
00023 string response="NO", reason="NULL ARGS";
00024
00025
00026 ocString xmlTmp = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n"
00027 "<cat_movement result='$RES$' reason='$REAS$'>\n"
00028 "$INFO$"
00029 "</cat_movement>";
00030 ocString information;
00031 if( args.count("cid") && args.count("dir") )
00032 {
00033 Category_Obj co;
00034 long long cid = atoll(args["cid"].c_str());
00035 directionmap dirmap;
00036 dirmap["u"]=up;
00037 dirmap["b"]=btm;
00038 dirmap["l"]=lft;
00039 dirmap["r"]=rgt;
00040 int dir=dirmap[args["dir"].c_str()];
00041 information = "<cid>";
00042 information.append(cid);
00043 information += "</cid><dir>";
00044 information.append(dir);
00045 information += "</dir>";
00046 if( co.move( cid, (category_direction) dir ) )
00047 {
00048 response="OK";
00049 reason="Success";
00050 }
00051 information+=co.last_result();
00052
00053 }
00054 script << xmlTmp.replace("$RES$",response.c_str())
00055 .replace("$REAS$",reason.c_str())
00056 .replace("$INFO$",information.c_str());
00057 return 0;
00058 }
00059
00060 #include "read_write_base.cpp"