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); } }