/** * @author Gproxy Design Inc. * @copyright (c) 2009, Gproxy Design Inc. All rights reserved. * @version 1.0 * * Agreement * Redistribution and use of this software in source and binary forms, with or * without modification, are permitted provided that all of the following * conditions are met: * (1) Redistributions of source code must retain: * (i) the above copyright notice, * (ii) this list of redistribution conditions, and * (iii) the disclaimer appearing below. * (iiii) the logos, hyperlinks or publicity provided in the original version. * (2) Redistributions in binary form must retain: * (i) the above copyright notice, * (ii) this list of redistribution conditions, and * (iii) the disclaimer appearing below in the documentation and/or any other materials provided with the distribution. * (iiii) the logos, hyperlinks or publicity provided in the original version. * (3) Neither the name of the Gproxy Design nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * 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 * THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */ /** * Show the item rating * Recives the item Id, the site number and the ratind display * @param {Object} itemId * @param {Object} siteNumber * @param {Object} ratingDisplay */ function crvShowItemRating(itemId, siteNumber, ratingDisplay, filesPath){ var src = '/app/site/hosting/scriptlet.nl?script=customscript_crv_showitemrating&deploy=customdeploy_crv_showitemrating&itemid=' + itemId + '&sitenumber=' + siteNumber + '&display=' + ratingDisplay + '&filesPath=' + filesPath; var scriptFile = document.createElement('script'); scriptFile.setAttribute('type', 'text/javascript'); scriptFile.setAttribute('src', src); document.getElementsByTagName('head')[0].appendChild(scriptFile); } function crvShowItemReviews(itemId, siteNumber, reviewsDisplay, ratingDetailDisplay, filesPath){ var src = '/app/site/hosting/scriptlet.nl?script=customscript_crv_showitemreviews&deploy=customdeploy_crv_showitemreviews&itemid=' + itemId + '&sitenumber=' + siteNumber + '&display=' + reviewsDisplay + '&displaydetail=' + ratingDetailDisplay + '&filesPath=' + filesPath; var scriptFile = document.createElement('script'); scriptFile.setAttribute('type', 'text/javascript'); scriptFile.setAttribute('src', src); document.getElementsByTagName('head')[0].appendChild(scriptFile); } /** * CUSTOMER REVIEWS * Shows the form to input a new reviw */ function crvShowReviewForm(){ if (document.getElementById('crv_display_write_from').style.display == 'block') document.getElementById('crv_display_write_from').style.display = 'none'; else document.getElementById('crv_display_write_from').style.display = 'block'; } /** * CUSTOMER REVIEWS * Recives the value of rating * @param {Object} start */ function crvSetImageValue(start){ document.getElementById("crv_rating").value = start.value; } /** * CUSTOMER REVIEWS * Send the review to netsuite custome record with Suite Scripts * Recives the item internal Id * @param {Object} itemId */ function crvSaveReview(itemId, siteNumber){ var crv_reviewer = document.getElementById("crv_reviewer").value; if (crv_reviewer.length == 0) { alert("Please, fill the reviewer."); return; } var crv_comments = document.getElementById("crv_comments").value; if (crv_comments.length == 0) { alert("Please, fill a comment."); return; } var crv_rating = document.getElementById("crv_rating").value; crv_comments = crv_comments.replace(/\n/g,'
'); crv_comments = escape(crv_comments); crv_reviewer = crv_reviewer.replace(/\n/g,'
'); crv_reviewer = escape(crv_reviewer); var url = '/app/site/hosting/scriptlet.nl?script=customscript_crv_saveitemreview&deploy=customdeploy_crv_saveitemreview&itemid=' + itemId + '&sitenumber=' + siteNumber + '&reviewer=' + crv_reviewer + '&rating=' + crv_rating + '&comments=' + crv_comments; var scriptFile = document.createElement('script'); scriptFile.setAttribute('type', 'text/javascript'); scriptFile.setAttribute('src', url); document.getElementsByTagName("head")[0].appendChild(scriptFile); document.getElementById("crv_reviewer").value = ""; document.getElementById("crv_comments").value = ""; document.getElementById("crv_reviewer").focus(); }