mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Updated Windows application to support new desktop action framework. Updated project to build with Visual Studio 2005.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3511 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Binary file not shown.
@@ -18,13 +18,13 @@
|
||||
#include "stdafx.h"
|
||||
#include "CAlfrescoApp.h"
|
||||
#include "CAlfrescoAppDlg.h"
|
||||
#include "FileStatusDialog.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util\String.h"
|
||||
#include "util\DataBuffer.h"
|
||||
#include "util\FileName.h"
|
||||
#include "util\Integer.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
@@ -82,6 +82,7 @@ BOOL CCAlfrescoAppApp::InitInstance()
|
||||
// Get the path to the folder containing the application
|
||||
|
||||
String folderPath = appPath.substring(0, pos);
|
||||
String exeName = appPath.substring(pos + 1);
|
||||
|
||||
// Create the Alfresco interface
|
||||
|
||||
@@ -90,27 +91,69 @@ BOOL CCAlfrescoAppApp::InitInstance()
|
||||
|
||||
try {
|
||||
|
||||
// If there are no file paths on the command line then display a status page for the files
|
||||
// in the Alfresco folder
|
||||
// Get the action information
|
||||
|
||||
if ( __argc == 1) {
|
||||
AlfrescoActionInfo actionInfo = alfresco.getActionInformation(exeName);
|
||||
|
||||
// Display status for the files in the Alfresco folder
|
||||
// Check if the action should be confirmed
|
||||
|
||||
doFolderStatus( alfresco);
|
||||
if ( actionInfo.hasPreProcessAction(PreConfirmAction)) {
|
||||
|
||||
// Get the confirmation message
|
||||
|
||||
String confirmMsg = actionInfo.getConfirmationMessage();
|
||||
if ( confirmMsg.length() == 0)
|
||||
confirmMsg = L"Run action ?";
|
||||
|
||||
// Display a confirmation dialog
|
||||
|
||||
if ( AfxMessageBox( confirmMsg, MB_OKCANCEL | MB_ICONQUESTION) == IDCANCEL)
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
|
||||
// Build a list of the file names
|
||||
// Check if the action supports multiple paths, if not then call the action once for each supplied path
|
||||
|
||||
StringList fileList;
|
||||
if ( actionInfo.hasAttribute(AttrMultiplePaths)) {
|
||||
|
||||
// Build a list of paths from the command line arguments
|
||||
|
||||
StringList pathList;
|
||||
|
||||
for ( int i = 1; i < __argc; i++)
|
||||
fileList.addString( String(__wargv[i]));
|
||||
pathList.addString( String(__wargv[i]));
|
||||
|
||||
// Process the file list and check in or out each file
|
||||
// Run the action
|
||||
|
||||
doCheckInOut( alfresco, fileList);
|
||||
runAction( alfresco, pathList, actionInfo);
|
||||
}
|
||||
|
||||
// Check if the action supports file/folder targets
|
||||
|
||||
else if ( actionInfo.hasAttribute( AttrAnyFilesFolders) == true) {
|
||||
|
||||
// Pass one path at a time to the action
|
||||
|
||||
for ( int i = 1; i < __argc; i++) {
|
||||
|
||||
// Create a path list with a single path
|
||||
|
||||
StringList pathList;
|
||||
pathList.addString( String(__wargv[i]));
|
||||
|
||||
// Run the action
|
||||
|
||||
runAction( alfresco, pathList, actionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// Action does not use targets, just run the action
|
||||
|
||||
else {
|
||||
|
||||
// Run the action
|
||||
|
||||
StringList emptyList;
|
||||
runAction( alfresco, emptyList, actionInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
@@ -124,128 +167,36 @@ BOOL CCAlfrescoAppApp::InitInstance()
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Run the main dialog
|
||||
/**
|
||||
CCAlfrescoAppDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with OK
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with Cancel
|
||||
}
|
||||
**/
|
||||
// Exit the application
|
||||
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display file status of the files in the target Alfresco folder
|
||||
*
|
||||
* @param AlfrescoInterface& alfresco
|
||||
* @param const wchar_t* fileSpec
|
||||
* @return bool
|
||||
*/
|
||||
bool CCAlfrescoAppApp::doFolderStatus( AlfrescoInterface& alfresco, const wchar_t* fileSpec) {
|
||||
|
||||
// Get the base UNC path
|
||||
|
||||
String uncPath = alfresco.getUNCPath();
|
||||
uncPath.append(PathSeperator);
|
||||
|
||||
// Search the Alfresco folder
|
||||
|
||||
WIN32_FIND_DATA findData;
|
||||
String searchPath = uncPath;
|
||||
searchPath.append( fileSpec);
|
||||
|
||||
bool sts = false;
|
||||
HANDLE fHandle = FindFirstFile( searchPath, &findData);
|
||||
AlfrescoFileInfoList fileList;
|
||||
|
||||
if ( fHandle != INVALID_HANDLE_VALUE) {
|
||||
|
||||
// Loop until all files have been returned
|
||||
|
||||
PTR_AlfrescoFileInfo pFileInfo;
|
||||
sts = true;
|
||||
|
||||
while ( fHandle != INVALID_HANDLE_VALUE) {
|
||||
|
||||
// Get the file name, ignore the '.' and '..' files
|
||||
|
||||
String fName = findData.cFileName;
|
||||
|
||||
if ( fName.equals(L".") || fName.equals(L"..")) {
|
||||
|
||||
// Get the next file/folder name in the search
|
||||
|
||||
if ( FindNextFile( fHandle, &findData) == 0)
|
||||
fHandle = INVALID_HANDLE_VALUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the file information for the current file folder
|
||||
|
||||
pFileInfo = alfresco.getFileInformation( findData.cFileName);
|
||||
|
||||
if ( pFileInfo.get() != NULL) {
|
||||
|
||||
// Add the file to the list
|
||||
|
||||
fileList.addInfo( pFileInfo);
|
||||
}
|
||||
|
||||
// Get the next file/folder name in the search
|
||||
|
||||
if ( FindNextFile( fHandle, &findData) == 0)
|
||||
fHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Display the file status dialog if there are files to display
|
||||
|
||||
if ( fileList.size() > 0) {
|
||||
|
||||
// Display the file status dialog
|
||||
|
||||
CFileStatusDialog dlg( fileList);
|
||||
dlg.DoModal();
|
||||
}
|
||||
else {
|
||||
CString msg;
|
||||
msg.FormatMessage( L"No files found in %1", uncPath.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
// Return status
|
||||
|
||||
return sts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the list of files and check in or out each file
|
||||
* Process the command line arguments and build the parameter list for the desktop action
|
||||
*
|
||||
* @param alfresco AlfrescoInterface&
|
||||
* @param files StringList&
|
||||
* @param paths StringList&
|
||||
* @param actionInfo AlfrescoActionInfo&
|
||||
* @param params DesktopParams&
|
||||
* @return bool
|
||||
*/
|
||||
bool CCAlfrescoAppApp::doCheckInOut( AlfrescoInterface& alfresco, StringList& files) {
|
||||
bool CCAlfrescoAppApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringList& paths, AlfrescoActionInfo& actionInfo,
|
||||
DesktopParams& params) {
|
||||
|
||||
// If there are no paths then just return a success
|
||||
|
||||
if ( paths.numberOfStrings() == 0)
|
||||
return true;
|
||||
|
||||
// Process the list of files and either check in the file if it is a working copy or check out
|
||||
// the file
|
||||
|
||||
for ( unsigned int i = 0; i < files.numberOfStrings(); i++) {
|
||||
for ( unsigned int i = 0; i < paths.numberOfStrings(); i++) {
|
||||
|
||||
// Get the current file name
|
||||
|
||||
String curFile = files.getStringAt( i);
|
||||
String curFile = paths.getStringAt( i);
|
||||
|
||||
// Check if the path is on an Alfresco mapped drive
|
||||
|
||||
@@ -259,63 +210,198 @@ bool CCAlfrescoAppApp::doCheckInOut( AlfrescoInterface& alfresco, StringList& fi
|
||||
curFile = uncPath;
|
||||
}
|
||||
|
||||
// Check that the path is to a file
|
||||
// Check if the path is to a file/folder, and whether it is a local path
|
||||
|
||||
bool copyFile = false;
|
||||
|
||||
DWORD attr = GetFileAttributes( curFile);
|
||||
if ( attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
|
||||
|
||||
if ( attr != INVALID_FILE_ATTRIBUTES) {
|
||||
|
||||
// Check if the action supports the file/folder type
|
||||
|
||||
bool isDir = (attr & FILE_ATTRIBUTE_DIRECTORY) != 0 ? true : false;
|
||||
|
||||
if ( isDir && actionInfo.supportsFolders() == false) {
|
||||
AfxMessageBox(L"Action does not support folders", MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
else if ( actionInfo.supportsFiles() == false) {
|
||||
AfxMessageBox(L"Action does not support files", MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the file name from the path
|
||||
|
||||
StringList nameParts = FileName::splitPath( curFile);
|
||||
String curName = nameParts.getStringAt( 1);
|
||||
|
||||
// Get the Alfresco file status information
|
||||
|
||||
PTR_AlfrescoFileInfo pFileInfo = alfresco.getFileInformation( curName);
|
||||
|
||||
// If the path is to a file that is not on the Alfresco share the file will need to be copied,
|
||||
// after checking the status of a matching file in the Alfresco folder
|
||||
|
||||
if ( curFile.length() >= 3 && curFile.substring(1,3).equals( L":\\")) {
|
||||
|
||||
// Check if there is an existing file with the same name
|
||||
// Check if the action supports local files
|
||||
|
||||
if ( pFileInfo.get() != NULL) {
|
||||
|
||||
// Check if the file is a working copy
|
||||
|
||||
if ( pFileInfo->isWorkingCopy()) {
|
||||
|
||||
// Local file matches a working copy file in the Alfresco folder
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Found matching working copy for local file %1", curName.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION);
|
||||
if ( isDir == false && actionInfo.hasAttribute(AttrClientFiles) == false) {
|
||||
AfxMessageBox(L"Action does not support local files", MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
else if ( isDir == true && actionInfo.hasAttribute(AttrClientFolders) == false) {
|
||||
AfxMessageBox(L"Action does not support local folders", MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
else if ( pFileInfo->getLockType() != LockNone) {
|
||||
|
||||
// File is locked, may be the original document
|
||||
// Check if there is an existing file in the Alfresco with the same name, check if the file is locked
|
||||
|
||||
PTR_AlfrescoFileInfo fInfo = alfresco.getFileInformation( curName);
|
||||
if ( fInfo.get() != NULL) {
|
||||
|
||||
// There is an existing file in the Alfresco folder with the same name, check if it is locked
|
||||
|
||||
if ( fInfo->getLockType() != LockNone) {
|
||||
AfxMessageBox( L"Cannot copy file to Alfresco folder, destination file is locked", MB_OK | MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
else if ( actionInfo.hasPreProcessAction(PreLocalToWorkingCopy) == true && fInfo->isWorkingCopy() == false) {
|
||||
AfxMessageBox( L"Cannot copy to Alfresco folder, destination must overwrite a working copy", MB_OK | MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( actionInfo.hasPreProcessAction(PreLocalToWorkingCopy) == true) {
|
||||
|
||||
// Target folder does not contain a matching working copy of the local file
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Destination file %1 is locked", curName.data());
|
||||
msg.FormatMessage( L"No matching working copy for %1", curName.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the files/folders using the Windows shell
|
||||
|
||||
bool copyAborted = false;
|
||||
|
||||
if ( copyFilesUsingShell( curFile, alfresco.getUNCPath(), copyAborted) == false) {
|
||||
|
||||
// Check if the copy failed or the user aborted the copy
|
||||
|
||||
if ( copyAborted == false) {
|
||||
|
||||
// File copy failed
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( isDir ? L"Failed to copy folder %1" : L"Failed to copy file %1", curFile.data());
|
||||
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
// Indicate that we have copied a new file to the Alfresco share, do not check in/out
|
||||
// User aborted the file copy
|
||||
|
||||
copyFile = true;
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Copy aborted for %1", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a desktop target for the copied file
|
||||
|
||||
params.addTarget( new DesktopTarget(isDir ? TargetCopiedFolder : TargetCopiedFile, curName));
|
||||
}
|
||||
else {
|
||||
|
||||
// Indicate that we have copied a new file to the Alfresco share, do not check in/out
|
||||
// Path is a UNC path, check if the file/folder is in the same folder as the action
|
||||
|
||||
copyFile = true;
|
||||
DesktopTarget* pTarget = NULL;
|
||||
|
||||
if ( curFile.startsWith( alfresco.getUNCPath())) {
|
||||
|
||||
// Path is in the same folder as the application, or in a sub-folder
|
||||
|
||||
String relPath = curFile.substring( alfresco.getUNCPath().length() + 1);
|
||||
|
||||
if ( relPath.indexOf( L"\\") == -1) {
|
||||
|
||||
// Create a target using the file name only
|
||||
|
||||
pTarget = new DesktopTarget( isDir ? TargetFolder : TargetFile, relPath);
|
||||
}
|
||||
}
|
||||
|
||||
// If the target is not valid the file/folder is not in the same folder as the client-side application,
|
||||
// copy the files/folders to the target folder or use the root relative path to the file/folder
|
||||
|
||||
if ( pTarget == NULL) {
|
||||
|
||||
// Check if Alfresco files/folders should be copied to the target folder
|
||||
|
||||
if ( actionInfo.hasPreProcessAction(PreCopyToTarget)) {
|
||||
|
||||
// Copy the files/folders using the Windows shell
|
||||
|
||||
bool copyAborted = false;
|
||||
|
||||
if ( copyFilesUsingShell( curFile, alfresco.getUNCPath(), copyAborted) == false) {
|
||||
|
||||
// Check if the copy failed or the user aborted the copy
|
||||
|
||||
if ( copyAborted == false) {
|
||||
|
||||
// File copy failed
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( isDir ? L"Failed to copy folder %1" : L"Failed to copy file %1", curFile.data());
|
||||
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
// User aborted the file copy
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Copy aborted for %1", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a desktop target for the copied file
|
||||
|
||||
pTarget= new DesktopTarget(isDir ? TargetCopiedFolder : TargetCopiedFile, curName);
|
||||
}
|
||||
else {
|
||||
|
||||
// Get the root relative path to the file/folder
|
||||
|
||||
String rootRelPath = curFile.substring(alfresco.getRootPath().length());
|
||||
pTarget = new DesktopTarget( isDir ? TargetFolder : TargetFile, rootRelPath);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the desktop target
|
||||
|
||||
params.addTarget( pTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return status
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file/folder using the Windows shell
|
||||
*
|
||||
* @param fromFileFolder const String&
|
||||
* @param toFolder const String&
|
||||
* @param aborted bool&
|
||||
* @return bool
|
||||
*/
|
||||
bool CCAlfrescoAppApp::copyFilesUsingShell(const String& fromFileFolder, const String& toFolder, bool& aborted) {
|
||||
|
||||
// Build the from/to paths, must be double null terminated
|
||||
|
||||
@@ -325,8 +411,8 @@ bool CCAlfrescoAppApp::doCheckInOut( AlfrescoInterface& alfresco, StringList& fi
|
||||
memset( fromPath, 0, sizeof( fromPath));
|
||||
memset( toPath, 0, sizeof( toPath));
|
||||
|
||||
wcscpy( fromPath, curFile.data());
|
||||
wcscpy( toPath, alfresco.getUNCPath());
|
||||
wcscpy( fromPath, fromFileFolder.data());
|
||||
wcscpy( toPath, toFolder.data());
|
||||
|
||||
// Copy the local file to the Alfresco folder
|
||||
|
||||
@@ -342,165 +428,140 @@ bool CCAlfrescoAppApp::doCheckInOut( AlfrescoInterface& alfresco, StringList& fi
|
||||
|
||||
// Copy the file to the Alfresco folder
|
||||
|
||||
if ( SHFileOperation( &fileOpStruct) != 0) {
|
||||
bool sts = false;
|
||||
|
||||
// File copy failed
|
||||
if ( SHFileOperation( &fileOpStruct) == 0) {
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Failed to copy file %1", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
// File copy successful
|
||||
|
||||
sts = true;
|
||||
}
|
||||
else if ( fileOpStruct.fAnyOperationsAborted) {
|
||||
|
||||
// User aborted the file copy
|
||||
|
||||
aborted = true;
|
||||
}
|
||||
|
||||
// Return the copy status
|
||||
|
||||
return sts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run an action
|
||||
*
|
||||
* @param alfresco AlfrescoInterface&
|
||||
* @param pathList StringList&
|
||||
* @param actionInfo AlfrescoActionInfo&
|
||||
* @return bool
|
||||
*/
|
||||
bool CCAlfrescoAppApp::runAction( AlfrescoInterface& alfresco, StringList& pathList, AlfrescoActionInfo& actionInfo) {
|
||||
|
||||
// Build the desktop action parameter list, perform any file copying of local files
|
||||
|
||||
bool sts = false;
|
||||
DesktopParams desktopParams;
|
||||
|
||||
if ( buildDesktopParameters( alfresco, pathList, actionInfo, desktopParams)) {
|
||||
|
||||
// Run the desktop action
|
||||
|
||||
DesktopResponse response = alfresco.runAction( actionInfo, desktopParams);
|
||||
|
||||
// Check the response status
|
||||
|
||||
if ( response.getStatus() != StsSuccess) {
|
||||
|
||||
// Check if the status indicates a command line should be launched
|
||||
|
||||
if ( response.getStatus() == StsCommandLine) {
|
||||
|
||||
// Initialize the startup information
|
||||
|
||||
STARTUPINFO startupInfo;
|
||||
memset(&startupInfo, 0, sizeof(STARTUPINFO));
|
||||
|
||||
// Launch a process using the command line
|
||||
|
||||
PROCESS_INFORMATION processInfo;
|
||||
memset(&processInfo, 0, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
if ( CreateProcess( response.getStatusMessage().data(), NULL, NULL, NULL, true, 0, NULL, NULL,
|
||||
&startupInfo, &processInfo) == false) {
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Copy aborted for %1", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
return false;
|
||||
msg.FormatMessage( L"Failed to launch command line\n\n%1\n\nError %2!d!", response.getStatusMessage().data(), GetLastError());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
// Get the file information for the copied file
|
||||
|
||||
pFileInfo = alfresco.getFileInformation( curName);
|
||||
}
|
||||
|
||||
// Check in or check out the file
|
||||
|
||||
if ( pFileInfo.get() != NULL) {
|
||||
|
||||
// Check if the file should be checked in/out
|
||||
|
||||
if ( copyFile == false) {
|
||||
|
||||
// Check if the file is a working copy, if so then check it in
|
||||
|
||||
if ( pFileInfo->isWorkingCopy()) {
|
||||
|
||||
// Check in the file
|
||||
|
||||
doCheckIn( alfresco, pFileInfo);
|
||||
}
|
||||
else if ( pFileInfo->getLockType() == LockNone) {
|
||||
|
||||
// Check out the file
|
||||
|
||||
doCheckOut( alfresco, pFileInfo);
|
||||
}
|
||||
else {
|
||||
|
||||
// File is locked, may already be checked out
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"File %1 is locked", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// No existing file to link the copied file to
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Copied file %1 to Alfresco folder", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Failed to get file status for %1", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// Check the error status
|
||||
|
||||
CString msg;
|
||||
|
||||
if ( attr != INVALID_FILE_ATTRIBUTES)
|
||||
msg.FormatMessage( L"Path %1 is a folder, ignored", curFile.data());
|
||||
else
|
||||
msg.FormatMessage( L"File %1 does not exist", curFile.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
sts = true;
|
||||
}
|
||||
|
||||
// Return status
|
||||
// Check if a web browser should be launched with a URL
|
||||
|
||||
return true;
|
||||
else if ( response.getStatus() == StsLaunchURL) {
|
||||
|
||||
// Use the Windows shell to open the URL
|
||||
|
||||
HINSTANCE shellSts = ShellExecute( NULL, NULL, response.getStatusMessage().data(), NULL, NULL, SW_SHOWNORMAL);
|
||||
if (( int) shellSts < 32) {
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Failed to launch URL\n\n%1", response.getStatusMessage().data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
else
|
||||
sts = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check in the specified file
|
||||
*
|
||||
* @param alfresco AlfrescoInterface&
|
||||
* @param pFileInfo PTR_AlfrescoFileInfo&
|
||||
* @return bool
|
||||
*/
|
||||
bool CCAlfrescoAppApp::doCheckIn( AlfrescoInterface& alfresco, PTR_AlfrescoFileInfo& pFileInfo) {
|
||||
// Error status
|
||||
|
||||
bool checkedIn = false;
|
||||
else {
|
||||
|
||||
try {
|
||||
// Get the error message
|
||||
|
||||
// Check in the specified file
|
||||
String errMsg;
|
||||
|
||||
alfresco.checkIn( pFileInfo->getName());
|
||||
switch ( response.getStatus()) {
|
||||
case StsFileNotFound:
|
||||
errMsg = L"File not found";
|
||||
break;
|
||||
case StsAccessDenied:
|
||||
errMsg = L"Access denied";
|
||||
break;
|
||||
case StsBadParameter:
|
||||
errMsg = L"Bad parameter in request";
|
||||
break;
|
||||
case StsNoSuchAction:
|
||||
errMsg = L"No such action";
|
||||
break;
|
||||
default:
|
||||
errMsg = L"Error running action";
|
||||
break;
|
||||
}
|
||||
|
||||
// Display an error dialog
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Checked in file %1", pFileInfo->getName().data());
|
||||
|
||||
if ( response.hasStatusMessage())
|
||||
msg.FormatMessage( L"%1\n\n%2", errMsg.data(), response.getStatusMessage().data());
|
||||
else
|
||||
msg = errMsg.data();
|
||||
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
else if ( response.hasStatusMessage()) {
|
||||
|
||||
// Display the message returned by the action
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Action returned message\n\n%1", response.getStatusMessage().data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION);
|
||||
|
||||
// Indicate that the check in was successful
|
||||
|
||||
checkedIn = true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Error checking in file %1\n\n%2", pFileInfo->getName().data(), ex.getMessage().data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
|
||||
// Return the check in status
|
||||
// Return the action status
|
||||
|
||||
return checkedIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out the specified file
|
||||
*
|
||||
* @param alfresco AlfrescoInterface&
|
||||
* @param pFileInfo PTR_AlfrescoFileInfo&
|
||||
* @return bool
|
||||
*/
|
||||
bool CCAlfrescoAppApp::doCheckOut( AlfrescoInterface& alfresco, PTR_AlfrescoFileInfo& pFileInfo) {
|
||||
|
||||
bool checkedOut = false;
|
||||
|
||||
try {
|
||||
|
||||
// Check out the specified file
|
||||
|
||||
String workingCopy;
|
||||
alfresco.checkOut( pFileInfo->getName(), workingCopy);
|
||||
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Checked out file %1 to %2", pFileInfo->getName().data(), workingCopy.data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION);
|
||||
|
||||
// Indicate that the check out was successful
|
||||
|
||||
checkedOut = true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
CString msg;
|
||||
msg.FormatMessage( L"Error checking out file %1\n\n%2", pFileInfo->getName().data(), ex.getMessage().data());
|
||||
AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
|
||||
// Return the check out status
|
||||
|
||||
return checkedOut;
|
||||
return sts;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
// Includes
|
||||
|
||||
#include "alfresco\Alfresco.hpp"
|
||||
#include "alfresco\Desktop.hpp"
|
||||
|
||||
using namespace Alfresco;
|
||||
|
||||
@@ -49,10 +50,15 @@ public:
|
||||
private:
|
||||
// Main Alfresco interface functions
|
||||
|
||||
bool doFolderStatus( AlfrescoInterface& alfresco, const wchar_t* fileSpec = L"*.*");
|
||||
bool doCheckInOut( AlfrescoInterface& alfresco, StringList& files);
|
||||
bool doCheckIn( AlfrescoInterface& alfresco, PTR_AlfrescoFileInfo& fileInfo);
|
||||
bool doCheckOut( AlfrescoInterface& alfresco, PTR_AlfrescoFileInfo& fileInfo);
|
||||
bool buildDesktopParameters( AlfrescoInterface& alfresco, StringList& paths, AlfrescoActionInfo& actionInfo, DesktopParams& params);
|
||||
|
||||
// Copy files/folders using the Windows shell
|
||||
|
||||
bool copyFilesUsingShell(const String& fromPath, const String& toPath, bool& aborted);
|
||||
|
||||
// Run the action
|
||||
|
||||
bool runAction( AlfrescoInterface& alfresco, StringList& pathList, AlfrescoActionInfo& actionInfo);
|
||||
};
|
||||
|
||||
extern CCAlfrescoAppApp theApp;
|
Binary file not shown.
@@ -27,29 +27,25 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About CAlfrescoApp"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
ICON 128,IDC_STATIC,11,17,20,20
|
||||
LTEXT "CAlfrescoApp Version 1.0",IDC_STATIC,40,10,119,8,
|
||||
SS_NOPREFIX
|
||||
LTEXT "CAlfrescoApp Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
|
||||
LTEXT "Copyright (C) 2005",IDC_STATIC,40,25,119,8
|
||||
DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_CALFRESCOAPP_DIALOG DIALOGEX 0, 0, 469, 156
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Alfresco Check In/Out"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
PUSHBUTTON "OK",IDOK,209,130,50,13
|
||||
LTEXT "Checked in 99 files",IDC_MSGTEXT,25,22,418,8
|
||||
LISTBOX IDC_FILELIST,23,38,424,83,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LISTBOX IDC_FILELIST,23,38,424,83,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
||||
@@ -83,13 +79,13 @@ BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Alfresco"
|
||||
VALUE "FileDescription", "Alfresco Check In/Out"
|
||||
VALUE "FileVersion", "1.0.0.1"
|
||||
VALUE "FileDescription", "Alfresco Drag And Drop"
|
||||
VALUE "FileVersion", "1.0.0.2"
|
||||
VALUE "InternalName", "CAlfrescoApp.exe"
|
||||
VALUE "LegalCopyright", "(c) Alfresco. All rights reserved."
|
||||
VALUE "OriginalFilename", "CAlfrescoApp.exe"
|
||||
VALUE "ProductName", "Alfresco"
|
||||
VALUE "ProductVersion", "1.0.0.1"
|
||||
VALUE "ProductVersion", "1.0.0.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -149,6 +145,40 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_FILESTATUS DIALOGEX 0, 0, 448, 332
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Alfresco File Status"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,391,311,50,14
|
||||
CONTROL "",IDC_FILELIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,434,299
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_FILESTATUS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 441
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 325
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -193,42 +223,6 @@ END
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON1 ICON "alfresco.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_FILESTATUS DIALOGEX 0, 0, 448, 332
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "Alfresco File Status"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,391,311,50,14
|
||||
CONTROL "",IDC_FILELIST,"SysListView32",LVS_REPORT |
|
||||
LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,434,299
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_FILESTATUS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 441
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 325
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@@ -1,21 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CAlfrescoApp", "CAlfrescoApp.vcproj", "{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Debug.ActiveCfg = Debug|Win32
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Debug.Build.0 = Debug|Win32
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Release.ActiveCfg = Release|Win32
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Release.Build.0 = Release|Win32
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
Binary file not shown.
@@ -1,127 +1,191 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Version="8.00"
|
||||
Name="CAlfrescoApp"
|
||||
ProjectGUID="{055DCC85-2D1A-4594-B2BE-ED292D2BF26D}"
|
||||
RootNamespace="CAlfrescoApp"
|
||||
Keyword="MFCProj">
|
||||
Keyword="MFCProj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="1">
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\includes"
|
||||
PreprocessorDefinitions="UNICODE"
|
||||
MinimalRebuild="TRUE"
|
||||
PreprocessorDefinitions="UNICODE,_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="mpr.lib shell32.lib"
|
||||
OutputFile="$(OutDir)/Alfresco.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="1">
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".\includes"
|
||||
PreprocessorDefinitions="UNICODE"
|
||||
MinimalRebuild="FALSE"
|
||||
PreprocessorDefinitions="UNICODE,_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="false"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="mpr.lib shell32.lib"
|
||||
OutputFile="$(OutDir)/Alfresco.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
@@ -130,165 +194,227 @@
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\CAlfrescoApp.cpp">
|
||||
RelativePath=".\CAlfrescoApp.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CAlfrescoAppDlg.cpp">
|
||||
RelativePath=".\CAlfrescoAppDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileStatusDialog.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp">
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<Filter
|
||||
Name="util"
|
||||
Filter="">
|
||||
>
|
||||
<File
|
||||
RelativePath=".\source\util\ByteArray.cpp">
|
||||
RelativePath=".\source\util\ByteArray.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\DataBuffer.cpp">
|
||||
RelativePath=".\source\util\DataBuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\DataPacker.cpp">
|
||||
RelativePath=".\source\util\DataPacker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\Exception.cpp">
|
||||
RelativePath=".\source\util\Exception.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\FileName.cpp">
|
||||
RelativePath=".\source\util\FileName.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\Integer.cpp">
|
||||
RelativePath=".\source\util\Integer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\Long.cpp">
|
||||
RelativePath=".\source\util\Long.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\String.cpp">
|
||||
RelativePath=".\source\util\String.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\util\System.cpp">
|
||||
RelativePath=".\source\util\System.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="alfresco"
|
||||
Filter="">
|
||||
>
|
||||
<File
|
||||
RelativePath=".\source\alfresco\Alfresco.cpp">
|
||||
RelativePath=".\source\alfresco\Alfresco.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\alfresco\Desktop.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\CAlfrescoApp.h">
|
||||
RelativePath=".\CAlfrescoApp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CAlfrescoAppDlg.h">
|
||||
RelativePath=".\CAlfrescoAppDlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileStatusDialog.h">
|
||||
RelativePath=".\Resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h">
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="util"
|
||||
Filter="">
|
||||
>
|
||||
<File
|
||||
RelativePath=".\includes\util\ByteArray.h">
|
||||
RelativePath=".\includes\util\ByteArray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\DataBuffer.h">
|
||||
RelativePath=".\includes\util\DataBuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\DataPacker.h">
|
||||
RelativePath=".\includes\util\DataPacker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\Exception.h">
|
||||
RelativePath=".\includes\util\Exception.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\FileName.h">
|
||||
RelativePath=".\includes\util\FileName.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\Integer.h">
|
||||
RelativePath=".\includes\util\Integer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\JavaTypes.h">
|
||||
RelativePath=".\includes\util\JavaTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\Long.h">
|
||||
RelativePath=".\includes\util\Long.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\String.h">
|
||||
RelativePath=".\includes\util\String.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\System.h">
|
||||
RelativePath=".\includes\util\System.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\util\Types.h">
|
||||
RelativePath=".\includes\util\Types.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="alfresco"
|
||||
Filter="">
|
||||
>
|
||||
<File
|
||||
RelativePath=".\includes\alfresco\Alfresco.hpp">
|
||||
RelativePath=".\includes\alfresco\Alfresco.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\includes\alfresco\Desktop.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\alfresco.ico">
|
||||
RelativePath=".\alfresco.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\CAlfrescoApp.ico">
|
||||
RelativePath=".\res\CAlfrescoApp.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CAlfrescoApp.rc">
|
||||
RelativePath=".\CAlfrescoApp.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\CAlfrescoApp.rc2">
|
||||
RelativePath=".\res\CAlfrescoApp.rc2"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\CAlfrescoApp.htm"
|
||||
DeploymentContent="TRUE">
|
||||
DeploymentContent="true"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\CAlfrescoApp.manifest">
|
||||
RelativePath=".\res\CAlfrescoApp.manifest"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="CAlfrescoApp.rc"/>
|
||||
Value="CAlfrescoApp.rc"
|
||||
/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CAlfrescoApp.h"
|
||||
#include "FileStatusDialog.h"
|
||||
|
||||
#include "util\Long.h"
|
||||
|
||||
// CFileStatusDialog dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFileStatusDialog, CDialog)
|
||||
CFileStatusDialog::CFileStatusDialog(AlfrescoFileInfoList& fileList, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CFileStatusDialog::IDD, pParent),
|
||||
m_fileList( fileList)
|
||||
{
|
||||
}
|
||||
|
||||
CFileStatusDialog::~CFileStatusDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void CFileStatusDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_FILELIST, m_listCtrl);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFileStatusDialog, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/**
|
||||
* Initialize the dialog
|
||||
*/
|
||||
BOOL CFileStatusDialog::OnInitDialog() {
|
||||
|
||||
// Call the base class
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// Add headers to the list control
|
||||
|
||||
m_listCtrl.InsertColumn( 0, L"Name", LVCFMT_LEFT, 200);
|
||||
m_listCtrl.InsertColumn( 1, L"Mime-type", LVCFMT_LEFT, 140);
|
||||
m_listCtrl.InsertColumn( 2, L"Size", LVCFMT_RIGHT, 80);
|
||||
m_listCtrl.InsertColumn( 3, L"Status", LVCFMT_LEFT, 100);
|
||||
m_listCtrl.InsertColumn( 4, L"Owner", LVCFMT_LEFT, 100);
|
||||
|
||||
// Add the list view data
|
||||
|
||||
for ( unsigned int i = 0; i < m_fileList.size(); i++) {
|
||||
|
||||
// Get the current file information
|
||||
|
||||
const AlfrescoFileInfo* pInfo = m_fileList.getInfoAt( i);
|
||||
|
||||
// Add the item to the list view
|
||||
|
||||
if ( pInfo != NULL) {
|
||||
|
||||
// Insert a new item in the view
|
||||
|
||||
int nIndex = m_listCtrl.InsertItem( 0, pInfo->getName());
|
||||
|
||||
if ( pInfo->isType() == TypeFile) {
|
||||
|
||||
// Display the mime-type and content length
|
||||
|
||||
m_listCtrl.SetItemText( nIndex, 1, pInfo->getContentType());
|
||||
m_listCtrl.SetItemText( nIndex, 2, Long::toString( pInfo->getContentLength()));
|
||||
|
||||
String status;
|
||||
String owner;
|
||||
|
||||
if ( pInfo->isWorkingCopy()) {
|
||||
status = L"Work";
|
||||
}
|
||||
else if ( pInfo->getLockType() != LockNone) {
|
||||
status = L"Locked";
|
||||
owner = pInfo->getLockOwner();
|
||||
}
|
||||
|
||||
m_listCtrl.SetItemText( nIndex, 3, status);
|
||||
m_listCtrl.SetItemText( nIndex, 4, owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the file info list
|
||||
|
||||
m_fileList.clear();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// CFileStatusDialog message handlers
|
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
|
||||
#include "alfresco\Alfresco.hpp"
|
||||
|
||||
// CFileStatusDialog dialog
|
||||
|
||||
class CFileStatusDialog : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CFileStatusDialog)
|
||||
|
||||
public:
|
||||
CFileStatusDialog( AlfrescoFileInfoList& fileList, CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~CFileStatusDialog();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_FILESTATUS };
|
||||
|
||||
// Initialize the dialog
|
||||
|
||||
BOOL OnInitDialog();
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
CListCtrl m_listCtrl;
|
||||
|
||||
protected:
|
||||
// File information list
|
||||
|
||||
AlfrescoFileInfoList& m_fileList;
|
||||
};
|
@@ -1,40 +0,0 @@
|
||||
// FileStatusView.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CAlfrescoApp.h"
|
||||
#include "FileStatusView.h"
|
||||
|
||||
|
||||
// CFileStatusView
|
||||
|
||||
IMPLEMENT_DYNCREATE(CFileStatusView, CListView)
|
||||
|
||||
CFileStatusView::CFileStatusView()
|
||||
{
|
||||
}
|
||||
|
||||
CFileStatusView::~CFileStatusView()
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFileStatusView, CListView)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CFileStatusView diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CFileStatusView::AssertValid() const
|
||||
{
|
||||
CListView::AssertValid();
|
||||
}
|
||||
|
||||
void CFileStatusView::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CListView::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
|
||||
// CFileStatusView message handlers
|
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CFileStatusView view
|
||||
|
||||
class CFileStatusView : public CListView
|
||||
{
|
||||
DECLARE_DYNCREATE(CFileStatusView)
|
||||
|
||||
protected:
|
||||
CFileStatusView(); // protected constructor used by dynamic creation
|
||||
virtual ~CFileStatusView();
|
||||
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
@@ -25,17 +25,22 @@
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "util\Exception.h"
|
||||
#include "util\String.h"
|
||||
#include "util\DataBuffer.h"
|
||||
|
||||
#include "alfresco\Desktop.hpp"
|
||||
|
||||
// Classes defined in this header file
|
||||
|
||||
namespace Alfresco {
|
||||
class AlfrescoInterface;
|
||||
class AlfrescoFileInfo;
|
||||
class AlfrescoFileInfoList;
|
||||
class AlfrescoActionInfo;
|
||||
typedef std::auto_ptr<AlfrescoFileInfo> PTR_AlfrescoFileInfo;
|
||||
typedef std::auto_ptr<AlfrescoActionInfo> PTR_AlfrescoActionInfo;
|
||||
}
|
||||
|
||||
// Constants
|
||||
@@ -46,8 +51,10 @@ namespace Alfresco {
|
||||
|
||||
#define FSCTL_ALFRESCO_PROBE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define FSCTL_ALFRESCO_FILESTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define FSCTL_ALFRESCO_CHECKOUT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x802, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define FSCTL_ALFRESCO_CHECKIN CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x803, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
// Version 1 FSCTL_ALFRESCO_CHECKOUT - 0x802
|
||||
// Version 1 FSCTL_ALFRESCO_CHECKIN - 0x803
|
||||
#define FSCTL_ALFRESCO_GETACTIONINFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x804, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define FSCTL_ALFRESCO_RUNACTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x805, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
|
||||
// Request signature bytes
|
||||
|
||||
@@ -68,6 +75,9 @@ namespace Alfresco {
|
||||
#define StsAccessDenied 3
|
||||
#define StsBadParameter 4
|
||||
#define StsNotWorkingCopy 5
|
||||
#define StsNoSuchAction 6
|
||||
#define StsLaunchURL 7
|
||||
#define StsCommandLine 8
|
||||
|
||||
// Boolean field values
|
||||
|
||||
@@ -86,6 +96,26 @@ namespace Alfresco {
|
||||
#define LockNone 0
|
||||
#define LockRead 1
|
||||
#define LockWrite 2
|
||||
|
||||
// Desktop action attributes
|
||||
|
||||
#define AttrTargetFiles 0x0001
|
||||
#define AttrTargetFolders 0x0002
|
||||
#define AttrClientFiles 0x0004
|
||||
#define AttrClientFolders 0x0008
|
||||
#define AttrAlfrescoFiles 0x0010
|
||||
#define AttrAlfrescoFolders 0x0020
|
||||
#define AttrMultiplePaths 0x0040
|
||||
|
||||
#define AttrAnyFiles (AttrTargetFiles + AttrClientFiles + AttrAlfrescoFiles)
|
||||
#define AttrAnyFolders (AttrTargetFolders + AttrClientFolders + AttrAlfrescoFolders)
|
||||
#define AttrAnyFilesFolders (AttrAnyFiles + AttrAnyFolders)
|
||||
|
||||
// Desktop action pre-processing actions
|
||||
|
||||
#define PreCopyToTarget 0x0001
|
||||
#define PreConfirmAction 0x0002
|
||||
#define PreLocalToWorkingCopy 0x0004
|
||||
}
|
||||
|
||||
// Define Alfresco interface exceptions
|
||||
@@ -122,17 +152,21 @@ public:
|
||||
|
||||
bool isAlfrescoFolder( void);
|
||||
|
||||
// Return the protocol version of the server
|
||||
|
||||
inline const unsigned int isProtocolVersion( void) const { return m_protocolVersion; }
|
||||
|
||||
// Return the Alfresco file information for a file/folder within the current folder
|
||||
|
||||
PTR_AlfrescoFileInfo getFileInformation(const wchar_t* fileName);
|
||||
|
||||
// Check in a working copy file
|
||||
// Get action information, map the executable name to a server action
|
||||
|
||||
void checkIn( const wchar_t* fileName, bool keepCheckedOut = false);
|
||||
AlfrescoActionInfo getActionInformation(const wchar_t* exeName);
|
||||
|
||||
// Check out a file
|
||||
// Run a desktop action and return the server response
|
||||
|
||||
void checkOut( const wchar_t* fileName, String& workingCopy);
|
||||
DesktopResponse runAction(AlfrescoActionInfo& action, DesktopParams& params);
|
||||
|
||||
private:
|
||||
// Send an I/O control request, receive and validate the response
|
||||
@@ -160,6 +194,9 @@ private:
|
||||
|
||||
HANDLE m_handle;
|
||||
|
||||
// Protocol version
|
||||
|
||||
unsigned int m_protocolVersion;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -292,4 +329,82 @@ private:
|
||||
std::vector<AlfrescoFileInfo*> m_list;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alfresco Action Info Class
|
||||
*/
|
||||
class Alfresco::AlfrescoActionInfo {
|
||||
public:
|
||||
// Default constructor
|
||||
|
||||
AlfrescoActionInfo(void);
|
||||
|
||||
// Class constructor
|
||||
|
||||
AlfrescoActionInfo( const String& name, const unsigned int attr, const unsigned int preActions);
|
||||
|
||||
// Return the action name, pseudo file name
|
||||
|
||||
inline const String& getName(void) const { return m_name; }
|
||||
inline const String& getPseudoName(void) const { return m_pseudoName; }
|
||||
|
||||
// Return the action attributes, action pre-processing flags
|
||||
|
||||
inline unsigned int getAttributes(void) const { return m_attributes; }
|
||||
inline unsigned int getPreProcessActions(void) const { return m_clientPreActions; }
|
||||
|
||||
// Check if the action has the specifed attribute/pre-processing action
|
||||
|
||||
inline bool hasAttribute(const unsigned int attr) const { return (m_attributes & attr) != 0 ? true : false; }
|
||||
inline bool hasPreProcessAction(const unsigned int pre) const { return (m_clientPreActions & pre) != 0 ? true : false; }
|
||||
|
||||
// Check if the confirmation message is valid, return the confirmation message
|
||||
|
||||
inline bool hasConfirmationMessage(void) const { return m_confirmMsg.length() > 0 ? true : false; }
|
||||
inline const String& getConfirmationMessage(void) const { return m_confirmMsg; }
|
||||
|
||||
// Check if the action supports file or folder paths
|
||||
|
||||
inline bool supportsFiles(void) const { return hasAttribute(AttrTargetFiles+AttrClientFiles+AttrAlfrescoFiles); }
|
||||
inline bool supportsFolders(void) const { return hasAttribute(AttrTargetFolders+AttrClientFolders+AttrAlfrescoFolders); }
|
||||
|
||||
// Set the action name, pseudo name, set the confirmation message
|
||||
|
||||
inline void setName(const String& name) { m_name = name; }
|
||||
inline void setPseudoName(const String& pseudo) { m_pseudoName = pseudo; }
|
||||
inline void setConfirmationMessage(const String& msg) { m_confirmMsg = msg; }
|
||||
|
||||
// Set the action attributes and pre-processing actions
|
||||
|
||||
inline void setAttributes(const unsigned int attr) { m_attributes = attr; }
|
||||
inline void setPreProcessActions(const unsigned int pre) { m_clientPreActions = pre; }
|
||||
|
||||
// Return the action information as a string
|
||||
|
||||
const String toString(void) const;
|
||||
|
||||
// Assignment operator
|
||||
|
||||
AlfrescoActionInfo& operator=( const AlfrescoActionInfo& actionInfo);
|
||||
|
||||
private:
|
||||
// Instance variables
|
||||
//
|
||||
// Action name
|
||||
|
||||
String m_name;
|
||||
|
||||
// Pseudo file name
|
||||
|
||||
String m_pseudoName;
|
||||
|
||||
// Action attributes and pre-processing flags
|
||||
|
||||
unsigned int m_attributes;
|
||||
unsigned int m_clientPreActions;
|
||||
|
||||
// Action confirmation message
|
||||
|
||||
String m_confirmMsg;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -40,6 +40,10 @@ AlfrescoInterface::AlfrescoInterface(String& path) {
|
||||
|
||||
m_handle = INVALID_HANDLE_VALUE;
|
||||
|
||||
// Default the protocol version
|
||||
|
||||
m_protocolVersion = 1;
|
||||
|
||||
// Check if the path is to a mapped drive
|
||||
|
||||
String alfPath = path;
|
||||
@@ -136,8 +140,17 @@ bool AlfrescoInterface::isAlfrescoFolder( void) {
|
||||
bool alfFolder = false;
|
||||
|
||||
try {
|
||||
|
||||
// Check if the remote server is an Alfresco CIFS server
|
||||
|
||||
sendIOControl( FSCTL_ALFRESCO_PROBE, reqbuf, respbuf);
|
||||
alfFolder = true;
|
||||
|
||||
// Get the protocol version, if available
|
||||
|
||||
respbuf.getInt(); // status
|
||||
if ( respbuf.getAvailableLength() >= 4)
|
||||
m_protocolVersion = respbuf.getInt();
|
||||
}
|
||||
catch ( Exception ex) {
|
||||
}
|
||||
@@ -229,102 +242,102 @@ PTR_AlfrescoFileInfo AlfrescoInterface::getFileInformation( const wchar_t* fileN
|
||||
}
|
||||
|
||||
/**
|
||||
* Check in a working copy file
|
||||
* Return Alfresco action information for the specified executable
|
||||
*
|
||||
* @param fileName const wchar_t*
|
||||
* @param keepCheckedOut bool
|
||||
* @return AlfrescoActionInfo
|
||||
*/
|
||||
void AlfrescoInterface::checkIn( const wchar_t* fileName, bool keepCheckedOut) {
|
||||
AlfrescoActionInfo AlfrescoInterface::getActionInformation( const wchar_t* exeName) {
|
||||
|
||||
// Check if the folder handle is valid
|
||||
|
||||
if ( m_handle == INVALID_HANDLE_VALUE)
|
||||
throw BadInterfaceException();
|
||||
|
||||
// Build the file information I/O control request
|
||||
// Build the action information I/O control request
|
||||
|
||||
DataBuffer reqbuf( 256);
|
||||
DataBuffer respbuf( 128);
|
||||
DataBuffer respbuf( 512);
|
||||
|
||||
reqbuf.putFixedString( IOSignature, IOSignatureLen);
|
||||
reqbuf.putString( fileName);
|
||||
reqbuf.putInt( keepCheckedOut ? True : False);
|
||||
reqbuf.putString( exeName);
|
||||
|
||||
sendIOControl( FSCTL_ALFRESCO_CHECKIN, reqbuf, respbuf);
|
||||
sendIOControl( FSCTL_ALFRESCO_GETACTIONINFO, reqbuf, respbuf);
|
||||
|
||||
// Get the status code
|
||||
// Unpack the request status
|
||||
|
||||
unsigned int stsCode = respbuf.getInt();
|
||||
if ( stsCode == StsSuccess)
|
||||
return;
|
||||
else {
|
||||
AlfrescoActionInfo actionInfo;
|
||||
|
||||
// Get the error message, if available
|
||||
unsigned int reqSts = respbuf.getInt();
|
||||
if ( reqSts == StsSuccess) {
|
||||
|
||||
String errMsg;
|
||||
// Unpack the action name, attributes and pre-action flags
|
||||
|
||||
if ( respbuf.getAvailableLength() > 0)
|
||||
errMsg = respbuf.getString();
|
||||
else {
|
||||
errMsg = "Error code ";
|
||||
errMsg.append( Integer::toString( stsCode));
|
||||
String name = respbuf.getString();
|
||||
unsigned int attr = respbuf.getInt();
|
||||
unsigned int preActions = respbuf.getInt();
|
||||
String confirmMsg = respbuf.getString();
|
||||
|
||||
// Create the action information
|
||||
|
||||
actionInfo.setName(name);
|
||||
actionInfo.setAttributes(attr);
|
||||
actionInfo.setPreProcessActions(preActions);
|
||||
actionInfo.setPseudoName( exeName);
|
||||
actionInfo.setConfirmationMessage( confirmMsg);
|
||||
}
|
||||
|
||||
// Throw an exception
|
||||
// Return the action information
|
||||
|
||||
throw Exception( errMsg);
|
||||
}
|
||||
return actionInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out a file and return the working copy file name
|
||||
* Run a desktop action
|
||||
*
|
||||
* @param fileName const wchar_t*
|
||||
* @param workingCopy String&
|
||||
* @param action AlfrescoActionInfo&
|
||||
* @param params DesktopParams&
|
||||
* @return DesktopResponse
|
||||
*/
|
||||
void AlfrescoInterface::checkOut( const wchar_t* fileName, String& workingCopy) {
|
||||
DesktopResponse AlfrescoInterface::runAction(AlfrescoActionInfo& action, DesktopParams& params) {
|
||||
|
||||
// Check if the folder handle is valid
|
||||
|
||||
if ( m_handle == INVALID_HANDLE_VALUE)
|
||||
throw BadInterfaceException();
|
||||
|
||||
// Build the file information I/O control request
|
||||
// Build the run action I/O control request
|
||||
|
||||
DataBuffer reqbuf( 256);
|
||||
DataBuffer reqbuf( 1024);
|
||||
DataBuffer respbuf( 256);
|
||||
|
||||
reqbuf.putFixedString( IOSignature, IOSignatureLen);
|
||||
reqbuf.putString( fileName);
|
||||
reqbuf.putString( action.getName());
|
||||
reqbuf.putInt((unsigned int)params.numberOfTargets());
|
||||
|
||||
sendIOControl( FSCTL_ALFRESCO_CHECKOUT, reqbuf, respbuf);
|
||||
for ( unsigned int i = 0; i < params.numberOfTargets(); i++) {
|
||||
|
||||
// Get the status code
|
||||
// Pack the current target details
|
||||
|
||||
unsigned int stsCode = respbuf.getInt();
|
||||
if ( stsCode == StsSuccess) {
|
||||
const DesktopTarget* pTarget = params.getTarget(i);
|
||||
|
||||
// Get the working copy file name
|
||||
|
||||
workingCopy = respbuf.getString();
|
||||
}
|
||||
else {
|
||||
|
||||
// Get the error message, if available
|
||||
|
||||
String errMsg;
|
||||
|
||||
if ( respbuf.getAvailableLength() > 0)
|
||||
errMsg = respbuf.getString();
|
||||
else {
|
||||
errMsg = "Error code ";
|
||||
errMsg.append( Integer::toString( stsCode));
|
||||
reqbuf.putInt(pTarget->isType());
|
||||
reqbuf.putString(pTarget->getTarget());
|
||||
}
|
||||
|
||||
// Throw an exception
|
||||
// Send the run action request
|
||||
|
||||
throw Exception( errMsg);
|
||||
}
|
||||
sendIOControl( FSCTL_ALFRESCO_RUNACTION, reqbuf, respbuf);
|
||||
|
||||
// Unpack the run action response
|
||||
|
||||
unsigned int actionSts = respbuf.getInt();
|
||||
String actionMsg = respbuf.getString();
|
||||
|
||||
// Return the desktop response
|
||||
|
||||
DesktopResponse response(actionSts, actionMsg);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,3 +452,67 @@ bool AlfrescoFileInfo::operator<( const AlfrescoFileInfo& finfo) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
AlfrescoActionInfo::AlfrescoActionInfo(void) {
|
||||
m_attributes = 0;
|
||||
m_clientPreActions = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param name const String&
|
||||
* @param attr const unsigned int
|
||||
* @param preActions const unsigned int
|
||||
*/
|
||||
AlfrescoActionInfo::AlfrescoActionInfo( const String& name, const unsigned int attr, const unsigned int preActions) {
|
||||
m_name = name;
|
||||
m_attributes = attr;
|
||||
m_clientPreActions = preActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the action information as a string
|
||||
*
|
||||
* @return const String
|
||||
*/
|
||||
const String AlfrescoActionInfo::toString(void) const {
|
||||
String str = L"[";
|
||||
|
||||
str.append(getName());
|
||||
str.append(L":");
|
||||
str.append(getPseudoName());
|
||||
str.append(L":Attr=0x");
|
||||
str.append(Integer::toHexString(getAttributes()));
|
||||
str.append(L":preActions=0x");
|
||||
str.append(Integer::toHexString(getPreProcessActions()));
|
||||
|
||||
if ( hasConfirmationMessage()) {
|
||||
str.append(L":Conf=");
|
||||
str.append(getConfirmationMessage());
|
||||
}
|
||||
str.append(L"]");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
*
|
||||
* @param actionInfo const AlfrescoActionInfo&
|
||||
* @return AlfrescoActionInfo&
|
||||
*/
|
||||
AlfrescoActionInfo& AlfrescoActionInfo::operator=( const AlfrescoActionInfo& actionInfo) {
|
||||
setName(actionInfo.getName());
|
||||
setPseudoName(actionInfo.getPseudoName());
|
||||
|
||||
setAttributes(actionInfo.getAttributes());
|
||||
setPreProcessActions(actionInfo.getPreProcessActions());
|
||||
|
||||
setConfirmationMessage(actionInfo.getConfirmationMessage());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ using namespace Alfresco;
|
||||
*/
|
||||
String Integer::toHexString( const unsigned int ival) {
|
||||
char buf[32];
|
||||
itoa(ival, buf, 16);
|
||||
_itoa(ival, buf, 16);
|
||||
return String(buf);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ String Integer::toHexString( BUFPTR ptr) {
|
||||
*/
|
||||
String Integer::toString( unsigned int ival, unsigned int radix) {
|
||||
char buf[32];
|
||||
itoa(ival, buf, radix);
|
||||
_itoa(ival, buf, radix);
|
||||
return String(buf);
|
||||
}
|
||||
|
||||
|
@@ -695,7 +695,7 @@ void String::append (const String& str) {
|
||||
*/
|
||||
void String::append (const unsigned int ival) {
|
||||
wchar_t buf[32];
|
||||
swprintf( buf, L"%u", ival);
|
||||
swprintf( buf, 32, L"%u", ival);
|
||||
|
||||
m_string += buf;
|
||||
}
|
||||
@@ -707,7 +707,7 @@ void String::append (const unsigned int ival) {
|
||||
*/
|
||||
void String::append (const unsigned long lval) {
|
||||
wchar_t buf[32];
|
||||
swprintf( buf, L"%lu", lval);
|
||||
swprintf( buf, 32, L"%lu", lval);
|
||||
|
||||
m_string += buf;
|
||||
}
|
||||
@@ -719,7 +719,7 @@ void String::append (const unsigned long lval) {
|
||||
*/
|
||||
void String::append (const LONG64 l64val) {
|
||||
wchar_t buf[32];
|
||||
swprintf( buf, L"%I64u", l64val);
|
||||
swprintf( buf, 32, L"%I64u", l64val);
|
||||
|
||||
m_string += buf;
|
||||
}
|
||||
|
Reference in New Issue
Block a user