// // Copyright 1999 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wConfigPane: the user preferences edit pane #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wSpecPane.h" #include "p4wConfigPane.h" p4wConfigPane::p4wConfigPane( p4wView & ParentView, p4wRequest & Request ) : p4wSpecPane( ParentView, Request, 1 ) { } p4wConfigPane::~p4wConfigPane() { } void p4wConfigPane::Render( StrDict * varList ) { // // Draw the Settings page p4wHtml htm; StrBuf clearIcon; p4wURL urlMaker; urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); Begin(); htm.beginTRow(); htm.beginCol(); htm.beginDList(); if (fRequest.isLocalRequest() || !SEC_DISALLOW_CHG_CLIENTS) { htm.dListTag(); htm.text( "Change Client", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow(); htm.beginCol(); htm.text( "Client: " ); const StrPtr *cl = fRequest.GetStateArg( "cl" ); if (fRequest.GetMultiUser() && (!cl || !cl->Length() || *cl == "(not set)")) { htm.textField( "Client", "", 32, "client" ); htm << "<script language=\"JavaScript\" type=\"text/javascript\">if(document.getElementById) document.getElementById('client').focus();</script>"; htm << "<font color=\"#FF0000\">You must set your client</font>"; } else { htm.textField( "Client", p4wStrBuf().EscapeHTML(fRequest.GetClient(), Unicode()).Text(), 32, "client" ); if (fRequest.fUnknownClient) { htm << "<script language=\"JavaScript\" type=\"text/javascript\">if(document.getElementById) document.getElementById('client').focus();</script>"; htm << "<font color=\"#FF0000\">Client does not exist - please enter a valid client name</font>"; } } htm.endCol(); htm.endTRow(); htm.endTable(); } if( !fRequest.GetBrowseMode() && fRequest.BypassAuth() ) { htm.paragraph(); htm.dListTag(); htm.text( "Change Port", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow(); htm.beginCol(); htm.text( "Port: " ); htm.textField( "Port", p4wStrBuf().EscapeHTML(fRequest.GetPort(), Unicode()).Text(), 32 ); htm.endCol(); htm.endTRow(); htm.endTable(); } if( !fRequest.GetBrowseMode() ) { htm.paragraph(); htm.dListTag(); htm.text( "Change Password", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow(); htm.beginCol(); htm.text( "Old password: " ); htm.endCol(); htm.beginCol(); htm.passwdField( "OldPassword", NULL, 32 ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm.text( "New password: " ); htm.endCol(); htm.beginCol(); htm.passwdField( "NewPass1", NULL, 32 ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm.endCol(); htm.beginCol(); htm.passwdField( "NewPass2", NULL, 32 ); htm.text( "(enter twice)", "i" ); htm.endCol(); htm.endTRow(); htm.endTable(); } if( fRequest.GetViewMode() != VM_WORKSPACE ) { htm.paragraph(); htm.dListTag(); htm.text( "Back-in-Time Browsing®", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow(); htm.beginCol(); if( fRequest.GetBITBRev().Length() == 0 ) htm.radio( "bitbRadio", "off", 1, 0, "bitbRadiooff" ); else htm.radio( "bitbRadio", "off", 0, 0, "bitbRadiooff" ); htm.label( "Off", "bitbRadiooff" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); if( fRequest.GetBITBRev().Length() > 0 ) htm.radio( "bitbRadio", "on", 1, 0, "bitbRadioon" ); else htm.radio( "bitbRadio", "on", 0, 0, "bitbRadioon" ); htm.label( "On ", "bitbRadioon" ); htm.textField( "atVal", p4wStrBuf().EscapeHTML(fRequest.GetBITBRev(), Unicode()).Text(), 20, 0, "setCheckedValue(document.forms['spec'].elements['bitbRadio'], 'on')" ); htm.text( " (date yyyy/mm/dd or changelist number)", "i" ); htm.endCol(); htm.endTRow(); htm.endTable(); } // // Diff/Resolve preferences section, only for servers 2002.2+ const StrPtr *srv = fRequest.GetProtocol( "server2" ); if( srv && srv->Atoi() > 13 ) { const StrPtr *diff = fRequest.GetStateArg( "dw" ); const StrPtr *diffctx = fRequest.GetStateArg( "dc" ); const StrPtr *diffliw = fRequest.GetStateArg( "dl" ); const StrPtr *res = fRequest.GetStateArg( "rw" ); htm.paragraph(); htm.dListTag(); htm.text( "Diff/Resolve", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow("top"); // // Diff preferences headings htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); htm.text( "Diff format:" ); htm.endCol(); htm.beginCol(0, 0, 0, "2"); htm.icon( clearIcon.Text(), "1", "15", "", 1 ); htm.endCol(); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); htm.text( "Two pane line wrapping:" ); htm.endCol(); htm.beginCol(0, 0, 0, "2"); htm.icon( clearIcon.Text(), "1", "15", "", 1 ); htm.endCol(); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); htm.text( "Diffs shown:" ); htm.endCol(); htm.beginCol(0, 0, 0, "2"); htm.icon( clearIcon.Text(), "1", "15", "", 1 ); htm.endCol(); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); htm.text( "Diffs used for resolving files:" ); htm.endCol(); htm.endTRow(); htm.beginTRow("top"); // // Diff format preferences htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1, "radio_box"); if( !diff || !strpbrk( diff->Text(), "ncsuO" ) ) htm.radio( "diffOutFlag", "none", 1, 0, "donone" ); else htm.radio( "diffOutFlag", "none", 0, 0, "donone" ); htm.label( "Two pane (full file)", "donone" ); htm.linebreak(); if( diff && strpbrk( diff->Text(), "c" ) ) htm.radio( "diffOutFlag", "c", 1, 0, "doc" ); else htm.radio( "diffOutFlag", "c", 0, 0, "doc" ); htm.label( "Two pane (context diffs)", "doc" ); htm.linebreak(); htm.text( "<div align=center>Context lines: " ); htm.textField( "contextLines", diffctx ? p4wStrBuf().EscapeHTML( *diffctx, Unicode() ).Text() : "15", 2, 0, "setCheckedValue(document.forms['spec'].elements['diffOutFlag'], 'c')"); htm << "</div>"; if( diff && strpbrk( diff->Text(), "O" ) ) htm.radio( "diffOutFlag", "O", 1, 0, "doO" ); else htm.radio( "diffOutFlag", "O", 0, 0, "doO" ); htm.label( "Diffs only", "doO" ); htm.linebreak(); if( diff && strpbrk( diff->Text(), "n" ) ) htm.radio( "diffOutFlag", "n", 1, 0, "don" ); else htm.radio( "diffOutFlag", "n", 0, 0, "don" ); htm.label( "RCS", "don" ); htm.linebreak(); if( diff && strpbrk( diff->Text(), "u" ) ) htm.radio( "diffOutFlag", "u", 1, 0, "dou" ); else htm.radio( "diffOutFlag", "u", 0, 0, "dou" ); htm.label( "Unified format", "dou" ); htm.linebreak(); if( diff && strpbrk( diff->Text(), "s" ) ) htm.radio( "diffOutFlag", "s", 1, 0, "dos" ); else htm.radio( "diffOutFlag", "s", 0, 0, "dos" ); htm.label( "Summary", "dos" ); htm.endCol(); // // 2 pane diff line wrapping htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1, "radio_box"); if( !diffliw ) htm.radio( "diffLiWrap", "default", 1, 0, "diffliw" ); else htm.radio( "diffLiWrap", "default", 0, 0, "diffliw" ); htm.label( "Wrap lines, ignoring tabs", "diffliw" ); htm.linebreak(); if( diffliw && *diffliw == "m" ) htm.radio( "diffLiWrap", "m", 1, 0, "diffliwm" ); else htm.radio( "diffLiWrap", "m", 0, 0, "diffliwm" ); htm.label( "Wrap lines", "diffliwm" ); htm.linebreak(); if( diffliw && *diffliw == "n" ) htm.radio( "diffLiWrap", "n", 1, 0, "diffliwn" ); else htm.radio( "diffLiWrap", "n", 0, 0, "diffliwn" ); htm.label( "Do not wrap lines", "diffliwn" ); htm.endCol(); // // Diff whitespace preferences htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1, "radio_box"); if( !diff || !strpbrk( diff->Text(), "wbl" ) ) htm.radio( "diffFlag", "none", 1, 0, "dfnone" ); else htm.radio( "diffFlag", "none", 0, 0, "dfnone" ); htm.label( "All ", "dfnone" ); htm.linebreak(); if( diff && strpbrk( diff->Text(), "b" ) ) htm.radio( "diffFlag", "b", 1, 0, "dfb" ); else htm.radio( "diffFlag", "b", 0, 0, "dfb" ); htm.label( "Ignore whitespace changes", "dfb" ); htm.linebreak(); if( diff && strpbrk( diff->Text(), "w" ) ) htm.radio( "diffFlag", "w", 1, 0, "dfw" ); else htm.radio( "diffFlag", "w", 0, 0, "dfw" ); htm.label( "Ignore all whitespace", "dfw" ); htm.linebreak(); // // Diff -dl only supported for servers 3.2x if( srv && srv->Atoi() > 16 ) { if( diff && strpbrk( diff->Text(), "l" ) ) htm.radio( "diffFlag", "l", 1, 0, "df1" ); else htm.radio( "diffFlag", "l", 0, 0, "dfl" ); htm.label( "Ignore line endings", "dfl" ); } htm.endCol(); // // Resolve options htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1, "radio_box"); if( !res || ( *res != "dw" && *res != "db" ) ) htm.radio( "resFlag", "none", 1 ); else htm.radio( "resFlag", "none" ); htm.label( "All", "none" ); htm.linebreak(); if( res && *res == "db" ) htm.radio( "resFlag", "db", 1 ); else htm.radio( "resFlag", "db" ); htm.label( "Ignore whitespace changes", "db" ); htm.linebreak(); if( res && *res == "dw" ) htm.radio( "resFlag", "dw", 1 ); else htm.radio( "resFlag", "dw" ); htm.label( "Ignore all whitespace", "dw" ); htm.endCol(); htm.endTRow(); htm.endTable(); if( srv && srv->Atoi() > 19 ) { // // Thumbnail options const StrPtr *thc = fRequest.GetStateArg( "thc" ); const StrPtr *thz = fRequest.GetStateArg( "thz" ); const StrPtr *thm = fRequest.GetStateArg( "thm" ); const StrPtr *thb = fRequest.GetStateArg( "thb" ); const StrPtr *thw = fRequest.GetStateArg( "thw" ); htm.paragraph(); htm.dListTag(); htm.text( "Thumbnails", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "0"); htm.beginTRow("top"); htm.beginCol(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow("top"); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); htm.text( "Thumbnail size:" ); htm.endCol(); htm.endTRow(); htm.beginTRow("top"); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1, "radio_box"); if( !thz || ( *thz != "m" && *thz != "s" ) ) htm.radio( "thumbSize", "none", 1, 0, "thl" ); else htm.radio( "thumbSize", "none", 0, 0, "thl" ); htm.label( "Large (160x160) ", "thl" ); htm.linebreak(); if( thz && *thz == "m" ) htm.radio( "thumbSize", "m", 1, 0, "thm" ); else htm.radio( "thumbSize", "m", 0, 0, "thm" ); htm.label( "Medium (120x120) ", "thm" ); htm.linebreak(); if( thz && *thz == "s" ) htm.radio( "thumbSize", "s", 1, 0, "ths" ); else htm.radio( "thumbSize", "s", 0, 0, "ths" ); htm.label( "Small (80x80) ", "ths" ); htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "1", "15", "", 1 ); htm.endCol(); htm.beginCol(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow("top"); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); if( thw && *thw == "y" ) htm.checkbox( "thumbWrap", "y", 1 ); else htm.checkbox( "thumbWrap", "y", 0 ); htm.label( "Autowrap thumbnails", "thumbWrap" ); htm.linebreak(); if( thm && *thm == "y" ) htm.checkbox( "thumbMag", "y", 1 ); else htm.checkbox( "thumbMag", "y", 0 ); htm.label( "Magnify small thumbnails ", "thumbMag" ); htm.linebreak(); if( thb && *thb == "y" ) htm.checkbox( "thumbBorder", "y", 1 ); else htm.checkbox( "thumbBorder", "y", 0 ); htm.label( "Show thumbnail borders ", "thumbBorder" ); htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "1", "15", "", 1 ); htm.endCol(); htm.beginCol(0, 0, 0, 0, 0, 0, 0, 1); htm.text( "Thumbnail columns: " ); htm.textField( "thumbCols", StrNum( fRequest.GetThumbnailCols() ).Text(), 2 ); htm.text( " (1 - 10) " ); htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.endTRow(); htm.endTable(); } } // // Miscellaneous settings that defy categorization htm.paragraph(); htm.dListTag(); htm.text( "Miscellaneous", "b" ); htm.dListVal(); htm.beginTable("0", 0, "0", "4"); htm.beginTRow(); htm.beginCol(); htm.text( "<a name=\"pcl\">Page content limit: </a>" ); htm.textField( "contentLimit", StrNum( fRequest.PageContentLimit() ).Text(), 6 ); htm.text( "K bytes" ); htm.text( " (default is 1024)", "i" ); htm.endCol(); htm.endTRow(); if (fRequest.GetBrowseMode()) { htm.beginTRow(); htm.beginCol(); const StrPtr *pgc = fRequest.GetStateArg( "pgc" ); if( pgc && *pgc == "y" ) htm.checkbox( "pageCache", "y", 1 ); else htm.checkbox( "pageCache", "y", 0 ); htm.label( "Enable page caching", "pageCache" ); htm.endCol(); htm.endTRow(); } htm.beginTRow(); htm.beginCol(); htm.beginNobreak(); const StrPtr *thx = fRequest.GetStateArg( "thx" ); if( thx && *thx == "y" ) htm.checkbox( "thumbNoCSS", "y", 1 ); else htm.checkbox( "thumbNoCSS", "y", 0 ); htm.label( "Disable popup menus and thumbnail autowrapping <nobr>(<i>select this option for older browsers</i>)</nobr>", "thumbNoCSS" ); htm.endNobreak(); htm.endCol(); htm.endTRow(); const StrPtr *M = fRequest.GetStateArg( "M" ); // Misc flag - used for several settings. htm.beginTRow(); htm.beginCol(); if( M && strchr(M->Text(), 'o') ) htm.checkbox( "oldAnnotate", "y", 1 ); else htm.checkbox( "oldAnnotate", "y", 0 ); htm.label( "Disable enhanced annnotate display options <nobr>(<i>select this option for faster annotate performance</i>)</nobr>", "oldAnnotate" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); const StrPtr *jf = fRequest.GetStateArg( "jf" ); if( jf && *jf == "y" ) htm.checkbox( "fixesAlways", "y", 1 ); else htm.checkbox( "fixesAlways", "y", 0 ); htm.label( "Always show job fixes on the Job Specification page", "fixesAlways" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); const StrPtr *lno = fRequest.GetStateArg( "lno" ); if( lno && *lno == "y" ) htm.checkbox( "showLineNo", "y", 1 ); else htm.checkbox( "showLineNo", "y", 0 ); htm.label( "Show line numbers by default when viewing file text", "showLineNo" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); if( M && strchr(M->Text(), 'h') ) htm.checkbox( "showContentHist", "y", 1 ); else htm.checkbox( "showContentHist", "y", 0 ); htm.label( "Show content history instead of branching history when displaying revision history integrations", "showContentHist" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); if( M && strchr(M->Text(), 'c') ) htm.checkbox( "showP4Cmds", "y", 1 ); else htm.checkbox( "showP4Cmds", "y", 0 ); htm.label( "Show P4 command log", "showP4Cmds" ); // hidden fields const StrPtr *hd = fRequest.GetStateArg( "hd" ); if( hd ) htm.hiddenField( "hideCols", hd->Text() ); const StrPtr *bo = fRequest.GetStateArg( "bo" ); if( bo && *bo == "1" ) htm.hiddenField( "browseOnly", "1" ); const StrPtr *X = fRequest.GetStateArg( "X" ); // undoc eXperimental flags if( X ) htm.hiddenField( "X", X->Text() ); const StrPtr *sho = fRequest.GetStateArg( "sho" ); // show screen chunks flags if( sho ) htm.hiddenField( "screenChunks", sho->Text() ); htm.endCol(); htm.endTRow(); if (X && strchr(X->Text(), 'd')) { StrBuf defs; defs << fRequest.GetDefaults(); int b = strstr(defs.Text(), "&D=1") ? 1 : 0; htm.beginTRow(); htm.beginCol(); if( b ) htm.checkbox( "forceDefaults", "1", 1 ); else htm.checkbox( "forceDefaults", "1", 0 ); htm.label( "Force external URLs to have the saved defaults (requires clicking <b>Save as Defaults</b> to change this setting)", "forceDefaults" ); htm.endCol(); htm.endTRow(); } htm.endTable(); htm.endCol(); htm.endTRow(); fRequest << htm; End(); } // // Overrides for spec config panes // void p4wConfigPane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value ConstructAction( AC_CONFIGPROCESSOR, NULL, 1, actionURL ); } void p4wConfigPane::End() { // // End the pane. p4wHtml htm; p4wURL urlMaker; StrBuf clearIcon; StrBuf actionURL; urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); // // Generate a submit button only if this is a form and // if no error occurred. if( !fPrintedError && fIsForm ) { htm.beginTRow(); if( fNCols > 2 ) htm.beginCol( NULL, "center", "4" ); else htm.beginCol( NULL, "center", "2" ); htm.button( "save", " Save " ); htm << " "; htm.button( "defaults", "Save as Default"); htm << " "; htm.button( "restore", "Restore Defaults"); htm.endCol(); htm.endTRow(); } htm.endTable(); htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.endTRow(); if( fIsForm ) htm.endForm(); htm.comment( "END SETTINGS PANE" ); fRequest << htm; }
# | 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/Panes/p4wConfigPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |