diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-07-18 18:37:28 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-07-18 18:37:28 +0800 |
commit | e2b99bae1125b08321d55be45f227bd7006cb96a (patch) | |
tree | 7b95d15f2458e6afcfa84363008e2d5bf7014d90 | |
parent | 5bf19c2fd85ec6284398394abb761bea2511c33b (diff) |
Admin newitem
-rw-r--r-- | admin.c | 83 | ||||
-rw-r--r-- | icclient/admin.h | 2 |
2 files changed, 85 insertions, 0 deletions
@@ -18,6 +18,89 @@ icclient_admin *icclient_admin_login(const char *username, const char *password, return admin; } +void icclient_admin_newitem(const char *description, const char *comment, + const char *price, const char *image_path) +{ + struct curl_httppost *post, *last = NULL; + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_click", + CURLFORM_COPYCONTENTS, "process_filter", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_data_fields", + CURLFORM_COPYCONTENTS, "sku description prod_group category comment inactive price wholesale image thumb image_large weight nontaxable gift_cert", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_ui", + CURLFORM_COPYCONTENTS, "1", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "ui_new_item", + CURLFORM_COPYCONTENTS, "1", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_todo", + CURLFORM_COPYCONTENTS, "set", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_update_empty", + CURLFORM_COPYCONTENTS, "1", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_action", + CURLFORM_COPYCONTENTS, "set", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_data_table", + CURLFORM_COPYCONTENTS, "products", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_data_function", + CURLFORM_COPYCONTENTS, "insert", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_data_key", + CURLFORM_COPYCONTENTS, "sku", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_return_table", + CURLFORM_COPYCONTENTS, "products", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "sku", + CURLFORM_PTRCONTENTS, image_path, + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "description", + CURLFORM_PTRCONTENTS, description, + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "comment", + CURLFORM_PTRCONTENTS, comment, + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "price", + CURLFORM_PTRCONTENTS, price, + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "image", + CURLFORM_FILE, image_path, + CURLFORM_CONTENTTYPE, "image/jpeg", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_data_file_field", + CURLFORM_COPYCONTENTS, "image", + CURLFORM_END); + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "mv_data_file_path", + CURLFORM_COPYCONTENTS, "images/items", + CURLFORM_END); + last = NULL; + request(NULL, NULL, post, "%s", "admin/item_edit"); + curl_formfree(post); + post = NULL; +} + void icclient_admin_logout(icclient_admin *admin) { request(NULL, NULL, NULL, "%s", "admin/login"); diff --git a/icclient/admin.h b/icclient/admin.h index fa38676..fa46f9a 100644 --- a/icclient/admin.h +++ b/icclient/admin.h @@ -15,6 +15,8 @@ extern "C" { const char *password, const char *successpage, const char *nextpage, const char *failpage, size_t (*handler)(void *, size_t, size_t, void *)); + void icclient_admin_newitem(const char *description, const char *comment, + const char *price, const char *image_path); void icclient_admin_logout(struct icclient_admin *admin); #ifdef __cplusplus |