bool CWizApiBase::callAttachmentPostData(const WIZDOCUMENTATTACHMENTDATAEX& data) { m_currentAttachment = data; int nParts = data.nObjectPart; Q_ASSERT(0 != nParts); QString info = data.strName; Q_EMIT processLog(tr("upload attachment info: ") + info); CWizApiTokenParam param(*this); CWizXmlRpcStructValue* pAttachmentStruct = new CWizXmlRpcStructValue(); param.AddStruct(_T("attachment"), pAttachmentStruct); bool bInfo = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? true : false; bool bData = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? true : false; pAttachmentStruct->AddString(_T("attachment_guid"), data.strGUID); pAttachmentStruct->AddBool(_T("attachment_info"), bInfo ? true : false); pAttachmentStruct->AddBool(_T("attachment_data"), bData ? true : false); bool bDataInfoAdded = false; const WIZDOCUMENTATTACHMENTDATAEX& infodata = data; if (bInfo) { pAttachmentStruct->AddString(_T("attachment_document_guid"), infodata.strDocumentGUID); pAttachmentStruct->AddString(_T("attachment_name"), infodata.strName); pAttachmentStruct->AddString(_T("attachment_url"), infodata.strURL); pAttachmentStruct->AddString(_T("attachment_description"), infodata.strDescription); pAttachmentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified); pAttachmentStruct->AddString(_T("info_md5"), infodata.strInfoMD5); pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = true; } if (bData) { if (!bDataInfoAdded) { pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = true; } pAttachmentStruct->AddString(_T("attachment_zip_md5"), WizMd5StringNoSpaceJava(infodata.arrayData)); } return callXmlRpc(SyncMethod_PostAttachmentData, ¶m); }
BOOL WIZSTYLEDATA::SaveToXmlRpc(CWizXmlRpcStructValue& data) const { data.AddString(_T("style_description"), strDescription);; data.AddString(_T("style_guid"), strGUID); data.AddString(_T("style_name"), strName); data.AddColor(_T("style_textcolor"), crTextColor); data.AddColor(_T("style_backcolor"), crBackColor); data.AddBool(_T("style_text_bold"), bTextBold); data.AddInt(_T("style_flagindex"), nFlagIndex); data.AddTime(_T("dt_info_modified"), tModified); data.AddInt64(_T("version"), nVersion);; return TRUE; }
CWizKMAttachmentPostDataParam(int nApiVersion, const QString& strToken, const QString& strBookGUID, const QString& strAttachmentGUID, UINT nParts, const WIZDOCUMENTATTACHMENTDATA& infodata, const QString& strObjMd5) : CWizKMAttachmentGetDataParam(nApiVersion, strToken, strBookGUID, strAttachmentGUID, nParts) { CWizXmlRpcStructValue* pAttachmentStruct = new CWizXmlRpcStructValue(); AddStruct(_T("attachment"), pAttachmentStruct); // pAttachmentStruct->AddString(_T("attachment_guid"), strAttachmentGUID); pAttachmentStruct->AddBool(_T("attachment_info"), (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? TRUE : FALSE); pAttachmentStruct->AddBool(_T("attachment_data"), (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? TRUE : FALSE); // BOOL bInfo = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? TRUE : FALSE; BOOL bData = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? TRUE : FALSE; // BOOL bDataInfoAdded = FALSE; // if (bInfo) { pAttachmentStruct->AddString(_T("attachment_document_guid"), infodata.strDocumentGUID); pAttachmentStruct->AddString(_T("attachment_name"), infodata.strName); pAttachmentStruct->AddString(_T("attachment_url"), infodata.strURL); pAttachmentStruct->AddString(_T("attachment_description"), infodata.strDescription); pAttachmentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified); pAttachmentStruct->AddString(_T("info_md5"), infodata.strInfoMD5); pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5); // bDataInfoAdded = TRUE; } if (bData) { if (!bDataInfoAdded) { pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = TRUE; } pAttachmentStruct->AddString(_T("attachment_zip_md5"), strObjMd5); } }
bool CWizApiBase::callDocumentPostData(const WIZDOCUMENTDATAEX& data) { m_currentDocument = data; int nParts = m_currentDocument.nObjectPart; Q_ASSERT(0 != nParts); bool bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? true : false; bool bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? true : false; bool bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? true : false; QString info = data.strTitle; Q_EMIT processLog(tr("upload document info:") + info); CWizApiTokenParam param(*this); CWizXmlRpcStructValue* pDocumentStruct = new CWizXmlRpcStructValue(); param.AddStruct(_T("document"), pDocumentStruct); pDocumentStruct->AddString(_T("document_guid"), data.strGUID); pDocumentStruct->AddBool(_T("document_info"), bInfo ? true : false); pDocumentStruct->AddBool(_T("document_data"), bData ? true : false); pDocumentStruct->AddBool(_T("document_param"), bParam ? true : false); bool bParamInfoAdded = false; bool bDataInfoAdded = false; const WIZDOCUMENTDATAEX& infodata = data; //m_currentDocument; if (bInfo) { pDocumentStruct->AddString(_T("document_title"), infodata.strTitle); pDocumentStruct->AddString(_T("document_category"), infodata.strLocation); pDocumentStruct->AddString(_T("document_filename"), infodata.strName); pDocumentStruct->AddString(_T("document_seo"), infodata.strSEO); pDocumentStruct->AddString(_T("document_url"), infodata.strURL); pDocumentStruct->AddString(_T("document_author"), infodata.strAuthor); pDocumentStruct->AddString(_T("document_keywords"), infodata.strKeywords); pDocumentStruct->AddString(_T("document_type"), infodata.strType); pDocumentStruct->AddString(_T("document_owner"), infodata.strOwner); pDocumentStruct->AddString(_T("document_filetype"), infodata.strFileType); pDocumentStruct->AddString(_T("document_styleguid"), infodata.strStyleGUID); pDocumentStruct->AddTime(_T("dt_created"), infodata.tCreated); pDocumentStruct->AddTime(_T("dt_modified"), infodata.tModified); pDocumentStruct->AddTime(_T("dt_accessed"), infodata.tAccessed); pDocumentStruct->AddInt(_T("document_iconindex"), infodata.nIconIndex); pDocumentStruct->AddInt(_T("document_protected"), infodata.nProtected); pDocumentStruct->AddInt(_T("document_readcount"), infodata.nReadCount); pDocumentStruct->AddInt(_T("document_attachment_count"), infodata.nAttachmentCount); pDocumentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified); pDocumentStruct->AddString(_T("info_md5"), infodata.strInfoMD5); pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5); pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified); pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5); pDocumentStruct->AddString(_T("system_tags"), infodata.strSystemTags); pDocumentStruct->AddInt(_T("document_share"), infodata.nShareFlags); //m_db->GetDocumentTags(infodata.strGUID, infodata.arrayTagGUID); pDocumentStruct->AddStringArray(_T("document_tags"), infodata.arrayTagGUID); bParamInfoAdded = true; bDataInfoAdded = true; } if (bParam) { //m_db->GetDocumentParams(infodata.strGUID, infodata.arrayParam); if (!bParamInfoAdded) { pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified); pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5); bParamInfoAdded = true; } pDocumentStruct->AddArray(_T("document_params"), infodata.arrayParam); } if (bData) { //if (!m_db->LoadDocumentData(m_currentDocument.strGUID, m_currentDocument.arrayData)) //{ // //skip this document // QString info2 = data.strTitle; // Q_EMIT processErrorLog(tr("Can not load document data: ") + info2); // onUploadObjectDataCompleted(data); // return false; //} if (!bDataInfoAdded) { pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = true; } pDocumentStruct->AddString(_T("document_zip_md5"), WizMd5StringNoSpaceJava(infodata.arrayData)); } return callXmlRpc(SyncMethod_PostDocumentData, ¶m); }
CWizKMDocumentPostDataParam(int nApiVersion, const QString& strToken, const QString& strBookGUID, const QString& strDocumentGUID, UINT nParts, const WIZDOCUMENTDATA& infodata, const CWizStdStringArray& tags, const std::deque<WIZDOCUMENTPARAMDATA>& params, const QString& strObjMd5) : CWizKMDocumentGetDataParam(nApiVersion, strToken, strBookGUID, strDocumentGUID, nParts) { CWizXmlRpcStructValue* pDocumentStruct = new CWizXmlRpcStructValue(); AddStruct(_T("document"), pDocumentStruct); // pDocumentStruct->AddString(_T("document_guid"), strDocumentGUID); pDocumentStruct->AddBool(_T("document_info"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? TRUE : FALSE); pDocumentStruct->AddBool(_T("document_data"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE); pDocumentStruct->AddBool(_T("document_param"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? TRUE : FALSE); // BOOL bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? TRUE : FALSE; BOOL bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE; BOOL bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? TRUE : FALSE; // BOOL bParamInfoAdded = FALSE; BOOL bDataInfoAdded = FALSE; // if (bInfo) { pDocumentStruct->AddString(_T("document_title"), infodata.strTitle); pDocumentStruct->AddString(_T("document_category"), infodata.strLocation); pDocumentStruct->AddString(_T("document_filename"), infodata.strName); pDocumentStruct->AddString(_T("document_seo"), infodata.strSEO); pDocumentStruct->AddString(_T("document_url"), infodata.strURL); pDocumentStruct->AddString(_T("document_author"), infodata.strAuthor); pDocumentStruct->AddString(_T("document_keywords"), infodata.strKeywords); pDocumentStruct->AddString(_T("document_type"), infodata.strType); pDocumentStruct->AddString(_T("document_owner"), infodata.strOwner); pDocumentStruct->AddString(_T("document_filetype"), infodata.strFileType); pDocumentStruct->AddString(_T("document_styleguid"), infodata.strStyleGUID); pDocumentStruct->AddTime(_T("dt_created"), infodata.tCreated); pDocumentStruct->AddTime(_T("dt_modified"), infodata.tModified); pDocumentStruct->AddTime(_T("dt_accessed"), infodata.tAccessed); pDocumentStruct->AddInt(_T("document_iconindex"), infodata.nIconIndex); pDocumentStruct->AddInt(_T("document_protected"), infodata.nProtected); pDocumentStruct->AddInt(_T("document_readcount"), infodata.nReadCount); pDocumentStruct->AddInt(_T("document_attachment_count"), infodata.nAttachmentCount); pDocumentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified); pDocumentStruct->AddString(_T("info_md5"), infodata.strInfoMD5); pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5); pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified); pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5); // bParamInfoAdded = TRUE; bDataInfoAdded = TRUE; // pDocumentStruct->AddStringArray(_T("document_tags"), tags); } if (bParam) { if (!bParamInfoAdded) { pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified); pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5); bParamInfoAdded = TRUE; } // std::deque<WIZDOCUMENTPARAMDATA> arrParams; arrParams.assign(params.begin(), params.end()); pDocumentStruct->AddArray(_T("document_params"), arrParams); } if (bData) { if (!bDataInfoAdded) { pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = TRUE; } // pDocumentStruct->AddString(_T("document_zip_md5"), strObjMd5); } }