Example #1
0
BOOL CDlgPublishHtml::FillCombo()
{
	// Fill in FTP servers
	m_comboFtpServer.ResetContent();
	HGROUP hGroup = NULL;
	while ( ( hGroup = FTPSERVERS().GetNext( hGroup ) ) != NULL )
		m_comboFtpServer.AddString( hGroup->name );

	// Fill in local server paths
	m_comboFolder.ResetContent();
	CRKey *pRk = WEBSETTINGS().GetKey( "FolderMap" );
	if ( pRk != NULL )
	{	LPREGVALUE	prv = NULL;
		while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
		{
			// Add this path
			int n = m_comboFolder.AddString( pRk->GetSz( prv ) );

			// Select the root
			if (	*prv->cpkey == 0 || !strcmp( prv->cpkey, "/" ) ||
					!strcmp( prv->cpkey, "\\" ) )
				m_comboFolder.SetCurSel( n );

		} // end while
	} // end if

	return TRUE;
}
Example #2
0
BOOL CHtmlProperties::FillCombo(DWORD dwUser, CComboBox *pCombo)
{
	switch( dwUser )
	{
		case 1 :
		{
			{ // Add local server links

				char link[ CWF_STRSIZE ];
				char host[ CWF_STRSIZE ];
				char name[ CWF_STRSIZE ] = { '~', 0x0 };
				DWORD port = 80;
				char strport[ CWF_STRSIZE ];

				// Get port number
				CFG().GetValue( "Settings", "WebServerPort", strport, sizeof( strport ) );
				CFG().GetValue( "Settings", "WebServerPort", &port );

				if ( !gethostname( name, CWF_STRSIZE - 1 ) )
				{
					LPHOSTENT he = gethostbyname( name );
					if ( he != NULL )
					{
						strcpy( host, "http://" );
						strcat( host, inet_ntoa( *(LPIN_ADDR) *( he->h_addr_list ) ) );
						if ( port != 80 ) strcat( host, ":" ), strcat( host, strport );
						strcat( host, "/" );

					} // end if
					else strcpy( host, "http://127.0.0.1/" );

				} // end if
				else strcpy( host, "http://127.0.0.1/" );

				CRKey *pRk = WEBSETTINGS().GetKey( "ImageMap" );
				if ( pRk != NULL )
				{
					LPREGVALUE	prv = NULL;
					while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
					{
						CWinFile::WebBuildPath( link, host, prv->cpkey );
						if ( *link ) pCombo->AddString( link );
					}

					// Add raw image names
					while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
						if ( prv->cpkey != NULL && *prv->cpkey ) 
							pCombo->AddString( prv->cpkey );

				} // end if

			} // end add local server links

			{ // Add publishing links

				LPPUBINFO ppi = NULL;
				char link[ CWF_STRSIZE ];

				while ( ( ppi = (LPPUBINFO)PUBLIST().GetNext( ppi ) ) != NULL )
				{
					if ( ppi->type == PUBTYPE_FTP )
					{
						// Update the filename
						CPubThread::GetFileName( ppi, TRUE );

						// Get HTTP path
						if ( FTPSERVERS().GetValue(	ppi->str, "HttpPath", 
													link, sizeof( link ) ) )
						{
							// Build link to file
							CWinFile::WebBuildPath( link, link, ppi->pub_fname );

							// Add it!
							if ( *link ) pCombo->AddString( link );

						} // end if

					} // end if

					else if ( ppi->type == PUBTYPE_DISK )
					{
						CPubThread::GetFileName( ppi, TRUE );
						CWinFile::WebBuildPath( link, ppi->path, ppi->pub_fname );
						if ( *link ) pCombo->AddString( link );

					} // end else if

				} // end while

			} // end add publishing links

		} break;

		case 2 :
		{
			// Add string values
			for ( DWORD i = 1; i < m_dwParams; i++ )
				pCombo->AddString( m_szParams[ i ] );

		} break;

	} // end switch

	return FALSE;
}