- <!--
- ////////////////////////////////////////////////////////////////////////////
- // Rev: 2010.1 (P4JsApi 1.0 Example)
- //
- // NOTE: This is an example only, and should be modified to work in
- // a production environment! No warranty is expressed or implied.
- // Scripts should be tested thoroughly on a test server before
- // using in a production environment.
- //
- ////////////////////////////////////////////////////////////////////////////
- // Copyright (c) 2010, Perforce Software, Inc. All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are met:
- //
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- //
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- // ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY
- // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- ////////////////////////////////////////////////////////////////////////////
- //
- // An example of a P4JsApi applet. Displays a list of P4V and
- // P4 Admin images available to use in your applets.
- //
- // Note: You will need internet access to use Firebug Lite.
- //
- ////////////////////////////////////////////////////////////////////////////
- -->
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Image List</title>
- <style>
- .northRegionFont {
- font:normal 12px verdana;
- }
- .imageNameFont {
- font-weight:bold;
- color:#666666;
- }
- </style>
- <script type="text/javascript">
- function runOnLoad() {
- try {
- var generalInfoHtmlText = '<p>Welcome ' + P4JsApi.getUser() + '!<br/><br/>' +
- 'P4JsApi api version: <i>' + P4JsApi.getApiVersion() + '</i><br/>' +
- 'Below is the table displaying the Perforce built-in images.</br>' +
- 'This will developers the ability to maintain an integrated look when creating new custom applications.</p>';
- var generalInfo = document.getElementById("generalInfo");
- generalInfo.innerHTML = generalInfoHtmlText;
- var p4vimages = P4JsApi.getImageNames();
- var imageNames = p4vimages["imageNames"];
- var imageTable = document.getElementById("imageTable");
- for (var i = 0; i < imageNames.length; i++) {
- var row = imageTable.insertRow(i+1);
- // left cell
- var cellLeft = row.insertCell(0);
- var textNode = document.createTextNode(imageNames[i]);
- cellLeft.appendChild(textNode);
- // right cell
- var cellRight = row.insertCell(1);
- var elem = document.createElement("img");
- elem.setAttribute("src", P4JsApi.getImage(imageNames[i]));
- cellRight.appendChild(elem);
- }
- // Custom function used for column renderer
- // @param {Object} val
- function fontChange(val){
- return '<span class="imageNameFont">' + val + '</span>';
- }
- } catch(e) {
- alert(e);
- }
- }
- </script>
- </head>
- <body onload="runOnLoad();">
- <div id="generalInfo">
- </div>
- <br/>
- <table id="imageTable">
- <th>Image Name</th>
- <th>Image</th>
- </table>
- <!-- Uncomment below line for debugging inside this page using Firebug Lite -->
- <!-- Uncomment below line for debugging inside this page using Firebug Lite -->
- <!--<script type='text/javascript'
- src='https://getfirebug.com/firebug-lite.js'>
- </script>-->
- </body>
- </<html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 7810 | jhalbig | Fixed the firebug URL to point to generic "always safe" https URL instead of the (now no... longer working) version specific URL. Updated README to reflect this change as well. « |
14 years ago | |
#4 | 7663 | dscheirer | Rollback //public/perforce/p4jsapi to changelist 7643 | 15 years ago | |
#3 | 7660 | jhalbig | As per meeting to resolve issue with sync calls made from within async calls hanging P4V... (job039138) pulling example code from Public Depot until it can be re-worked and confirmed to function correctly with pending P4JsApi changes. « |
15 years ago | |
#2 | 7643 | jhalbig | Cleaned up any remaining discrepancies in the code. Removed all internal references and d...ebugging code. Cleaned up formatting, added more commenting for submit dialog code. Ready for 2010.1 Beta. « |
15 years ago | |
#1 | 7638 | jhalbig | Initial Addition of P4JsApi samples for 2010.1 Beta | 15 years ago |