Author: mj
Date: Sun Oct 16 19:55:13 2011
New Revision: 10121
Log:
Add rudimentary JS confirmation to search/replace for safety.
Modified:
trunk/apps/qubit/modules/search/actions/globalReplaceAction.class.php
trunk/apps/qubit/modules/search/templates/globalReplaceSuccess.php
Modified: trunk/apps/qubit/modules/search/actions/globalReplaceAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/search/actions/globalReplaceAction.class.php
Sun Oct 16 16:01:39 2011 (r10120)
+++ trunk/apps/qubit/modules/search/actions/globalReplaceAction.class.php
Sun Oct 16 19:55:13 2011 (r10121)
@@ -95,9 +95,6 @@
$this->form->setValidator('replacement', new sfValidatorString);
$this->form->setWidget('replacement', new sfWidgetFormInput);
- // TODO
- // FIXME
- $this->form->setDefault('caseSensitive', true);
$this->form->setValidator('caseSensitive', new sfValidatorBoolean);
$this->form->setWidget('caseSensitive', new
sfWidgetFormInputCheckbox(array(), array('value' => 1)));
Modified: trunk/apps/qubit/modules/search/templates/globalReplaceSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/globalReplaceSuccess.php Sun Oct
16 16:01:39 2011 (r10120)
+++ trunk/apps/qubit/modules/search/templates/globalReplaceSuccess.php Sun Oct
16 19:55:13 2011 (r10121)
@@ -45,7 +45,7 @@
<input type="submit" name="Submit" class="form-submit" value="<?php
echo __('Search') ?>" />
<?php if (isset($pager)): ?>
- <li><a class="delete" href="#" title="<?php echo __('Replace') ?>"
onclick="document.form.method = 'post'; document.form.submit();"><?php echo
__('Replace') ?></a></li>
+ <li><a class="delete" href="#" title="<?php echo __('Replace') ?>"
id="confirmReplace"><?php echo __('Replace') ?></a></li>
<?php endif; ?>
</ul>
@@ -70,3 +70,28 @@
<?php echo get_partial('default/pager', array('pager' => $pager)) ?>
<?php endif; ?>
+
+<script type="text/javascript">
+//<![CDATA[
+Drupal.behaviors.confirmReplaceDialog = {
+ attach: function (context)
+ {
+ (function ($)
+ {
+ // FIXME: replace this with a jquery confirm modal
+ $('#confirmReplace').click(function ()
+ {
+ var conf = confirm('Are you sure you wish to perform this
search/replace? This action CANNOT be undone.');
+ if (conf)
+ {
+ document.form.method = 'post';
+ document.form.submit();
+ }
+ });
+
+ })(jQuery)
+ }
+}
+
+//]]>
+</script>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.