Fixed Composer bugs in Publishing. Added history lists to Open Page dialog

This commit is contained in:
cmanske%netscape.com 1998-10-06 20:29:52 +00:00
parent 2c858de20f
commit c6a337e6f1
13 changed files with 554 additions and 147 deletions

View File

@ -2331,8 +2331,11 @@ win_click_callback(MWContext * pContext, LO_Element * pEle, int32 event,
#ifdef EDITOR
if( EDT_IS_EDITOR(pWin->GetContext()) ){
// Ctrl Click = edit the URL
FE_LoadUrl((char*)LPCSTR(csAnchor), LOAD_URL_COMPOSER);
// Ctrl Click: Scroll to a target or load the URL into another editor
char *pAnchor = (char*)LPCSTR(csAnchor);
if( !EDT_ScrollToTarget(pWin->GetContext(), pAnchor) )
FE_LoadUrl(pAnchor, LOAD_URL_COMPOSER);
goto done;
}
#endif // EDITOR
@ -2648,6 +2651,7 @@ CWinCX::OnLButtonUpForLayerCX(UINT uFlags, CPoint& cpPoint, XY& Point,
#ifdef EDITOR
if((uFlags & MK_CONTROL) == 0 && EDT_IS_EDITOR(GetContext())){
m_pLastImageObject = NULL;
// Ctrl is NOT pressed in an editor - we are done
return;
}
#endif
@ -6361,7 +6365,7 @@ mouse_over_callback(MWContext * context, LO_Element * lo_element, int32 event,
// pressing Ctrl + mouse click will edit the link
CString csStatus = (char*)text_struct->anchor_href->anchor;
WFE_CondenseURL(csStatus, 40, FALSE);
csStatus += szLoadString(IDS_EDIT_LINK_HINT);
csStatus += XP_GetString(XP_EDT_LINK_HINT);
wfe_Progress(context, csStatus);
if( bCtrlPressed )
{
@ -6523,14 +6527,15 @@ mouse_over_callback(MWContext * context, LO_Element * lo_element, int32 event,
PA_UNLOCK(image_struct->alt);
}
}
if( !bCursorSet ){
// Set special status and cursor for images that are NOT icons
if( !bCursorSet )
{
// Image can be dragged from a Browser or from an Editor after it is selected,
// so if no cursor set above,
// use Open Hand with arrow to indicate "draggability" of the image
// Do this for a Browser window ONLY if we have a Composer Window available
// to drag into
// If no cursor set above, use Open Hand with arrow to indicate "draggability" of the image
// Do this for a Browser window ONLY if we have a Composer Window available to drag into
BOOL bHaveEditorWindow = bIsEditor;
if( !bHaveEditorWindow )
if( !image_struct->is_icon && !bHaveEditorWindow )
{
// Check if there are any editor windows open (either Mail or Page Composer)
CGenericFrame * f;
@ -6545,18 +6550,17 @@ mouse_over_callback(MWContext * context, LO_Element * lo_element, int32 event,
}
}
}
UINT nID = 0;
if( !bIsEditor && bHaveEditorWindow ||
(bIsEditor && (image_struct->ele_attrmask & LO_ELE_SELECTED) != 0) )
(bIsEditor && (image_struct->ele_attrmask & LO_ELE_SELECTED) != 0
&& !image_struct->is_icon ) )
{
SetCursor(theApp.LoadCursor(IDC_ARROW_HAND));
bCursorSet = TRUE;
// Display some help on the status line
// NOTE: In Browser, there is no Image selection,
// so image can be dragged upon first mouse down
wfe_Progress(context, XP_GetString(XP_EDT_CLICK_AND_DRAG_IMAGE));
bTextSet = TRUE;
nID = XP_EDT_CLICK_AND_DRAG_IMAGE;
}
else if( bIsEditor )
{
@ -6564,10 +6568,26 @@ mouse_over_callback(MWContext * context, LO_Element * lo_element, int32 event,
bCursorSet = TRUE;
// Tell user how to select image
// NOTE: Image must be selected before dragging when in Composer
wfe_Progress(context, XP_GetString(XP_EDT_CLICK_TO_SELECT_IMAGE));
nID = XP_EDT_CLICK_TO_SELECT_IMAGE;
}
// Show status for image only if not an internal icon
if( nID && !image_struct->is_icon )
{
wfe_Progress(context, XP_GetString(nID));
bTextSet = TRUE;
}
}
if( bIsEditor && image_struct->is_icon )
{
// Display the target name on the status line
char *pName = EDT_GetTargetNameFromIcon(image_struct);
if( pName )
{
wfe_Progress(context, pName);
bTextSet = TRUE;
XP_FREE(pName);
}
}
}
// See if we are over an embedded item.

View File

@ -25,6 +25,7 @@
#include "nsIDefaultBrowser.h"
#include "prefapi.h"
#include "edt.h" // For EDT_GetEditHistory and MAX_EDT_HISTORY_LOCATIONS
#ifdef _DEBUG
#undef THIS_FILE
@ -33,10 +34,9 @@ static char BASED_CODE THIS_FILE[] = __FILE__;
extern "C" void sample_exit_routine(URL_Struct *URL_s,int status,MWContext *window_id);
// Last URL entered in the Open Page dialog
static CString url_string = "";
// Retain radio button setting across dialog calls
// 0 = Load URL into Browser, 1 = Editor
static int browse_or_edit = 0;
/////////////////////////////////////////////////////////////////////////////
// CDialogURL dialog
@ -49,38 +49,115 @@ CDialogURL::CDialogURL(CWnd* pParent, MWContext * context)
//}}AFX_DATA_INIT
ASSERT(context);
m_Context = context;
m_bInitNavComboBox = FALSE;
m_bInternalChange = FALSE;
#ifdef EDITOR
m_bInitComposerComboBox = FALSE;
#endif
}
CDialogURL::~CDialogURL()
{
for( int i = 0; i < MAX_HISTORY_LOCATIONS; i++ )
XP_FREEIF(m_pNavTitleList[i]);
// Note: Composer history list points to other static strings,
// don't delete here
}
#ifndef EDITOR
#define MOVE_CONTROL_AMOUNT 30
static void wfe_MoveControl(CDialog *pDialog, UINT nID)
{
CRect cRect;
CWnd *pWnd = pDialog->GetDlgItem(nID);
if( pWnd )
{
pWnd->GetWindowRect(&cRect);
pDialog->ScreenToClient(&cRect);
pWnd->SetWindowPos(0, cRect.left, cRect.top-MOVE_CONTROL_AMOUNT, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
}
#endif
BOOL CDialogURL::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *pNavBox = (CComboBox*)GetDlgItem(IDC_URL);
if( !pNavBox )
return(1);
CEdit * pBox = (CEdit *) GetDlgItem(IDC_URL);
// Used a separate define in dialog.h to avoid having to include edt.h for MAX_EDIT_HISTORY_LOCATIONS
XP_ASSERT(MAX_HISTORY_LOCATIONS <= MAX_EDIT_HISTORY_LOCATIONS);
if(pBox) {
pBox->SetWindowText((const char *) url_string);
pBox->SetFocus();
pBox->SetSel(0, -1);
#ifdef EDITOR
// Communicator version has radio buttons to select
// loading URL into a browser or editor
if ( EDT_IS_EDITOR(m_Context) ){
((CButton *)GetDlgItem(IDC_OPEN_URL_EDITOR))->SetCheck(1);
} else {
((CButton *)GetDlgItem(IDC_OPEN_URL_BROWSER))->SetCheck(1);
}
CComboBox *pComposerBox = (CComboBox *) GetDlgItem(IDC_URL_EDITOR);
if( !pComposerBox )
return(1);
if( EDT_IS_EDITOR(m_Context) )
{
// Default is to open into Composer
((CButton *)GetDlgItem(IDC_OPEN_URL_EDITOR))->SetCheck(1);
// Hide Navigator's editbox
pNavBox->ShowWindow(SW_HIDE);
// This will init the dropdown list
GetComposerComboBox();
pComposerBox->SetFocus();
pComposerBox->SetEditSel(0, -1);
}
else
{
// Default is open in Navigator
((CButton *)GetDlgItem(IDC_OPEN_URL_BROWSER))->SetCheck(1);
// Hide the editor's combobox
pComposerBox->ShowWindow(SW_HIDE);
// This will init the dropdown list
GetNavComboBox();
pNavBox->SetFocus();
pNavBox->SetEditSel(0, -1);
}
return(0);
#else
GetNavComboBox();
pNavBox->SetFocus();
pNavBox->SetSel(0, -1);
// Move all controls up and resize the dialog as well
// We could have made a different dialog, but that makes it more difficult
// for I18N, so just move the controls instead
wfe_MoveControl(this, IDC_ENTER_URL_MSG);
wfe_MoveControl(this, IDC_URL);
wfe_MoveControl(this, IDC_BROWSE_FILE);
wfe_MoveControl(this, IDOK);
wfe_MoveControl(this, IDCANCEL);
wfe_MoveControl(this, ID_HELP);
CRect cRect;
GetWindowRect(&cRect);
SetWindowPos(0, 0, 0, cRect.Width(), cRect.Height()-MOVE_CONTROL_AMOUNT, SWP_NOMOVE | SWP_NOZORDER);
#endif // EDITOR
return(0);
}
return(1);
return(0);
}
BEGIN_MESSAGE_MAP(CDialogURL, CDialog)
//{{AFX_MSG_MAP(CDialogURL)
ON_BN_CLICKED(IDC_BROWSE_FILE, OnBrowseForFile)
ON_COMMAND(ID_HELP, OnHelp)
ON_CBN_EDITCHANGE(IDC_URL, OnChangeNavLocation)
ON_CBN_SELCHANGE(IDC_URL, OnSelchangeNavList)
//}}AFX_MSG_MAP
#ifdef EDITOR
ON_BN_CLICKED(IDC_OPEN_URL_BROWSER, OnOpenInBrowser)
ON_BN_CLICKED(IDC_OPEN_URL_EDITOR, OnOpenInEditor)
ON_CBN_SELCHANGE(IDC_URL_EDITOR, OnSelchangeComposerList)
ON_CBN_EDITCHANGE(IDC_URL_EDITOR, OnChangeComposerLocation)
#endif
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
@ -98,11 +175,10 @@ void CDialogURL::OnBrowseForFile()
#endif
char * pName = wfe_GetExistingFileName( this->m_hWnd, szLoadString(IDS_OPEN), type, TRUE, NULL);
if( pName ){
GetDlgItem(IDC_URL)->SetWindowText(pName);
GetDlgItem(EDT_IS_EDITOR(m_Context) ? IDC_URL_EDITOR: IDC_URL)->SetWindowText(pName);
XP_FREE(pName);
// Set focus to Open button so Enter can be used
// immediately after choosing file
GotoDlgCtrl(GetDlgItem(IDOK));
// New behavior - immediately end dialog with filename selected
OnOK();
}
}
@ -115,11 +191,19 @@ void CDialogURL::OnHelp()
void CDialogURL::OnOK()
{
CEdit * pBox = (CEdit *) GetDlgItem(IDC_URL);
CWnd *pNavBox = GetNavComboBox();
if(pBox) {
pBox->GetWindowText(url_string);
#ifdef EDITOR
BOOL bEdit = ((CButton *)GetDlgItem(IDC_OPEN_URL_EDITOR))->GetCheck() != 0;
CWnd *pComposerBox = GetComposerComboBox();
if( bEdit ) {
pComposerBox->GetWindowText(url_string);
} else
#else
if(pNavBox) {
pNavBox->GetWindowText(url_string);
}
#endif
CDialog::OnOK();
#ifdef XP_WIN32
@ -152,21 +236,268 @@ void CDialogURL::OnOK()
}
#ifdef EDITOR
BOOL bEdit = ((CButton *)GetDlgItem(IDC_OPEN_URL_EDITOR))->GetCheck() != 0;
if (bEdit || EDT_IS_EDITOR(m_Context)) {
FE_LoadUrl(/*pAbsoluteURL*/(char *)LPCSTR(url_string), bEdit);
// This creates a new edit or browser window
FE_LoadUrl((char *)LPCSTR(url_string), bEdit);
} else
#endif
// Load the URL into the same window only if called from an existing browser
ABSTRACTCX(m_Context)->NormalGetUrl(/*pAbsoluteURL*/ url_string);
ABSTRACTCX(m_Context)->NormalGetUrl(url_string);
if( pAbsoluteURL && bFreeString )
XP_FREE(pAbsoluteURL);
}
}
CComboBox *CDialogURL::GetNavComboBox()
{
CComboBox *pComboBox = (CComboBox*)GetDlgItem(IDC_URL);
// Use flag to init once only when we need to
if( m_bInitNavComboBox )
return pComboBox;
XP_MEMSET(m_pNavTitleList, 0, MAX_HISTORY_LOCATIONS*sizeof(char*));
m_bInitNavComboBox = TRUE;
CDC *pDC = pComboBox->GetDC();
// Get the size of the strings added in the dropdown...
CSize cSize;
int iMaxWidth = 0;
int wincsid = INTL_CharSetNameToID(INTL_ResourceCharSet());
// Fill the combobox with Composer's "Recent Files" list
char * pUrl = NULL;
int j = 0; // Separate counter for title array
// We would like to get Browser history items from the new history system (RDF store?)
// Use this for the current Browser History (same as in the Go menu)
// Get the session history list
XP_List* pList = SHIST_GetList(m_Context);
if( pList )
{
// Get the pointer to the current history entry
for( int i = 0; i < MAX_HISTORY_LOCATIONS; i++, pList = pList->prev )
{
//pList = pList->prev;
if( !pList )
break;
History_entry* pEntry = (History_entry*)pList->object;
//ASSERT(pEntry);
if( !pEntry )
continue;
// Don't include current page's URL
if( pEntry == m_Context->hist.cur_doc_ptr )
continue;
pComboBox->AddString(pEntry->address);
m_pNavTitleList[j] = XP_STRDUP(pEntry->title);
CString csTemp(pUrl);
if ( pDC )
{
cSize = CIntlWin::GetTextExtent(wincsid, pDC->GetSafeHdc(), csTemp, csTemp.GetLength());
pDC->LPtoDP(&cSize);
if ( cSize.cx > iMaxWidth )
iMaxWidth = cSize.cx;
}
j++;
}
}
iMaxWidth += 4;
if( pComboBox->GetDroppedWidth() < iMaxWidth )
pComboBox->SetDroppedWidth(iMaxWidth);
// Initialize the edit field with the first history item
// or last-used global string
if( pComboBox->GetCount() > 0 )
{
pComboBox->SetCurSel(0);
SetCaption(m_pNavTitleList[0]);
}
else
{
pComboBox->SetWindowText((const char*)url_string);
SetCaption();
}
return pComboBox;
}
void CDialogURL::SetCaption(char *pPageTitle)
{
CString csCaption(szLoadString(pPageTitle ? IDS_OPEN_FILE : IDS_OPEN_PAGE));
if( pPageTitle )
{
// Append the page title so caption is "Open: My Page Title"
csCaption += pPageTitle;
}
SetWindowText((const char*)csCaption);
}
void CDialogURL::OnChangeNavLocation()
{
// Any text typed in the edit box invalidates the page title
// show in the dialog caption,
// but search the title list to find a match
if( !m_bInternalChange )
{
CString csString;
CComboBox *pComboBox = GetNavComboBox();
pComboBox->GetWindowText(csString);
csString.TrimLeft();
csString.TrimRight();
char *pCaption = NULL;
if( !csString.IsEmpty() )
{
// Find user-typed string in the combobox
// and set corresponding title
int nIndex = pComboBox->FindStringExact(0,csString);
if( nIndex >= 0 )
pCaption = m_pNavTitleList[nIndex];
}
SetCaption(pCaption);
}
}
void CDialogURL::OnSelchangeNavList()
{
if( !m_bInternalChange )
SetCaption(m_pNavTitleList[GetNavComboBox()->GetCurSel()]);
}
#ifdef EDITOR
CComboBox *CDialogURL::GetComposerComboBox()
{
CComboBox *pComboBox = (CComboBox*)GetDlgItem(IDC_URL_EDITOR);
// Use flag to init once only when we need to
if( m_bInitComposerComboBox )
return pComboBox;
m_bInitComposerComboBox = TRUE;
CDC *pDC = pComboBox->GetDC();
// Get the size of the strings added in the dropdown...
CSize cSize;
int iMaxWidth = 0;
int wincsid = INTL_CharSetNameToID(INTL_ResourceCharSet());
// Fill the combobox with Composer's "Recent Files" list
char * pUrl = NULL;
char * pTitle = NULL;
int j = 0; // Separate counter for title array
for( int i = 0; i < MAX_EDIT_HISTORY_LOCATIONS; i++ )
{
// Save the Page Title for each URL as well
// NOTE: We don't have to free these - static list is in xp edit code
m_pComposerTitleList[i] = 0;
if(EDT_GetEditHistory(m_Context, i, &pUrl, &m_pComposerTitleList[j]))
{
pComboBox->AddString(pUrl);
CString csTemp(pUrl);
if ( pDC ){
cSize = CIntlWin::GetTextExtent(wincsid, pDC->GetSafeHdc(), csTemp, csTemp.GetLength());
pDC->LPtoDP(&cSize);
if ( cSize.cx > iMaxWidth ){
iMaxWidth = cSize.cx;
}
}
j++;
}
}
// ...so we can be sure it's visible by using wider dropdown width
iMaxWidth += 4;
if( pComboBox->GetDroppedWidth() < iMaxWidth )
pComboBox->SetDroppedWidth(iMaxWidth);
// Initialize the edit field with the first history item
// or last-used global string (shared with Navigator)
if( pComboBox->GetCount() > 0 )
{
pComboBox->SetCurSel(0);
SetCaption(m_pComposerTitleList[0]);
}
else
{
pComboBox->SetWindowText((const char*)url_string);
SetCaption();
}
return pComboBox;
}
void CDialogURL::OnSelchangeComposerList()
{
if( !m_bInternalChange )
SetCaption(m_pComposerTitleList[GetComposerComboBox()->GetCurSel()]);
}
void CDialogURL::OnChangeComposerLocation()
{
// Any text typed in the edit box invalidates the page title
// show in the dialog caption, but search the title list
if( !m_bInternalChange )
{
CString csString;
CComboBox *pComboBox = GetComposerComboBox();
pComboBox->GetWindowText(csString);
csString.TrimLeft();
csString.TrimRight();
char *pCaption = NULL;
if( !csString.IsEmpty() )
{
// Find user-typed string in the combobox
// and set corresponding title
int nIndex = pComboBox->FindStringExact(0,csString);
if( nIndex >= 0 )
pCaption = m_pComposerTitleList[nIndex];
}
SetCaption(pCaption);
}
}
void CDialogURL::OnOpenInBrowser()
{
CComboBox *pComposerComboBox = GetComposerComboBox();
CWnd *pNavComboBox = GetNavComboBox();
CString csString;
pComposerComboBox->GetWindowText(csString);
csString.TrimLeft();
csString.TrimRight();
if( !csString.IsEmpty() )
{
m_bInternalChange = TRUE;
pNavComboBox->SetWindowText(csString);
m_bInternalChange = FALSE;
}
pComposerComboBox->ShowWindow(SW_HIDE);
pNavComboBox->ShowWindow(SW_SHOW);
}
void CDialogURL::OnOpenInEditor()
{
CComboBox *pComposerComboBox = GetComposerComboBox();
CWnd *pNavComboBox = GetNavComboBox();
CString csString;
pNavComboBox->GetWindowText(csString);
csString.TrimLeft();
csString.TrimRight();
if( !csString.IsEmpty() )
{
m_bInternalChange = TRUE;
pComposerComboBox->SetWindowText(csString);
m_bInternalChange = FALSE;
}
pNavComboBox->ShowWindow(SW_HIDE);
pComposerComboBox->ShowWindow(SW_SHOW);
}
#endif //EDITOR
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@ -472,7 +803,6 @@ char * CDialogPASS::DoModal(const char * Msg)
return(NULL);
}
int CDialogPASS::OnInitDialog()
{

View File

@ -30,6 +30,7 @@ protected:
public:
CDialogURL(CWnd *pParent, MWContext * context = NULL);
virtual ~CDialogURL();
void SetContext(MWContext * context) {m_Context = context;}
enum { IDD = IDD_OPENURL_BOX };
@ -43,12 +44,33 @@ protected:
virtual void OnOK();
afx_msg void OnBrowseForFile();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnChangeNavLocation();
afx_msg void OnSelchangeNavList();
// Generated message map functions
//{{AFX_MSG(CDialogURL)
// NOTE: the ClassWizard will add member functions here
afx_msg void OnHelp();
//}}AFX_MSG
BOOL m_bInternalChange;
BOOL m_bInitNavComboBox;
CComboBox *GetNavComboBox();
void SetCaption(char *pPageTitle = NULL);
#define MAX_HISTORY_LOCATIONS 10
char *m_pNavTitleList[MAX_HISTORY_LOCATIONS];
#ifdef EDITOR
afx_msg void OnOpenInBrowser();
afx_msg void OnOpenInEditor();
afx_msg void OnSelchangeComposerList();
afx_msg void OnChangeComposerLocation();
char *m_pComposerTitleList[MAX_HISTORY_LOCATIONS];
BOOL m_bInitComposerComboBox;
CComboBox *GetComposerComboBox();
#endif
BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()

View File

@ -535,8 +535,9 @@ BOOL CPublishDlg::OnInitDialog()
CString csURL = m_pCurrentFile ? m_pCurrentFile : m_pCurrentUrl;
WFE_CondenseURL(csURL, 50, FALSE);
CString csCaption;
csCaption.Format(szLoadString(IDS_PUBLISH_CAPTION), csURL);
CString csCaption = szLoadString(IDS_PUBLISH_CAPTION);
csCaption += csURL;
// Display the main filepath (or URL) in dialog Caption
SetWindowText(csCaption);
@ -768,11 +769,11 @@ void CPublishDlg::OnOK()
m_csLocation.TrimLeft();
m_csLocation.TrimRight();
int type = NET_URL_Type((char*)LPCSTR(m_csLocation));
if( type == FTP_TYPE_URL ||
type == HTTP_TYPE_URL ||
type == SECURE_HTTP_TYPE_URL ){
// int type = NET_URL_Type((char*)LPCSTR(m_csLocation));
// if( type == FTP_TYPE_URL ||
// type == HTTP_TYPE_URL ||
// type == SECURE_HTTP_TYPE_URL ){
{
m_csUserName.TrimLeft();
m_csUserName.TrimRight();
m_csPassword.TrimLeft();
@ -785,20 +786,28 @@ void CPublishDlg::OnOK()
NET_MakeUploadURL( &pLocation, (char*)LPCSTR(m_csLocation),
(char*)LPCSTR(m_csUserName),
(char*)LPCSTR(m_csPassword) );
int iFilenameOffset = XP_STRLEN(pLocation);
XP_FREEIF(m_pFullLocation);
// Add filename to end of location URL for validation
// This is final string used by Publishing
m_pFullLocation = EDT_ReplaceFilename(pLocation, (char*)LPCSTR(m_csFilename), TRUE);
m_pFullLocation = EDT_ReplaceFilename(pLocation, (char*)LPCSTR(m_csFilename), FALSE);
XP_FREEIF(pLocation);
// HARDTS:
// Tell user the URL they are publishing looks like it might be wrong.
// e.g. ends in a slash or does not have a file extension.
// Give the user the option of attempting to publish to the
// specified URL even if it looks suspicious.
if (!EDT_CheckPublishURL(m_pMWContext,m_pFullLocation)) {
// Give the user the option of replacing bad characters with '_'
// ot attempting to publish to the specified URL anyway
BOOL bResult = EDT_CheckPublishURL(m_pMWContext, &m_pFullLocation);
// Reset filename in case we replaced any bad characters
// FALSE = strip filename even if there's no extension
// since that may have been the error and we know we appended it
SetPublishingControls(m_pFullLocation, FALSE);
// If user selected "Cancel", then don't publish
if( !bResult )
return;
}
CListBox * pIncludeListBox = (CListBox*)GetDlgItem(IDC_PUBLISH_OTHER_FILES);
int iCount = pIncludeListBox->GetSelCount();
@ -815,12 +824,15 @@ void CPublishDlg::OnOK()
// Construct an array of included files
// from just the selected items in listbox
if( iCount ){
if( iCount )
{
int *pIndexes = (int*)XP_ALLOC(iCount * sizeof(int));
if( pIndexes ){
if( pIndexes )
{
pIncludeListBox->GetSelItems(iCount, pIndexes);
CString csItem;
for( int i=0; i < iCount; i++ ){
for( int i=0; i < iCount; i++ )
{
if( bUseImageList ){
// Copy the URL from the original, sorted list of image URLs
csItem = m_ppImageList[pIndexes[i]];
@ -837,12 +849,17 @@ void CPublishDlg::OnOK()
// Don't use CDialog::OnOK() -- it will overwrite our changed m_csLocation
EndDialog(IDOK);
} else {
}
#if 0
// Let XP put up error messages
else
{
// Tell user they must use "ftp://" or "http://"
MessageBox(szLoadString(IDS_BAD_PUBLISH_URL),
szLoadString(IDS_PUBLISH_FILES),
MB_ICONEXCLAMATION | MB_OK);
}
#endif
}
void CPublishDlg::OnHelp()
@ -1046,6 +1063,69 @@ void CPublishDlg::OnSelchangePublishLocation()
}
}
void CPublishDlg::SetPublishingControls(char *pFullLocation, BOOL bMustHaveExt)
{
char *pUserName = NULL;
char *pPassword = NULL;
char *pLocation = NULL;
char *pFilename = NULL;
NET_ParseUploadURL( pFullLocation, &pLocation,
&pUserName, &pPassword );
if( pUserName )
{
CString csUser = pUserName;
csUser.TrimLeft();
csUser.TrimRight();
if( !csUser.IsEmpty() )
m_csUserName = csUser;
XP_FREE(pUserName);
}
if( pPassword )
{
CString csPassword = pPassword;
csPassword.TrimLeft();
csPassword.TrimRight();
if( !csPassword.IsEmpty() )
{
m_csPassword = csPassword;
PadPassword();
}
XP_FREE(pPassword);
}
if( pLocation )
{
// Extract filename at end of Location
// If bMustHaveExt is FALSE, then we are correcting errors,
// so allow filenames without an extension.
pFilename = EDT_GetFilename(pLocation, bMustHaveExt);
char * pDot = pFilename ? strchr(pFilename, '.') : NULL;
if( !bMustHaveExt ||
(pFilename && *pFilename && pDot &&
(0 == stricmp(".htm", pDot) || 0 == stricmp(".html", pDot) || 0 == stricmp(".shtml", pDot))) )
{
m_csFilename = pFilename;
XP_FREE(pFilename);
// Save version with filename stripped off
char * pURL = EDT_ReplaceFilename(pLocation, NULL, bMustHaveExt);
m_csLocation = pURL;
XP_FREEIF(pURL);
} else {
m_csLocation = pLocation;
}
XP_FREE(pLocation);
// We don't use DDX for this
GetDlgItem(IDC_PUBLISH_LOCATION_LIST)->SetWindowText((char*)LPCSTR(m_csLocation));
}
// Update Filename, username, and password controls
UpdateData(FALSE);
}
// Parse editfield location into URL, Filename, UserName, and Password
// NOTE: Anything found in this Location will override contents of
// individual Filename, UserName, and Password edit boxes
@ -1054,59 +1134,12 @@ void CPublishDlg::OnKillfocusPublishLocationList()
// If user included a filename, user name, or password within location string,
// use that instead of current edit fields
UpdateData(TRUE);
char *pUserName = NULL;
char *pPassword = NULL;
char *pLocation = NULL;
char *pFilename = NULL;
GetDlgItem(IDC_PUBLISH_LOCATION_LIST)->GetWindowText(m_csLocation);
m_csLocation.TrimLeft();
m_csLocation.TrimRight();
NET_ParseUploadURL( (char*)LPCSTR(m_csLocation), &pLocation,
&pUserName, &pPassword );
if( pUserName ){
CString csUser = pUserName;
csUser.TrimLeft();
csUser.TrimRight();
if( !csUser.IsEmpty() ){
m_csUserName = csUser;
}
XP_FREE(pUserName);
}
if( pPassword ){
CString csPassword = pPassword;
csPassword.TrimLeft();
csPassword.TrimRight();
if( !csPassword.IsEmpty() ){
m_csPassword = csPassword;
}
XP_FREE(pPassword);
}
if( pLocation ){
// Extract filename at end of Location
// ONLY if it ends in ".htm" or ".html" or ".shtml"
pFilename = EDT_GetFilename(pLocation, TRUE);
// Put in check for pFilename to be NULL. hardts
char * pDot = pFilename ? strchr(pFilename, '.') : NULL;
if( pFilename && *pFilename && pDot &&
(0 == stricmp(".htm", pDot) || 0 == stricmp(".html", pDot) || 0 == stricmp(".shtml", pDot)) ){
m_csFilename = pFilename;
XP_FREE(pFilename);
// Save version with filename stripped off
char * pURL = EDT_ReplaceFilename(pLocation, NULL, TRUE);
m_csLocation = pURL;
GetDlgItem(IDC_PUBLISH_LOCATION_LIST)->SetWindowText(pURL);
XP_FREEIF(pURL);
} else {
m_csLocation = pLocation;
}
XP_FREE(pLocation);
}
// Update Filename, User name, and password controls
UpdateData(FALSE);
// TRUE = remove a filename ONLY if it has an extension
SetPublishingControls((char*)LPCSTR(m_csLocation), TRUE);
}
void CPublishDlg::OnGetNetcenterLocation()

View File

@ -291,6 +291,7 @@ protected:
#endif
DECLARE_MESSAGE_MAP()
void SetPublishingControls(char *pFullLocation, BOOL bMustHaveExt);
void PadPassword();
};

View File

@ -81,7 +81,7 @@ static UINT BASED_CODE nIDEditBarArray[] =
{
// same order as in the bitmap for toolbar
ID_EDT_NEW_DOC_BLANK,
ID_FILE_OPEN,
ID_FILE_OPENURL,
ID_EDT_FILE_SAVE,
ID_FILE_PUBLISH,
ID_OPEN_NAV_WINDOW,
@ -447,7 +447,7 @@ BOOL CEditToolBarController::CreateEditBars(MWContext *pMWContext, CView *pComma
pIToolBar->SetButtons( nIDEditBarArray, EDITBAR_ID_COUNT );
// Set menu/toolbar popup styles for specific buttons:
pIToolBar->SetButtonStyle(ID_EDT_NEW_DOC_BLANK, TB_HAS_TIMED_MENU);
pIToolBar->SetButtonStyle(ID_FILE_OPEN, TB_HAS_TIMED_MENU);
pIToolBar->SetButtonStyle(ID_FILE_OPENURL, TB_HAS_TIMED_MENU);
pIToolBar->SetButtonStyle(ID_FILE_PRINT, TB_HAS_TIMED_MENU);
// First pair are actually ignored! Second is bitmap size

View File

@ -148,7 +148,6 @@ public:
protected:
void DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf);
//void BuildRecentFilesMenu(CMenu * pMenu);
// Prompts user to supply required URL if missing from preferences.
// Allows selecting a local file

View File

@ -637,7 +637,6 @@ BEGIN
IDS_SELECT_HTML_EDITOR "Choose HTML Editor Application"
IDS_OTHER_HREF_ATTRIBUTES
"Enter any additional attributes, such as Java Script, for the HREF tag. Carriage returns are ignored."
IDS_BAD_PUBLISH_URL "Publish destination must begin with ""ftp://"" or ""http://"""
IDS_TARGETS_IN_CURRENT_DOC
"Select a named target in current page (optional):"
IDS_TARGETS_IN_FILE "Select a named target in the specified file (optional):"
@ -723,7 +722,8 @@ BEGIN
IDS_SELECT_BROWSETO_CAPTION "Choose ""Browse To"" File"
IDS_NEW_PAGE_TEMPLATE "New Page From Template"
IDS_EDITING_TEMPLATE "You are already editing the chosen template page.\nYour new page will not have the latest changes\nyou made in the template page."
IDS_PUBLISH_CAPTION "Publish: %s"
IDS_PUBLISH_CAPTION "Publish: "
IDS_PUBLISH_PAGE "Publish Page"
END
STRINGTABLE DISCARDABLE
@ -750,7 +750,6 @@ END
STRINGTABLE DISCARDABLE
BEGIN
IDS_PUBLISH_FILES "Publish Files"
IDS_FILE_COUNT_FORMAT "File %d of %d"
IDS_UPLOADING_FILE "Uploading file to remote server:"
IDS_SAVING_FILE "Saving file to local disk:"
@ -864,8 +863,6 @@ BEGIN
ID_FORMAT_INCREASE_FONTSIZE "Increase font size 1 unit\nIncrease font size"
ID_FORMAT_DECREASE_FONTSIZE "Decrease font size 1 unit\nDecrease font size"
IDS_8_PTS "8 pts"
IDS_EDIT_LINK_HINT " [Press Ctrl and click to edit link]"
END
#endif // English (U.S.) resources

View File

@ -7389,8 +7389,8 @@ int CLinkPage::GetTargetsInFile()
m_csTargetFile = m_csHref;
} else {
// HREF wasn't a file or
// was same as current
// TODO: How can we know if current URL is same as HREF?
// was same as current document
((CButton*)GetDlgItem(IDC_TARGETS_IN_CURRENT_DOC))->SetCheck(1);
((CButton*)GetDlgItem(IDC_TARGETS_IN_FILE))->SetCheck(0);
return 0;
}

View File

@ -4467,12 +4467,12 @@ LRESULT CNetscapeEditView::OnButtonMenuOpen(WPARAM wParam, LPARAM lParam)
idArray = idArrayNewDoc;
strArray = strArrayNewDoc;
}
else if( nCommand == ID_FILE_OPEN )
else if( nCommand == ID_FILE_OPENURL )
{
// Menu length is dynamic - don't use fixed arrays
// First 2 items are always the same
AppendMenu(hMenu, MF_STRING, ID_FILE_OPEN, szLoadString(IDS_FILE_OPEN));
AppendMenu(hMenu, MF_STRING, ID_FILE_OPENURL, szLoadString(IDS_FILE_OPENURL));
AppendMenu(hMenu, MF_STRING, ID_FILE_OPEN, szLoadString(IDS_FILE_OPEN));
AppendMenu(hMenu, MF_SEPARATOR, 0, 0);
// The rest of the menu comes from the history list of recently-edited URLs

View File

@ -3475,6 +3475,8 @@ BEGIN
IDS_LOAD_PLUGINS "Loading plugins..."
IDS_DRAG_THIS_URL_TIP "Drag this location"
IDS_OPEN "Open"
IDS_OPEN_PAGE "Open Page"
IDS_OPEN_FILE "Open: "
IDS_PROXIE_FOLDERS "Drag this icon to create a link to this window"
IDS_LOAD_JAVA "Starting java..."
IDS_LANGUAGE_GREEK "Greek"

View File

@ -1076,25 +1076,27 @@ BEGIN
EDITTEXT IDC_PROMPT_ANS,5,39,233,12,ES_PASSWORD | ES_AUTOHSCROLL
END
IDD_OPENURL_BOX DIALOG DISCARDABLE 0, 0, 319, 77
IDD_OPENURL_BOX DIALOG DISCARDABLE 0, 0, 319, 76
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Open Page"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Enter the World Wide Web location (URL) or specify the local file you would like to open:",
IDC_STATIC,6,6,243,18
EDITTEXT IDC_URL,6,26,245,12,ES_AUTOHSCROLL | WS_GROUP
PUSHBUTTON "Choose &File...",IDC_BROWSE_FILE,255,25,50,14
#ifdef EDITOR
LTEXT "Open location or file in:",IDC_STATIC,6,43,80,8
LTEXT "Open page in:",IDC_STATIC,6,7,61,8
CONTROL "&Navigator",IDC_OPEN_URL_BROWSER,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,85,56,49,10
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,79,7,58,10
CONTROL "&Composer",IDC_OPEN_URL_EDITOR,"Button",
BS_AUTORADIOBUTTON,85,43,56,10
#endif // EDITOR
DEFPUSHBUTTON "Open",IDOK,145,49,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,201,49,50,14
PUSHBUTTON "Help",ID_HELP,255,49,50,14
BS_AUTORADIOBUTTON,143,7,56,10
COMBOBOX IDC_URL_EDITOR,6,34,245,115,CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL | WS_TABSTOP
#endif
LTEXT "Enter the World Wide Web location or the local file you would like to open:",
IDC_ENTER_URL_MSG,6,23,301,11
COMBOBOX IDC_URL,6,34,245,115,CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL | WS_TABSTOP
// EDITTEXT IDC_URL,6,34,245,12,ES_AUTOHSCROLL | WS_GROUP
PUSHBUTTON "Open &File...",IDC_BROWSE_FILE,255,33,56,14
DEFPUSHBUTTON "Open",IDOK,78,56,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,134,56,50,14
PUSHBUTTON "Help",ID_HELP,190,56,50,14
END
IDD_CHECKCONFIRM_BOX DIALOG DISCARDABLE 0, 0, 186, 95

View File

@ -67,6 +67,8 @@
#define IDD_PROMPT 109
#define IDD_PROMPT_PASSWD 110
#define IDR_SEARCHFRAME 111
#define IDC_ENTER_URL_MSG 109
#define IDC_URL_EDITOR 110
#define IDC_URL 112
#define IDD_URLTITLEBAR 112
#define IDC_TITLE 113
@ -2417,7 +2419,6 @@
#define ID_VIEW_FRAME_INFO 34487
#define ID_MAIL_WRAPLONGLINES 34496
#define ID_HOTLIST_ADDCURRENTTOHOTLIST2 34497
#define IDS_PUBLISH_FILES 34503
#define IDS_FILE_COUNT_FORMAT 34504
#define IDS_UPLOADING_FILE 34505
#define IDS_SAVING_FILE 34506
@ -2792,7 +2793,6 @@
#define IDS_SELECT_HTML_EDITOR 42256
#define IDS_OTHER_HREF_ATTRIBUTES 42257
#define IDS_EDIT_HTML_ATTRIB_CAPTION 42258
#define IDS_BAD_PUBLISH_URL 42261
#define IDS_TARGETS_IN_CURRENT_DOC 42263
#define IDS_TARGETS_IN_FILE 42264
#define IDS_NO_TARGETS 42265
@ -3119,7 +3119,6 @@
#define ID_FORMAT_INCREASE_FONTSIZE 42764
#define ID_FORMAT_DECREASE_FONTSIZE 42765
#define IDS_8_PTS 42766
#define IDS_EDIT_LINK_HINT 42767
#define ID_HISTORY_LOPCONTAINS 43000
#define ID_HISTORY_LOPNOTCONTAINS 43001
#define ID_HISTORY_LOPIS 43002
@ -3610,11 +3609,13 @@
#define IDS_FRAME_MAILPREF 62287
#define IDS_FRAME_EDITORPREF 62288
#define IDS_USER_PROMPT 62289
#define IDS_LOAD_PREFS 62292
#define IDS_LOAD_BOOKMARKS 62293
#define IDS_LOAD_PLUGINS 62294
#define IDS_DRAG_THIS_URL_TIP 62295
#define IDS_OPEN 62296
#define IDS_LOAD_PREFS 62290
#define IDS_LOAD_BOOKMARKS 62291
#define IDS_LOAD_PLUGINS 62292
#define IDS_DRAG_THIS_URL_TIP 62293
#define IDS_OPEN 62294
#define IDS_OPEN_PAGE 62295
#define IDS_OPEN_FILE 62296
#define IDS_PROXIE_FOLDERS 62297
#define IDS_BROWSE_TO_PUB_LOC_CAPTION 62298
#define IDS_LOAD_JAVA 62298