Is there jQuery,mentionsId edit option? - java

I am using mentions input jquery for my text area for mentioning names like facebook.
When I try to edit the mentioned text, already mentioned name changes to plaintext. How can I handle this?

Actually there is no such option, jQuery is a JavaScript Library, which you can implement for your own usage.
You cannot just ask jQuery to do your own work. You need to code it out!
When Facebook uses this feature, they actually try to use it like [userId:userName] which would be changed back to the Name and the Link to their profile.
I would ask you to do the same, when a user edit the names, replace that text fully. Don't just append it, just replace it as a whole. This way, the plaintext wouldn't be written and the mentionsId would have the new Name mentioned inside it.

Related

LeanFT to verify specific text is present

I need to verify that a specific string of text is present on webpage and check the number of occurences in LeanFT. I have tried code below to verify if text is present:
browser = BrowserFactory.launch(BrowserType.CHROME);
browser.getVisibleText().contains("Success");
I don't think getVisibleText on Browser is the best fit for the problem you're facing. AFAIK getVisibleText uses OCR and not the application's underlying technology.
A better way, I think, would be to identify the Web.Element that contains "Success". If you don't want to bother getting the specific element you can use the Page's text property.
I'm not familiar with LeanFT's Java SDK but in JavaScript it would be written like this:
expect(browser.$(Web.Page({})).text()).toContain("Success");
Edit: according to comments (thanks #Adelin), the Java equivalent is:
browser.getPage().getText().contains("Success");

how do I invert the display order in item-view in DSpace?

I wanted to invert the page of the display order of "item-view" in dspace think this table page is harmful to the user. I wanted to make the downloadable files were shown above the table. Which parameters should I change?
Your question did not specify which version of DSpace you are running. I assume you are using XMLUI since you tagged the question with xslt. Here is a solution referencing the Mirage theme in DSpace 5.x. (If my assumptions are incorrect, please update your question.)
The following code is used to display an item.
These lines display the metadata.
https://github.com/DSpace/DSpace/blob/dspace-5_x/dspace-xmlui/src/main/webapp/themes/Mirage/lib/xsl/aspect/artifactbrowser/item-view.xsl#L50-L52
These lines display the file objects.
https://github.com/DSpace/DSpace/blob/dspace-5_x/dspace-xmlui/src/main/webapp/themes/Mirage/lib/xsl/aspect/artifactbrowser/item-view.xsl#L54-L83
A simple first step would be to change the order of these calls in the xslt template.
The following page outlines how to customize XMLUI: https://wiki.duraspace.org/display/DSDOC5x/XMLUI+Configuration+and+Customization
Do you already have a custom theme? If so, override this template in your custom theme.
If not, you will want to read about XMLUI overlays. You will simply need to copy the files you wish to override into dspace/modules/xmlui/... and apply your changes there.

Edit browser's text field using java

Is it possible to edit browser's text field using java? Currently I'm using Jsoup to gather some information about websites so I'm looking for some more options.Could JSoup to this? Thank you!
I don't see how JSoup would help here. JSoup is just a way to parse html. You could use it to write out some html that has a text field in it with an input tag that has a value attribute on it. Then when you render the file in a browser, the page would have that value. But since you haven't given us very much information, I'm not sure if this is exactly what you want to do or completely different from what you want to do.
This is probably the last thing you'd want to do (not the first), but you could set the values of a text field using Java's Robot class.

Showing Suggestions below text field taking values from database

I am having a form. I want to show user suggestions about the name of the security he can enter. For the same I want to use the values of securities that I have installed in my Oracle Database.
I want to do something like this, if user enters a, he should get all security names below the text field which starts from a, when user selects anyone of them, then the text field must show the selected values.
Thanks in Advance.
You need autocomplete enabled text field. There's a tutorial how to build one. Even better, use jQuery java script library for this and many other features.
I'd suggest a trie. They are great for things like predicive text and auto complete.
Get all the valid security names and put them into the trie, then query the trie with whatever prefix the use has entered and it will give you all the matching names.
Note that Java doesn't come with a Trie implementation itself buy it would be pretty easy to write your own or borrow one, for eg from here; http://forums.sun.com/thread.jspa?threadID=5295936
Edit: You didn't say if this was going to be on the web or desktop (eg Swing)....

How can I take links from a user and display them in my page properly?

I am developing a Java project in which I will take the text from a user in a textArea and generate an HTML page with that text.
I want to allow the user to add links in the generated HTML Page. As I am taking the page contents from the user, I also need to take the link name and the URL from the user.
How can I provide this functionality?
This is a bit vague ...
You don't say if you also somehow know where in the text the links need to be generated. If you don't, your problem is not solvable.
If you do, then I guess you just need to add some logic that tests if the current location in the output stream somehow corresponds to one of the locations where there should be a link, and generate the link.
The syntax for a HTML link can be found wherever, and I would assume you know it already, but just to be complete it looks like this:
link to example.com
Replace the part inside the quotes with the reference, and the text between > and < with the link name.
You'll need a database to store the links. Unless you want to show them only once.
String links = request.getParameter("textArea_name");
// then save it on your prefered database
To show it you can then load it from the database and just output them.

Categories