// Copyright 2007 (c) by Perforce Software, Inc. All rights reserved. // // p4wResolveIAProcessorView: // The Non-local interactive resolve processor view. // ------------------------------------- // Includes // #include <stdlib.h> #include <string.h> #include <p4wp4.h> #include "p4wView.h" #include "p4wResolveIAProcessorView.h" #include "p4wResolveIAProcessorPane.h" #include "p4wClientRootPane.h" // // ------------------------------------- // Constructors and destructor. // p4wResolveIAProcessorView::p4wResolveIAProcessorView(p4wRequest & Request) : p4wView(Request), fRequest(Request), fHasConflicts(0), fForceOption(0), fMarkOption(0), fConflictsOK(0), fRC(0) { fErrMsg = NULL; fdwbFlag.Set(""); } p4wResolveIAProcessorView::~p4wResolveIAProcessorView() { } // ------------------------------------- // Control item render functions. // void p4wResolveIAProcessorView::Render() { p4wClientRootPane clientRootPane(*this, fRequest); const char *cliArgs[] = { "-o" }; fRequest.p4("client", 1, cliArgs, &clientRootPane); fRequest.p4Wait(); if (clientRootPane.GetIsLockedAway()) { fErrMsg = "Locked client may only be used by its owner"; return; } if (!SEC_ALLOW_ALL_CLIENTS && !fRequest.isLocalRequest()) { if (strcmp(clientRootPane.GetOwner().Text(), fRequest.GetUser().Text())) { if (SEC_ALLOW_UNOWNED_CLIENTS && clientRootPane.GetOwner().Length() == 0) ; else { fErrMsg = "Client may only be used by its owner"; return; } } if (!clientRootPane.GetHost().Length() && !SEC_ALLOW_NOHOST_CLIENTS) { fErrMsg = "Clients without a Host may not be used"; return; } } fPost = fRequest.GetPostData(); if (!fPost) { fErrMsg = "Request contains no data"; return; } char *p = strstr(fPost, "&yours=Accept+Yours&"); if (p) fRC = CMS_YOURS; // accept yours else { p = strstr(fPost, "&theirs=Accept+Theirs&"); if (p) fRC = CMS_THEIRS; // accept theirs else { // accept merged - the file just send in the form fErrMsg = ProcessPostData(); if (fHasConflicts && !fConflictsOK) { fErrMsg = "The Merged file still contains conflicts and could not be resolved.<br>Use you browser's back button to return to editing the Interactive Resolve page and either:<ul><li>Remove the remaining conflicts from the merged result<li>Check the \"Accept even if conflict markers are still present\" checkbox<ul>"; return; } } } p4wResolveIAProcessorPane resolveIAProcessorPane(*this, fRequest, &fErrMsg, &md5in, &editbuf, fRC); if (fdwbFlag.Length()) fRequest.p4Arg( fdwbFlag.Text() ); if (fForceOption) fRequest.p4Arg( "-f" ); if (fMarkOption) fRequest.p4Arg( "-v" ); fRequest.p4Arg( fRequest.GetDepotPath().Text() ); fRequest.p4( "resolve", 0, 0, &resolveIAProcessorPane ); fRequest.p4Wait(); fRC = resolveIAProcessorPane.GetRC(); char *perr = resolveIAProcessorPane.GetErrMsg(); if (perr) { fErrBuf.Set(perr); fErrMsg = fErrBuf.Text(); } } char *p4wResolveIAProcessorView::ProcessPostData() { if (!fPost) return "No data to write."; char *p = strstr(fPost, "Key="); if (!p) return "No security key"; p += sizeof("Key=")-1; char *q = strchr(p, '&'); if (!q) return "No security key"; *q++ = '\0'; md5in << p; p = strstr(q, "Edit="); if (!p) p = strstr(fPost, "Edit="); if (!p) return "Unable to process file data."; p += sizeof("Edit=")-1; q = strchr(p, '&'); if (!q) return "Unable to process file data."; *q++ = '\0'; StrBuf edit; edit << p; editbuf.UnescapeURL(edit, 1); for (p = editbuf.Text(); *p; ) { if ((*p == '\r') && (*(p+1) == '\n')) strcpy(p, p+1); else p++; } editbuf.SetLength(); p = strstr(editbuf.Text(), ">>>> ORIGINAL "); if (p) { p = strstr(p, "==== THEIRS "); if (p) { p = strstr(p, "==== YOURS "); if (p) fHasConflicts = 1; } } p = strstr(q, "conflictsOK="); if (p && *(p+sizeof("conflictsOK=")-1) == 'y') fConflictsOK = 1; p = strstr(q, "forceOption="); if (p && *(p+sizeof("forceOption=")-1) == '1') fForceOption = 1; p = strstr(q, "markOption="); if (p && *(p+sizeof("markOption=")-1) == '1') fMarkOption = 1; p = strstr(q, "dwbFlag="); if (p) { p += sizeof("dwbFlag=")-1; if (*p != '&') { q = strchr(p, '&'); if (!q) return "Invalid whitespace flag"; *q = '\0'; fdwbFlag.Set(p); *q = '&'; } } return 0; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12234 | Matt Attaway |
Rejigger P4Web project in preparation for official sunsetting The bin directory contains the last official builds of P4Web from the Perforce download site. P4Web is soon to be completely sunsetted; these builds are here for folks who don't want to build their own. To better handle the archived builds the source code has been moved into a separate src directory. |
||
//guest/perforce_software/p4web/Views/p4wResolveIAProcessorView.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |