DNN jQuery conflict - pop up window won't close - jquery-ui

I'm working on a DNN site that has been set up before my time here.
There's some conflict with the jQuery I believe, which prevents the modal pop up window in the attached calendar (link) events to not close properly:
http://www.sim-one.ca/NewsandEvents/calendar-of-events.aspx
I tried eliminating one script call at a time to see which one could be messing this up to no avail.
When I test this with the default theme it works like a charm.
Any ideas? Anyone came across something like this before?
Thank you!

You've got plenty of 404 errors on that page, ensure first, that files are in their place.
For example, http://www.sim-one.ca/NewsandEvents/Portals/_default/Skins/SimTwo/includes/js/jquery.listnav-2.1.js was not found. Ensure this path exists.

I agree with Anrie that your references are broken. For example, http://www.sim-one.ca/NewsandEvents/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css is showing 404 but http://www.sim-one.ca/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css
You can just use links like :
/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css in order to fix this in skin file or use <%= SkinPath %>.

Try adding return false; on your event after calling the dnnModal.show()

Related

Capybara: Finding a second checkbox which is identical to the first

I am writing tests for view files. I have a page with two checkboxes which allows the user to Select All items in two different lists. However, the checkboxes are part of a partial so are identical. I have managed to check the first one using:
first(:checkbox, "Select all").click
But I am unable to check the second. I have tried replacing first with last and with second but to no avail.
I think I may need to use the find selector but am struggling with that also. Any help much appreciated.
Thanks
UPDATE
It appears that this in fact another issue. I think that any checkbox that impacts on other checkboxes does not work as expected when "checked" by Capybara. So the current answers below work in the sense that they do check the checkbox, but the expected behaviour does not occur i.e. the checkboxes linked to them do not get "checked". I may be wrong though.
try this
# find the second checkbox
find('input[type="checkbox"]:nth-child(2)').click
You can use find all
all('input[type="checkbox"]', :text => 'Select all')[1].click
Whoops. Turns out it was a JS issue and not Capybara macthers! Thanks for the help though!

How do I link to a LABEL in org-mode?

In org-mode, I have defined a figure+caption like this:
#+CAPTION: My great figure
#+LABEL: fig:myfigure
[[myfigure.png]]
How do I write "See figure [myfigure]"? I've found the following syntax:
See figure \ref{fig:myfigure}
but this looks ugly in the source file. In particular, you cannot use it for actually jumping to the figure.
You actually don't need '#+NAME', it works fine if you use '#+LABEL', which won't break your short-caption for list of figures.
Orgmode does now offer a 'jumpable', enumerated or link with name of your choice in the exported (latex, html) text if you link with:
see figure [[fig:myfigure]].
or
see figure [[fig:myfigure][figurenameintext]].
I would have added this as a comment, but I don't have the reputation yet.
--
In response to your comment (still can't comment): you do need the '#+NAME' for it to jump within the .org source file; as mentioned in the manual, and i also just confirmed that works. Not sure about the short-captions in the latest version.
With a very recent org-mode, you can use #+name:, see:
http://thread.gmane.org/gmane.emacs.orgmode/62644/focus=62646
#+CAPTION: My great figure
#+LABEL: fig:myfigure
#+name: fig:myfigure
[[test.png]]
See figure [[fig:myfigure][test]].
This works for me to jump from the link , but has no effect when exporting, I'm afraid...

How to fill tinymce-rails editor with capybara and selenium?

I have trouble with using capybara to test tinymce form. I'm using tinymce-rails and have 7 editors in my form. Also I'm using asciimath plugin with tinymce.
Everything works fine, but I'm unable to write tests to fill in tinymce editor.
Here is how my step definition code looks like, very similar to what is described here:
within_frame("content_ifr") do
editor = page.find_by_id('tinymce')
editor.native.send_keys 'test'
end
The problem is when I run the following:
editor.native.clear # works, clear the editor area, I'm testing this with pry
editor.native.send_keys :tab # works, moves focus to next input
editor.native.send_keys 'test' # returns "", nothing happens, nothing in editor
So clear and send_keys :tab work as expected. But I can't send any string. send_keys function is always returning empty string, and nothing happens when I do test using pry.
What is going wrong here? and how can I debug / investigate the problem?
Thanks.
I know that this is an old question but I just found it while trying to solve this issue as well.
Although the original question said that he has 7 tinymce's on the same page I think that my solution might work for him too but I do know it will work if there is one tinymce as was my case.
In my request spec I used this:
page.execute_script('$(tinymce.editors[0].setContent("my content here"))')
The page.execute_script with tell it to run the jQuery function. It then finds the first tincymce editor and sets the content.
Worked like a charm for me. I think if there are more than one tinymce it can be called by its position.
Switching to chrome as described here solved my problem.
Obviously the problem is related with a bug in firefox driver.
Still i think it is a valid question for firefox.
Try to switch to an iframe that contains tinymce textarea input, and than send_keys:
# +session+ is an instance of Capybara::Session class
browser = session.driver.browser
browser.switch_to.frame(iframe_id)
editor.native.send_keys(text)
browser.switch_to.default_content
I had the same issue. After a day fighting, my tests finally passed.
The code that I am using is:
within_frame("producto_condiciones_ifr") do
editor = page.find_by_id('tinymce')
editor.native.send_keys 'filling text'
end
The first line is a method of capybara. The parameter passed is the ID of the iframe.
Line #2 is a must.
In line #3 goes the text that you wish to place inside TinyMCE
just came across this problem with RoR and rspec
I managed to solve by doing this:
within_frame { page.find_by_id("tinymce").set("new content here") }
the set method will replace any existing content by the new one
if you want to keep the current content and add things to it, use the send_keys method

Symfony 1.4 and global variables

I've got a very old php application (1999) that has been worked on during the last ten years. At this point the app starts to show it's age so i'm in te progress of migrating to a "new" framework, symfony 1.4. But since the app is very large, i cannot do this at once. So i'm planning to wrap the old app into the new symfony app, and convert functionality by functionality.
First step in this transition was making the old app appear in the new symfony app. So, i've created the "frontend" application, added a "legacy" module, made it the default homepage, and i've put everyhting i had in my index.php (all pages went through this index.php) in the indexSuccess.php file for the indexAction. I've added the code in the "view" because there are also functions in it and changing that setup would take me more time than i want to spend on the old app.
Unfortunately i've now got an issue with global variables. Let me give you an example (i would have never made this register function like this, but it is, so please look past that.
$session = new ps_session;
$demo = "this is a demo variable";
$session->register('demo');
In ps_session i have this method
public function register($var) {
global $$var;
$_SESSION [$var] = $$var;
}
So it should put the content of $demo in a session var named "demo". Clever right :) Anyway, var_dumping shows me the that $$var is "null" and $demo is filled if i var_dump before and after calling the function. Exact same code without symfony and it returns the correct content.
What am i missing? The global call is spread out in all area's of this massive app so i really don't want to switch to something else, so i'm hoping for a quick fix :)
Maybe relevant, the all code except the index.php content are in frontend/lib/legacy/ folder, the index is in frontend/modules/legacy/ (if there is some scope issue i'm missing)
I think that since your indexSuccess.php file is included inside a function (more precisely, here : lib/vendor/symfony/lib/view/sfPHPView.class.php:185 ), this can't work, because $demo is no longer in the global scope. I don't see any easy workaround for this...
I think you should create a legacy folder in /web , and use routing to redirect to it if the url corresponds to something not migrated yet.
I went with putting the entire old site under web/legacy and redirecting from the default index action to the legacy folder. Most of the url's were made by mod_rewrite so easily fixed. The other url's went through a function so fixing was ok, and only a few were hardcoded. To make it totally transparant, i only need to redo the homepage to start from, so i don't have a visible /legacy/ in my url. Thanks for the help!
I agree with greg0ire that this is an issue with the way sfPHPView includes indexSuccess.
Could you simply require index.php in the default/index action?

Save Conflict Error when trying to add new List Items at the time of list creation

We have created a Custom List template programmatically using Feature.xml, Element.xml, Schema.xml AllItems.aspx, and 3 aspx forms. We have a code behind file for each of these aspx files. i.e. for the AllItems.aspx, DispForm.aspx, EditForm.aspx and NewForm.aspx.
Problematic file is AllItems.aspx. In the code behind for AllItems.aspx file we are deleting previous list items and adding new items to the list before showing them up to the user. As per expectations the code behind file for AllItems.aspx is derived from WebPartPage Class and we have tried to overload quite a few methods without much success.
Problem only occurs on the first time rendering i.e. when an instance of this list is created. When overriding OnLoad(), we get the Save conflict error, Similar is the case with OnInit(), CreateChildControls() method. However, when we override the Render() or RenderChildren() method no such error comes up but at the same time our new list items are also not visible. On browser refresh everything starts working fine as expected. It is only for the first time that the issue comes up.
What could be the possible cause for this? Any ideas, suggestions would be highly appreciated.
Best Regards,
Raghu
I had a problem with a custom EditForm.aspx. I have two lists that are linked together and a change in one causes an event handler to update the other. I have a custom control in EditForm.aspx that edits the linked list. This was causing the event handler to update the item displayed by EditForm.aspx. This in turn would cause the conflict error when the user saved the form.
I finally found that I could reset the context with:
SPContext.Current.ResetItem();
I am not sure if this will help in your case but it fixed my problem.

Resources