diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index bfac2613b..b8f1beb72 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -20,6 +20,7 @@ - fixed: Import/Export of packages with international text is broken - fixed: CS rating links are exposed to site spiders - improved behavior of CS mail message filtering + - fixed: Thingy: "cancel" -- cannot cancel when adding a thing 7.5.8 - moved Gallery utility methods to WebGUI::Utility::Gallery diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index c47506e42..35bd9e6ff 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -1159,6 +1159,10 @@ sub www_editThing { $tab->raw('var hasSize = {'.join(", ",map {'"'.$_.'": true'} @hasSize).'};'); $tab->raw('var hasVertical = {'.join(", ",map {'"'.$_.'": true'} @hasVertical).'};'); $tab->raw('var hasValues = {'.join(", ",map {'"'.$_.'": true'} @hasValues).'};'); + if ($session->form->process("thingId") eq 'new'){ + $tab->raw("var newThingId = '$thingId';\n"); + $tab->raw("YAHOO.util.Event.onDOMReady(setCancelButton);\n"); + } $tab->raw(""); $tab->text( @@ -2092,6 +2096,7 @@ sub www_manage { $var->{canEditThings} = $self->canEdit; $var->{"addThing_url"} = $session->url->append($url, 'func=editThing;thingId=new'); + $var->{"manage_url"} = $session->url->append($url, 'func=manage'); #Get things in this Thingy $things = $self->session->db->read('select thingId, label, defaultView from Thingy_things ' diff --git a/www/extras/wobject/Thingy/thingy.js b/www/extras/wobject/Thingy/thingy.js index 02a6315d1..1d4c11d5b 100644 --- a/www/extras/wobject/Thingy/thingy.js +++ b/www/extras/wobject/Thingy/thingy.js @@ -1,3 +1,14 @@ +function setCancelButton () { + var cancelButtons = YAHOO.util.Dom.getElementsByClassName('backwardButton','input','application_workarea'); + function deleteTempThing () { + window.location.href = "?func=deleteThingConfirm;thingId="+newThingId; + } + for (var i = cancelButtons.length; i--; ) { + cancelButtons[i].onclick = deleteTempThing; + } +} + + function initOptionalFields(prefix,fieldId) { var fieldInThing_module_rendered;