// Copyright 2003 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wJs: // Appends the requested javascript data to itself (which is basically // a StrBuf). This is used to build up javascript strings which can // be output by the p4wRequest to the browser. #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wJs.h" p4wJs & p4wJs::beginJs( const char *version ) { // // Generate the script directive used to start // a javascript section of code *this << "<script language=\"JavaScript"; if( version ) *this << version; *this << "\">" << crlf; return *this; } p4wJs & p4wJs::endJs() { // // Generate the end script directive *this << "</script>" << crlf; return *this; } p4wJs & p4wJs::goSelected() { // // Go to the selected value without requiring a button press *this << "function go( selId ) {" << crlf; *this << "location = selId.options[selId.selectedIndex].value" << crlf; *this << "}" << crlf; *this << crlf; return *this; } p4wJs & p4wJs::setCheckedValue() { // // Clear a Form field *this << "function setCheckedValue(radioObj, newValue) {" << crlf; *this << " if(!radioObj)" << crlf; *this << " return;" << crlf; *this << " var radioLength = radioObj.length;" << crlf; *this << " if(radioLength == undefined) {" << crlf; *this << " radioObj.checked = (radioObj.value == newValue.toString());" << crlf; *this << " return;" << crlf; *this << " }" << crlf; *this << " for(var i = 0; i < radioLength; i++) {" << crlf; *this << " radioObj[i].checked = false;" << crlf; *this << " if(radioObj[i].value == newValue.toString()) {" << crlf; *this << " radioObj[i].checked = true;" << crlf; *this << " }" << crlf; *this << " }" << crlf; *this << "}" << crlf; return *this; } p4wJs & p4wJs::clearField(const char *thefield, const char *title) { // // Clear a Form field *this << "<!--" << crlf; *this << "function clearText(field){ field.value = \"\" }" << crlf; *this << "document.write(\"<input type='button' value='" << title; *this << "' onClick='clearText(" << thefield << ")'>\")" << crlf; *this << "//-->" << crlf; return *this; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12234 | Matt Attaway |
Rejigger P4Web project in preparation for official sunsetting The bin directory contains the last official builds of P4Web from the Perforce download site. P4Web is soon to be completely sunsetted; these builds are here for folks who don't want to build their own. To better handle the archived builds the source code has been moved into a separate src directory. |
||
//guest/perforce_software/p4web/util/p4wJs.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |