Any way to easily close all built-up search tabs at once in Komodo Edit 9.3? - komodo

The Komodo Edit 9.3 update notes include a line that says:
"Multiple Find Result Tabs: Every search now opens in its own result tab, you are no longer limited to 2 tabs. Find results now also show a new input field that allow you to search again with the same input but a different search pattern."
It's nice having more than two sets of search results at a time, but is there any easy way to clear all of the current search result tabs at once? I find myself having to either close the tabs as soon as I'm done with them or having to click over and over to close all of the ones that have gathered over time. Hopefully there's an easy "close all" way that I missed! I've searched around a bit and didn't find any help. Thanks!

This is currently not possible through native functionality in Komodo. An enhancement request has been opened here: https://github.com/Komodo/KomodoEdit/issues/849
You could however use a userscript to add this functionality yourself:
var items = ko.widgets._widgets.listitems();
for (let item of items)
{
let [name, widget] = item;
if (name.indexOf("findresults") !== 0) continue;
let tab = widget.browser.parentNode.tab;
tab.dispatchEvent(new Event("close-tab"));
}
Taken from: http://forum.komodoide.com/t/komodo-9-3-pre-release-what-do-you-like-what-dont-you-like/2118/29?u=nathanr

Related

How to select an option from a dropdown list using chromeless API?

I am using chromeless API (https://github.com/graphcool/chromeless)
How can I select an option from a dropdown list?
Specifically I want to select last option having value="other".
My HTML is:
You could achieve this with the evaluate() method which lets you evaluate any Javascript within the browser-context of any page you load:
await chromeless
.goto('http://yourwebsite.com/yourpage')
.evaluate(() => {
select = document.querySelector('select.decline-form-select')
select.value = 'other'
})
Or, specifically select whatever the last item is in the select list:
await chromeless
.goto('http://yourwebsite.com/yourpage')
.evaluate(() => {
document.querySelector('select.decline-form-select option:last-child').selected = true
})
It can be done without the evaluate() method, too, albeit in a somewhat convoluted way. Avoiding evaluate() is useful when it is unknown exactly which events have to be triggered upon change, for the web application to work.
await chromeless
.click('#the-select-element')
.type('First characters of description text of desired option', '#the-select-element')
.click('#the-select-element option[value="the-matching-value"]')
Or using the example posted in the question:
await chromeless
.click('select.decline-form-select')
.type('Oth', 'select.decline-form-select')
.click('select.decline-form-select option[value="other"]')
Selecting an option using native Chromeless commands involves first clicking the select element, then typing text to select the desired option, based on the visible text content of the option (the first few characters that unambiguously identify the option should be enough), and then clicking the desired option element. Since it is not possible to find the option element by text content using css selectors, the element must be selected by some other means – e.g. value or ordinal number.
Sending arrow key presses instead of typing characters to select the option might work, but I found in my testing that using the press() method was buggy. (A tab with Chrome settings would open randomly while executing tests that used press() to send either the return or the space key.)
All this said, I was unable to make tests run reliably with Chromeless. There seemed to be problems related to scrolling elements into view or not. While the webdriver-based systems http://webdriver.io, http://nightwatchjs.org and https://www.npmjs.com/package/selenium-webdriver are a bit more complicated to set up and code for, it might be worth the effort in order to get better reliability.

How to create a NotesRichtext item that is computed for display?

I know this is a common problem, and I tried a few solutions already, but the problem I have right now with my current code is that even though the attachments show in the computed for display field, I get the error "Note Item not Found" when I try to open them.
The form is built with two fields, in a programmable table that displays the editable one or the computed for display one.
The trick I found with Google's help was to delete the computed for display item in the queryopen event, so Notes regenerates the cfd item when opening the document. Visually, this works, as I see the text and attachments, but the attachments can't be opened.
Here is the code that removes the item in the QueryOpen of the form:
...
Set item = doc.GetFirstItem("dspDescription")
If Not item Is Nothing Then Call item.Remove()
...
Has anyone successfully achieved that functionality? Is there another way of doing this? I already tried with subforms, and because of the way the application is built, I need to be able to switch from editable to read only on the flick of a radio button, so subforms are out of the question as they can't be displayed dynamically.
Why don't you simple put the richtext item in a controlled access section and make that section editable / not editable with a computed for display formula. Select "always expand" and hide the section title, so that nobody can collapse it, et voila.
Regarding your comment: With this properties:
for this section in designer:
You get this result:
You see: No twisty, no "visible" section

limit number of characters entered in cognos search and select prompt

limit number of characters entered in cognos search and select prompt
`The below script works for text box.
<script>
// The ASDF here comes from the Name property of the prompt
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() :
document.forms["formWarpRequest"]);
fW._textEditBoxASDF.maxLength = 3;
</script>`
I need a similiar piece of code to work with Search and select prompt.
I don't have cognos in front of me but let me tell you how i did stuff like this with Javascript. Please read entirely as there are several approaches.
Put a uniquely named/id DIV tag around your native Cognos select and search prompt(The one your typing in. This will make it easy to reference with Java's dom model for the next steps. We will eventually make this default search prompt invisible/hidden but for now keep it visible until the following steps are coded/debugged.
Create an HTML control in the simliar style as the native Select and search with the proper max-length settings that you want. Use the text box on change event to update the native Cognos select and search prompt. for debugging troubleshooting i find it handy to have javascript alert the DIV innerHTML so you can see whats under the hood with the Cognos control. Sometimes i uses this innerHTML as the starting point for my "Cloned/Shadow" HTML prompt that i have control over.
Once you have your new HTML control effectively changing the Cognos control you can make it invisible.
On complex dashboards/scorecarding i wrote routines to clone cognos prompts and expose their HTML so i could create my own control that would quietly manipulate the actual hidden controls. This gave me complete control over presentation and functionality.
There are many variations on this once you have the controls innerhtml like replacing the innerHTML with one of your own immediately after the page loads that has the restrictions on length. Or simply seeing if you can massage the property learning from the innerhtml.
In Cognos 8.4 and 10 there is a new method to dynamically add a method to a control to be called prior to any other methods. It is tricky but it is on IBM's web site. I may be more cleanly implemented in 10 and also IBM is not shy about showing off these solutions on their web site.

Sharepoint links - how to open in new tab/Window

I've noticed with Sharepoint 2010, many of the links do not the support open in new tab/window feature. For example, items on the quick menu do not. Is it possible to enable?
Use the JavaScript function to open a new window in SharePoint 2010.
Create the function to open your target window as sample provide below.
function load_url(externallink)
{
window.open(externallink,target='_blank')
}
Place the function load_url in JavaScript file
Click site actions, select manage content and structure.
Suppose you want to change the links in the page
http://someserver/sites/Dev/Help/HelpLinks/AllItems.aspx
Then select the List named HelpLinks in the sub site Help. Dev will be the top most node(site). Help will be a sub site and inside Help you can find List by name HelpLinks.
All the links in the page and their title will be displayed
Select the title of link which you want to open in new tab and right click.
Select Edit properties. Then in the URL field and call the function as javascript:load_url('http://www.google.co.in'); instead of http:// www.google.co.in
Or Else
Suppose you want to change the links in the below URL.
URL: http:// someserver/sites/Dev/Help/HelpLinks/AllItems.aspx
Go To
open to the link http:// someserver/sites/Dev/Help/HelpLinks/AllItems.aspx
You will find the columns of the List (Title Column, URL column, Summary etc).
Select the Title and click Edit property which you want to edit
Then in the URL field and call the function as javascript:load_url('http://www.google.co.in'); instead of http:// www.google.co.in
This answer is a recap of this article and is not an answer I came up with: http://sharepointsolutions.blogspot.com/2007/09/make-selected-links-in-links-list-open.html
Step 1: Add #openinnewwindow to the end of all hyperlinks you want to open in new window.
Step 2: Then you will need to add the follow script to your SharePoint pages.
[script language = "JavaScript"]
//add an entry to the _spBodyOnLoadFunctionNames array
//so that our function will run on the pageLoad event
_spBodyOnLoadFunctionNames.push("rewriteLinks");
function rewriteLinks() {
//create an array to store all the anchor elements in the page
var anchors = document.getElementsByTagName("a");
//loop through the array
for (var x = 0; x < anchors.length; x++) {
//does this anchor element contain #openinnewwindow?
if (anchors[x].outerHTML.indexOf('#openinnewwindow') > 0) {
//store the HTML for this anchor element
oldText = anchors[x].outerHTML;
//rewrite the URL to remove our test text and add a target instead
newText = oldText.replace(/#openinnewwindow/, '" target="_blank');
//write the HTML back to the browser
anchors[x].outerHTML = newText;
}
}
}
[/script]
Whats the 'Quick menu'? Do mean list item context menu or something else? Can you post a screenshot?
There are two types of links used.
Normal HTML anchors - You can hold down the CTRL key when clicking.
JavaScript links (menus and such) the CTRL key doesn't work. If you're working with the Edit/View forms then this may be of interest
SharePoint - Editing The SharePoint List Item Menu
Especially look for Part II where it talks about changing this behaviour in List Settings > Advanced Settings > Dialogs
This is actually an Internet Explorer specific bug. The navigation links in SharePoint 2010 are regular links but have two nested span tags around the text of the link. This confuses IE which doesn't realise that the text you are right-clicking up is a link and so doesn't give the correct context menu. If you right-click just to the left of the text of the link (the cursor should still show as the "hand") the context menu appears as expected.
For Sharepoint 2013, I used Keith's code with a delayed call.
<script type="text/javascript">
// Add an entry to the _spBodyOnLoadFunctionNames array
// so that our function will run on the pageLoad event
_spBodyOnLoadFunctionNames.push("rewriteLinks");
function rewriteLinks() {
$('a').attr("target","_blank");
}
</script>
In the SharePoint Wiki Editor, you can click the "From Address" Link you added, and a LINK menu will appear in the ribbon bar. Inside that, you can click "Open in New Tab" It's not exactly New Window, but it's close and easy.
Add this to the end of the link.
#openinnewwindow
example: http://www.bing.com**#openinnewwindow

Drupal: re-selecting taxonomy terms in advanced search

I'm sure I'm not the first one to try to address this, but Google isn't doing me any good.
If you use the Advanced Search in Drupal to filter on taxonomy terms, the search form comes back with the term IDs in the keyword textbox like so:
search phrase category:32,33
The chosen values are NOT selected again in the taxonomy select box.
Instead of showing them in the keyword textbox, I would like them to be selected in the taxonomy select box - the way that any user would expect a form like this to act. I have been looking for a module that will add this functionality, to no avail. I have tried implementing hook_form_alter() to set the #default_value on that form element based on the previous form submission (available in the $form_state arg), but a) this seems kludgy and b) it seems that this function is called once to validate the form and again to re-display it, and the submitted value isn't available the second time (which is when it's needed).
Any suggestions?
It took much longer than it should have, but I finally figured out how to do this. I may release a module on the Drupal site later on, but in case anyone else has this same problem, this was the solution I came to.
Create a module and use hook_form_alter() to modify the form. I already had a module I was using to customize the advanced search, so I put it in there. I won't get into the detail of building your own module - you can find a simple tutorial for that, and you only need to define this one function.
/**
* Implementation of hook_form_alter().
* Remove 'category:x,y,z' from the keyword textbox and select them in the taxonomy terms list
*/
function modulename_form_alter(&$form, $form_state, $form_id) {
// Advanced node search form
if ($form_id == 'search_form' && $form['module']['#value'] == 'node' && user_access('use advanced search')) {
// Remove category:x,y,z from the keyword box
$searchPhrase = $form['basic']['inline']['keys']['#default_value'];
if(!empty($searchPhrase) && strpos($searchPhrase, 'category:') !== false) {
$searchWords = explode(' ', $form['basic']['inline']['keys']['#default_value']);
foreach($searchWords as $index=>$word) {
if(strpos($word, 'category:') === 0) {
// Use the value to set the default on the taxonomy search
$word = substr($word, strlen('category:'));
$form['advanced']['category']['#default_value'] = explode(',', $word);
// Remove it from the keyword textbox
unset($searchWords[$index]);
}
}
// Re-set the default value for the text box without the category: part
$form['basic']['inline']['keys']['#default_value'] = implode(' ', $searchWords);
}
}
}
Thanks for sharing this. After several drupal installations I am facing this problem now, too. However, this time I had to use some search extensions like search_config and search_files to meet the clients requirements. Furthermore, I'm using better_select which turns select lists into lists of checkboxes (easier to select mulitple values on long lists). Thus, the checkboxes always returned some value (either the id if selected or 0 (zero) if not selected) and I ended up with something like "search phrase category:0,0,0,0,...,0".
Your solution above indeed removes the "category:0,0,0,0,0,0,...,0" string from keyword search field and checks all taxonomy terms correctly. The same can be done for content types, you'll just have to replace "category:" by "type:" throughout the whole script.
Paul

Resources