More Composer publishing improvements

This commit is contained in:
cmanske%netscape.com 1998-10-03 02:25:13 +00:00
Родитель 11eba68756
Коммит b3e4eb4dae
3 изменённых файлов: 101 добавлений и 53 удалений

Просмотреть файл

@ -1353,6 +1353,15 @@ XP_Bool EDT_GetEditHistory(MWContext * pMWContext, unsigned n, char** pUrl, char
*/
void EDT_SyncEditHistory(MWContext * pMWContext);
/* Called from NET_AskForAuthString in mkaccess.c to tell us the correct
username after the dialog to enter it was used
*/
void EDT_SavePublishUsername(MWContext *pContext, char *pAddress, char *pUsername);
/* Get location, username, and password from the user prefs or the Netcenter publishing data */
XP_Bool EDT_GetUserDefaultPublishData(MWContext *pMWContext, char **ppLocation, char **ppUserName, char **ppPassword);
XP_Bool EDT_GetNetcenterPublishData(MWContext *pMWContext, char **ppLocation, char **ppUserName, char **ppPassword);
/* Construct a page title from supplied filename,
* Extracts the filename part WITHOUT extension
* Stuff starting with "#" or "?" is ommited
@ -1436,12 +1445,6 @@ PRBool EDT_EncryptState(MWContext *pContext);
/* Used for QA only - Ctrl+Alt+Shift+N accelerator for automated testing */
void EDT_SelectNextNonTextObject(MWContext *pContext);
/* Called from NET_AskForAuthString in mkaccess.c to tell us the correct
username after the dialog to enter it was used
*/
void EDT_SavePublishUsername(MWContext *pContext, char *pAddress, char *pUsername);
XP_END_PROTOS
#endif /* EDITOR */

Просмотреть файл

@ -9921,7 +9921,7 @@ void CEditBuffer::ForceDocCharSetID(int16 csid){
ED_FileError CEditBuffer::PublishFile( ED_SaveFinishedOption finishedOpt,
char *pSourceURL,
char **ppIncludedFiles,
char *pDestURL, /* Directories must have trailing slash, ie after HEAD call */
char *pDestURL, // This includes the filename
char *pUsername,
char *pPassword,
XP_Bool bKeepImagesWithDoc,
@ -9939,6 +9939,19 @@ ED_FileError CEditBuffer::PublishFile( ED_SaveFinishedOption finishedOpt,
return ED_ERROR_FILE_OPEN;
}
#if defined(SingleSignon)
// Prompt to remember the username and password for this location
// It doesn't matter if its bad, because it will be saved again
// after getting correct values from the user via the username/password dialog
// Strip filename off of the destination
char *pLocation = EDT_ReplaceFilename(pDestURL, NULL, TRUE);
if( pLocation )
{
SI_RememberSignonDataFromBrowser(m_pContext, pLocation, pUsername, pPassword);
XP_FREE(pLocation);
}
#endif
// Create Abstract file system to write to remote server.
ITapeFileSystem *tapeFS =
new CTapeFSPublish(m_pContext,pDestURL,pUsername,pPassword,pDocTempDir);

Просмотреть файл

@ -5486,7 +5486,35 @@ char * EDT_GetFilename(char * pURL, XP_Bool bMustHaveExtension)
return pResult;
}
char * EDT_GetDefaultPublishURL(MWContext * pMWContext, char **ppFilename, char **ppUserName, char **ppPassword)
#if defined(SingleSignon)
static XP_Bool GetSingleSignonData(MWContext * pMWContext, char *pLocation, char **ppUsername, char **ppPassword)
{
if( !pLocation )
return FALSE;
char *pUsernameSingleSignon = NULL;
char *pPasswordSingleSignon = NULL;
SI_RestoreOldSignonDataFromBrowser(pMWContext, pLocation, FALSE,
&pUsernameSingleSignon, &pPasswordSingleSignon);
if (pUsernameSingleSignon)
{
if( ppUsername )
*ppUsername = pUsernameSingleSignon;
else
XP_FREE(pUsernameSingleSignon);
if( ppPassword )
*ppPassword = pPasswordSingleSignon;
else if( pPasswordSingleSignon )
XP_FREE(pPasswordSingleSignon);
return TRUE;
}
return FALSE;
}
#endif
char * EDT_GetDefaultPublishURL(MWContext * pMWContext, char **ppFilename, char **ppUsername, char **ppPassword)
{
XP_ASSERT(pMWContext);
char * pURL = LO_GetBaseURL(pMWContext);
@ -5520,21 +5548,11 @@ char * EDT_GetDefaultPublishURL(MWContext * pMWContext, char **ppFilename, char
#if defined(SingleSignon)
// Check if we saved a username/password for this URL
char * pUserNameSingleSignon = NULL;
char * pPasswordSingleSignon = NULL;
SI_RestoreOldSignonDataFromBrowser(
pMWContext, pURL, FALSE, &pUserNameSingleSignon, &pPasswordSingleSignon);
if (pUserNameSingleSignon)
{
if( ppUserName )
*ppUserName = pUserNameSingleSignon;
if( ppPassword )
*ppPassword = pPasswordSingleSignon;
// (We will find it only if we are editing a remote URL)
if( GetSingleSignonData(pMWContext, pURL, ppUsername, ppPassword) )
// If we found a name, we assume the location part of
// URL is correct, so just return that
return EDT_ReplaceFilename(pURL, NULL, TRUE);
}
#endif
if( !bLastPublishFailed && !EDT_IS_NEW_DOCUMENT(pMWContext) ){
@ -5550,7 +5568,6 @@ char * EDT_GetDefaultPublishURL(MWContext * pMWContext, char **ppFilename, char
}
char *pPrefURL = NULL;
XP_Bool bUseDefault = FALSE;
if( bLastPublishFailed ){
// use the last location saved - this will be the location we failed at before
@ -5564,30 +5581,19 @@ char * EDT_GetDefaultPublishURL(MWContext * pMWContext, char **ppFilename, char
XP_FREEIF(pPrefURL);
// No last-used location -- use the default location
PREF_CopyCharPref("editor.publish_location", &pPrefURL);
bUseDefault = TRUE;
}
char * pLocation = 0;
char * pUserName = ppUserName ? *ppUserName : 0;
NET_ParseUploadURL( pPrefURL, &pLocation, &pUserName, NULL );
char * pUsername = ppUsername ? *ppUsername : 0;
NET_ParseUploadURL( pPrefURL, &pLocation, &pUsername, NULL );
if (ppUserName)
*ppUserName = pUserName;
if( ppPassword ){
// Get the corrsponding password saved
char * pPassword = NULL;
if( bLastPublishFailed ){
} else if( bUseDefault ){
PREF_CopyCharPref("editor.publish_password", &pPassword);
} else {
PREF_CopyCharPref("editor.publish_password_0", &pPassword);
}
if( pPassword && *pPassword ){
*ppPassword = HG99879(pPassword);
XP_FREE(pPassword);
}
#if defined(SingleSignon)
// Check if we saved a username/password for the pref location
if(! GetSingleSignonData(pMWContext, pLocation, ppUsername, ppPassword) )
#endif
{
if (ppUsername)
*ppUsername = pUsername;
}
XP_FREEIF(pPrefURL);
@ -5646,18 +5652,7 @@ EDT_GetPublishingHistory(unsigned n,
#ifdef XP_WIN
#if defined(SingleSignon)
// Check if we saved a username/password for this URL via SingleSignon
char * pUserNameSingleSignon = NULL;
char * pPasswordSingleSignon = NULL;
SI_RestoreOldSignonDataFromBrowser(
pMWContext, *ppLocation, FALSE, &pUserNameSingleSignon, &pPasswordSingleSignon);
if (pUserNameSingleSignon)
{
if( ppUsername )
*ppUsername = pUserNameSingleSignon;
if( ppPassword )
*ppPassword = pPasswordSingleSignon;
}
GetSingleSignonData(pMWContext, *ppLocation, ppUsername, ppPassword);
#endif
#endif
}
@ -5716,6 +5711,43 @@ void edt_SyncPublishingHistory(MWContext *pMWContext)
XP_FREEIF(pLastLoc);
}
XP_Bool EDT_GetUserDefaultPublishData(MWContext *pMWContext, char **ppLocation, char **ppUsername, char **ppPassword)
{
char * pDefaultLocation = NULL;
PREF_CopyCharPref("editor.publish_location", &pDefaultLocation);
if( !pDefaultLocation){
return FALSE;
}
char *pLocation = NULL;
char *pUsername = NULL;
// Parse the preference string to extract Username
NET_ParseUploadURL( pDefaultLocation, &pLocation, &pUsername, NULL );
#if defined(SingleSignon)
// Check if we saved a username/password for the pref location
if( !GetSingleSignonData(pMWContext, *ppLocation, ppUsername, ppPassword) )
#endif
{
if (ppUsername)
*ppUsername = pUsername;
else
XP_FREEIF(pUsername);
}
if( ppLocation )
*ppLocation = pLocation;
else
XP_FREEIF(pLocation);
return TRUE;
}
XP_Bool EDT_GetNetcenterPublishData(MWContext *pMWContext, char **ppLocation, char **ppUsername, char **ppPassword)
{
//TODO: FINISH THIS
return FALSE;
}
// Cache the Edit History data
static char** ppEditHistoryURLs = NULL;
static char** ppEditHistoryTitles = NULL;