Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.

DISCLAIMER

All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.

Cireson does not and will not support or maintain these enhancements, extensions, and scripts.

For Team Cireson uploads click here.

Portal Task - Enable "Google It"

Adam_DzyackyAdam_Dzyacky Customer Contributor Monkey ✭✭✭✭✭
This is a really simple JS that's heavily borrowed from Cireson's KA on the matter, but instead of taking you to a search engine...

I wanted Incidents to feature a "Google It" task that would pop a box, allow some input, and then do a Google search based on what was provided in said box. While you could get fancy and potentially pull the Title/Description - i found more times than not analysts are changing their search any way and business specific functions wouldn't make must sense in a Google search. The following JS hides Google It from End Users (because that probably wouldn't be received too well :wink:) and places it on Incident forms for analysts.

I suppose if I took this to what I'd say is it's logical extreme you could privately comment the Action Log so the analyst would be able to reference their previous search criteria.

HTML file (googleIt.html) -
<div>
<div id="commentHTML" class="form-horiztontal">
<div>
<div class="col-group">
<div class="inline-spacing">
<label>What do you want to search?</label>
</div>
<div class="inline-spacing">
<textarea data-bind="value: comment, events: {keyup:textCounter}"
data-value-update="keyup"
class="k-textbox"
rows="7" ></textarea>
<div class="inline-spacing">
<span data-bind="html:charactersRemaining"></span>
<span>characters remaining</span>
</div>
</div>
<div class="window-buttons">
<button data-role="button"
class="btn btn-primary"
data-bind="enabled: okEnabled, events: { click: okClick }">
OK
</button>
<button data-role="button"
class="btn btn-primary"
data-bind="events: { click: cancelClick }">
Cancel
</button>
</div>
</div>
</div>
</div>


custom.js additions -
//Hide "Google It" from End Users
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) { formObj.boundReady(function () 
{ if (!session.user.Analyst) { $( ".taskmenu li:contains('Google It')" ).hide() } }); }); 

//"Google It" for Incidents
app.custom.formTasks.add('Incident', "Google It", function (formObj, viewModel) { 
console.log(formObj); 
//use requirejs to load the template first 
require(["text!/CustomSpace/googleIt.html"], function (template) { 
//make a jQuery obj 
cont = $(template); 
//create a view model to handle the UX 
var _vmWindow = new kendo.observable({ 
comment: "", 
okEnabled: false, 
charactersRemaining: "4000", 
textCounter: function () { 
var maximumLength = 4000; 
var val = this.comment.length; 
(val > maximumLength) ? this.comment.substring(0, maximumLength) : this.set("charactersRemaining", maximumLength - val); 
(val > 0) ? this.set("okEnabled", true) : this.set("okEnabled", false); 
},
googleIt: function () {
var searchQuery = this.get("comment");
var searchURL = googleURL.concat(searchQuery);
var newGoogleSearch = window.open(searchURL, '_blank');
win.focus(); 
return;
},
okClick: function () { 
customWindow.close();
this.googleIt();
}, 
cancelClick: function () { 
customWindow.close(); 
}
}); 
//create the kendo window 
customWindow = cont.kendoWindow({ 
title: "Google It", 
resizable: false, 
modal: true, 
viewable: false, 
width: 500, 
height: 300, 
close: function () { }, 
activate: function () { 
//on window activate bind the view model to the loaded template content 
kendo.bind(cont, _vmWindow); 
}).data("kendoWindow"); 
//now open the window 
customWindow.open().center(); 
}); 
});

Comments

  • Joe_BurrowsJoe_Burrows Cireson Devops Super IT Monkey ✭✭✭✭✭
    I like it! @Steve_Wright we need this ;) 
  • Dakota_GreenDakota_Green Member Advanced IT Monkey ✭✭✭
    I like this a lot as well. It does save a bit of time, and helps with finding a solution or a resolution. Good stuff Adam!
  • Thanks for Sharing this! Moving to the new "Community Uploads" Category for better viability and to help anyone else wanting to implement \ learn :)
Sign In or Register to comment.