View the DQSD CVS repository here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/
Update of /cvsroot/dqsd/dqsd/src/DQSDSearchWiz
In directory usw-pr-cvs1:/tmp/cvs-serv26228/src/DQSDSearchWiz
Modified Files:
DQSDWizardDlg.cpp DQSDWizardDlg.h test.htm
Log Message:
handle TEXTAREAs; put comments after checkboxes indicating if they checked/unchecked
Index: DQSDWizardDlg.cpp
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDSearchWiz/DQSDWizardDlg.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** DQSDWizardDlg.cpp 10 Aug 2002 06:37:19 -0000 1.18
--- DQSDWizardDlg.cpp 10 Aug 2002 13:11:25 -0000 1.19
***************
*** 52,55 ****
--- 52,60 ----
USES_CONVERSION;
+ #ifdef _DEBUG
+ CWindow( GetDlgItem( IDC_SearchName ) ).SetWindowText( _T("xyzzy") );
+ CWindow( GetDlgItem( IDC_SearchTitle ) ).SetWindowText( _T("xyzzy Search") );
+ #endif
+
CenterWindow( GetActiveWindow() ); // ??? should probably use the actual
browser window
***************
*** 462,466 ****
}
! string CDQSDWizardDlg::GetForms( string& rstrSearchName, string& rstrFormScript )
{
USES_CONVERSION;
--- 467,471 ----
}
! string CDQSDWizardDlg::GetForms( const string& rstrSearchName, string&
rstrFormScript )
{
USES_CONVERSION;
***************
*** 579,582 ****
--- 584,594 ----
}
+ BOOL bChecked = FALSE;
+ _variant_t varChecked;
+ if ( SUCCEEDED(
+spElement->getAttribute( _bstr_t( _T("checked") ), 0, &varChecked ) ) )
+ {
+ bChecked = varChecked.boolVal;
+ }
+
// Stick the value of the field in as
well for two reasons... some hidden fields are required
// and the user can enter a string in
a visible field to see which field to use.
***************
*** 584,594 ****
if ( !_tcsicmp( _T("radio"),
strInputType.c_str() ) )
{
- BOOL bChecked = FALSE;
- _variant_t varChecked;
- if ( SUCCEEDED(
spElement->getAttribute( _bstr_t( _T("checked") ), 0, &varChecked ) ) )
- {
- bChecked =
varChecked.boolVal;
- }
-
RadioButtonMap_t::iterator
itFound = mapRadioButtons.find( strInputName );
RadioButtonValues_t
radioValues;
--- 596,599 ----
***************
*** 606,627 ****
}
! // If there are any non-alpha
characters in the INPUT field name, the use different notation in the script
!
! string strScriptInputName = _T(".") +
strInputName + _T(".value");
! if ( ( strInputName.find_first_not_of(
_T("_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"), 0 ) !=
string::npos ) ||
! ( !_tcsicmp(
strInputName.c_str(), _T("target") ) ) ||
! ( !_tcsicmp(
strInputName.c_str(), _T("submit") ) ) )
! {
! strScriptInputName = _T("[\"")
+ strInputName + _T("\"].value");
! }
!
! if ( bActiveElement )
{
! strFormXML += _T("\r\n
<COMMENT> The following field was active (i.e. had focus) when the search was
generated. </COMMENT>");
}
strFormXML += _T("\r\n <input
type=\"hidden\" name=\"") + strInputName + _T("\" value=\"") + strInputValue + _T("\"
/>");
! if ( bActiveElement )
{
rstrFormScript += _T("\r\n"
--- 611,627 ----
}
! if ( bActiveElement )
{
! strFormXML += _T("\r\n\r\n
<COMMENT> The following field was active (i.e. had focus) when the search was
generated. </COMMENT>\r\n");
}
strFormXML += _T("\r\n <input
type=\"hidden\" name=\"") + strInputName + _T("\" value=\"") + strInputValue + _T("\"
/>");
! // Only set the search string to the
form field if it was a text field
!
! if ( bActiveElement &&
! _tcsicmp( _T("radio"),
strInputType.c_str() ) &&
! _tcsicmp( _T("checkbox"),
strInputType.c_str() ) &&
! _tcsicmp( W2T( bstrTagName ),
_T("SELECT") ) )
{
rstrFormScript += _T("\r\n"
***************
*** 629,637 ****
"\r\n // this field was the active element when the search file was
generated."
"\r\n // Change this to args.q if the search string is parsed with
parseArgs."
!
"\r\n document.") + strFormName + strScriptInputName + _T(" = q;");
}
else
{
! rstrFormScript += _T("\r\n
//document.") + strFormName + strScriptInputName + _T(" = \"\";");
}
--- 629,645 ----
"\r\n // this field was the active element when the search file was
generated."
"\r\n // Change this to args.q if the search string is parsed with
parseArgs."
!
"\r\n document.") + strFormName + GetScriptFieldName( strInputName ) +
_T(" = q;");
}
else
{
! rstrFormScript += _T("\r\n
//document.") + strFormName + GetScriptFieldName( strInputName ) + _T(" = \"\";");
! }
!
! if ( !_tcsicmp( _T("checkbox"),
strInputType.c_str() ) )
! {
! strFormXML += _T("\r\n
<COMMENT>"
!
"\r\n The input element above, \"") + strInputName + _T("\", was a checkbox
that was ") +
!
string( bChecked ? _T("checked.") : _T("unchecked.") );
! strFormXML += _T("\r\n
</COMMENT>\r\n");
}
***************
*** 672,676 ****
strFormXML += _T("\r\n
</select>"
!
"\r\n </COMMENT>");
} // end-if SELECT
--- 680,684 ----
strFormXML += _T("\r\n
</select>"
!
"\r\n </COMMENT>\r\n");
} // end-if SELECT
***************
*** 706,721 ****
}
! string strScriptInputName = _T(".") +
itElements->first + _T(".value");
! if ( (
itElements->first.find_first_not_of(
_T("_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"), 0 ) !=
string::npos ) ||
! ( !_tcsicmp(
itElements->first.c_str(), _T("target") ) ) ||
! ( !_tcsicmp(
itElements->first.c_str(), _T("submit") ) ) )
! {
! strScriptInputName = _T("[\"")
+ itElements->first + _T("\"].value");
! }
! rstrFormScript += _T("\r\n
//document.") + strFormName + strScriptInputName + _T(" = \"\";");
strRadioElement += _T("\" />");
!
! strRadioValues += _T("\r\n
<COMMENT>");
strFormXML += strRadioElement;
--- 714,721 ----
}
! rstrFormScript += _T("\r\n
//document.") + strFormName + GetScriptFieldName( itElements->first ) + _T(" = \"\";");
strRadioElement += _T("\" />");
! strRadioValues += _T("\r\n
</COMMENT>\r\n");
strFormXML += strRadioElement;
***************
*** 840,843 ****
--- 840,844 ----
// srch_repl( xml, _T("'"), _T("'") );
// srch_repl( xml, _T("\""), _T(""") );
+ srch_repl( xml, _T("\r\n"), _T("\\n") );
return xml;
***************
*** 937,939 ****
--- 938,956 ----
rk.Close();
return 0;
+ }
+
+ // Convert the fieldname to a valid script form of the name
+ // If there are any non-alpha characters in the INPUT field name,
+ // then use different notation in the script
+
+ string CDQSDWizardDlg::GetScriptFieldName( const string& rstrFieldName )
+ {
+ string strScriptInputName = _T(".") + rstrFieldName + _T(".value");
+ if ( ( rstrFieldName.find_first_not_of(
+_T("_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"), 0 ) !=
+string::npos ) ||
+ ( !_tcsicmp( rstrFieldName.c_str(), _T("target") ) ) ||
+ ( !_tcsicmp( rstrFieldName.c_str(), _T("submit") ) ) )
+ {
+ strScriptInputName = _T("[\"") + rstrFieldName + _T("\"].value");
+ }
+ return strScriptInputName;
}
Index: DQSDWizardDlg.h
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDSearchWiz/DQSDWizardDlg.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** DQSDWizardDlg.h 9 Aug 2002 14:07:09 -0000 1.10
--- DQSDWizardDlg.h 10 Aug 2002 13:11:25 -0000 1.11
***************
*** 62,75 ****
string m_strBaseURL;
string m_strVersion;
private:
string GetAbsoluteActionPath( _variant_t& varAction );
! string GetForms( string& rstrSearchName, string& rstrFormScript );
string GetSwitches();
string EscapeXML( string& xml );
void SaveFields();
void RestoreFields();
!
! CSearchNameEdit m_editSearchName;
};
--- 62,75 ----
string m_strBaseURL;
string m_strVersion;
+ CSearchNameEdit m_editSearchName;
private:
string GetAbsoluteActionPath( _variant_t& varAction );
! string GetForms( const string& rstrSearchName, string& rstrFormScript );
string GetSwitches();
string EscapeXML( string& xml );
void SaveFields();
void RestoreFields();
! string GetScriptFieldName( const string& rstrFieldName );
};
Index: test.htm
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDSearchWiz/test.htm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test.htm 10 Aug 2002 06:37:19 -0000 1.1
--- test.htm 10 Aug 2002 13:11:25 -0000 1.2
***************
*** 19,22 ****
--- 19,26 ----
<input type="radio" name="radio1" value="option3"></p>
+ <textarea name="textarea1">
+ this is the value of the textarea
+ </textarea>
+
<input type="submit">
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
DQSD-CVS mailing list
https://lists.sourceforge.net/lists/listinfo/dqsd-cvs
DQSD CVS repository:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/