From bf844e047240cde91502e1e0e135d2e4bd1c45a3 Mon Sep 17 00:00:00 2001
From: Ryan Huffman <ryanhuffman@gmail.com>
Date: Wed, 5 Dec 2018 16:07:45 -0800
Subject: [PATCH] Add hiding of certified properties in Create

---
 scripts/system/html/js/entityList.js       |  8 ++++--
 scripts/system/html/js/entityProperties.js | 33 ++++++++++++++++------
 scripts/system/libraries/entityList.js     |  3 +-
 3 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js
index 9e6eb3311a..89b56c7f7b 100644
--- a/scripts/system/html/js/entityList.js
+++ b/scripts/system/html/js/entityList.js
@@ -23,6 +23,7 @@ const SCROLLBAR_WIDTH = 20;
 const RESIZER_WIDTH = 10;
 const DELTA_X_MOVE_COLUMNS_THRESHOLD = 2;
 const DELTA_X_COLUMN_SWAP_POSITION = 5;
+const CERTIFIED_PLACEHOLDER = "** Certified **";
 
 const COLUMNS = {
     type: {
@@ -635,10 +636,11 @@ function loaded() {
                         id: entity.id,
                         name: entity.name,
                         type: type,
-                        url: filename,
-                        fullUrl: entity.url,
+                        url: entity.certificateID === "" ? filename : "<i>" + CERTIFIED_PLACEHOLDER + "</i>",
+                        fullUrl: entity.certificateID === "" ? filename : CERTIFIED_PLACEHOLDER,
                         locked: entity.locked,
                         visible: entity.visible,
+                        certificateID: entity.certificateID,
                         verticesCount: displayIfNonZero(entity.verticesCount),
                         texturesCount: displayIfNonZero(entity.texturesCount),
                         texturesSize: decimalMegabytes(entity.texturesSize),
@@ -876,7 +878,7 @@ function loaded() {
                 if (column.data.glyph) {
                     elCell.innerHTML = itemData[column.data.propertyID] ? column.data.columnHeader : null;
                 } else {
-                    elCell.innerText = itemData[column.data.propertyID];
+                    elCell.innerHTML = itemData[column.data.propertyID];
                 }
                 elCell.style = "min-width:" + column.widthPx + "px;" + "max-width:" + column.widthPx + "px;";
                 elCell.className = createColumnClassName(column.columnID);
diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js
index 84a1ab2a12..c39761e311 100644
--- a/scripts/system/html/js/entityProperties.js
+++ b/scripts/system/html/js/entityProperties.js
@@ -390,7 +390,9 @@ const GROUPS = [
             {
                 label: "Model",
                 type: "string",
+                placeholder: "URL",
                 propertyID: "modelURL",
+                hideIfCertified: true,
             },
             {
                 label: "Collision Shape",
@@ -404,11 +406,13 @@ const GROUPS = [
                 label: "Compound Shape",
                 type: "string",
                 propertyID: "compoundShapeURL",
+                hideIfCertified: true,
             },
             {
                 label: "Animation",
                 type: "string",
                 propertyID: "animation.url",
+                hideIfCertified: true,
             },
             {
                 label: "Play Automatically",
@@ -460,6 +464,7 @@ const GROUPS = [
                 type: "textarea",
                 propertyID: "originalTextures",
                 readOnly: true,
+                hideIfCertified: true,
             },
         ]
     },
@@ -1181,6 +1186,7 @@ const GROUPS = [
                 buttons: [ { id: "reload", label: "F", className: "glyph", onClick: reloadScripts } ],
                 propertyID: "script",
                 placeholder: "URL",
+                hideIfCertified: true,
             },
             {
                 label: "Server Script",
@@ -1267,6 +1273,7 @@ const GROUPS = [
                 placeholder: "URL",
                 propertyID: "collisionSoundURL",
                 showPropertyRule: { "collisionless": "false" },
+                hideIfCertified: true,
             },
             {
                 label: "Dynamic",
@@ -3084,6 +3091,15 @@ function loaded() {
 
                         showGroupsForType(selectedEntityProperties.type);
                         
+                        if (selectedEntityProperties.locked) {
+                            disableProperties();
+                            getPropertyInputElement("locked").removeAttribute('disabled');
+                        } else {
+                            enableProperties();
+                            disableSaveUserDataButton();
+                            disableSaveMaterialDataButton()
+                        }
+                        
                         for (let propertyID in properties) {
                             let property = properties[propertyID];
                             let propertyData = property.data;
@@ -3094,6 +3110,14 @@ function loaded() {
                             if (propertyValue === undefined && !isSubProperty) {
                                 continue;
                             }
+
+                            if (propertyData.hideIfCertified) {
+                                let shouldHide = selectedEntityProperties.certificateID !== "";
+                                if (shouldHide) {
+                                    propertyValue = "** Certified **";
+                                }
+                                property.elInput.disabled = shouldHide;
+                            }
                             
                             let isPropertyNotNumber = false;
                             switch (propertyData.type) {
@@ -3272,15 +3296,6 @@ function loaded() {
                             hideMaterialDataSaved();
                         }
                         
-                        if (selectedEntityProperties.locked) {
-                            disableProperties();
-                            getPropertyInputElement("locked").removeAttribute('disabled');
-                        } else {
-                            enableProperties();
-                            disableSaveUserDataButton();
-                            disableSaveMaterialDataButton()
-                        }
-                        
                         let activeElement = document.activeElement;
                         if (doSelectElement && typeof activeElement.select !== "undefined") {
                             activeElement.select();
diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js
index eeb16fd60d..f27ab6caf2 100644
--- a/scripts/system/libraries/entityList.js
+++ b/scripts/system/libraries/entityList.js
@@ -164,7 +164,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
             var cameraPosition = Camera.position;
             PROFILE("getMultipleProperties", function () {
                 var multipleProperties = Entities.getMultipleEntityProperties(ids, ['name', 'type', 'locked',
-                    'visible', 'renderInfo', 'modelURL', 'materialURL', 'script']);
+                    'visible', 'renderInfo', 'modelURL', 'materialURL', 'script', 'certificateID']);
                 for (var i = 0; i < multipleProperties.length; i++) {
                     var properties = multipleProperties[i];
 
@@ -182,6 +182,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
                             url: url,
                             locked: properties.locked,
                             visible: properties.visible,
+                            certificateID: properties.certificateID,
                             verticesCount: (properties.renderInfo !== undefined ?
                                 valueIfDefined(properties.renderInfo.verticesCount) : ""),
                             texturesCount: (properties.renderInfo !== undefined ?