diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index 4e166e263729413c2f14ee3f6a30dd13dbcd91a9..3bcbd79e3531c3e5300a744375345fff74b97289 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -193,6 +193,11 @@ var Lightbox = { if (typeof Recaptcha !== "undefined" && Recaptcha.widget) { Recaptcha.reload(); } + // If the lightbox isn't visible, fix that + if(this.shown == false) { + $('#modal').modal('show'); + this.shown = true; + } }, /***********************************/ diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index cb8e3613efb1839dd30ee0ec053bc590733a9cf3..fb9597b15a2d3cac0a8df77b457408de856dc7e8 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -114,28 +114,12 @@ function registerAjaxCommentRecord() { if (response.status == 'OK') { refreshCommentList(id, recordSource); $(form).find('textarea[name="comment"]').val(''); - } else if (response.status == 'NEED_AUTH') { - Lightbox.addCloseAction(function() { - $.ajax({ - type: 'POST', - url: url, - data: data, - dataType: 'json', - success:function() { - refreshCommentList(id, recordSource); - $(form).find('textarea[name="comment"]').val(''); - } - }); - }); - return Lightbox.get('Record', 'AddComment', data, data); + $(form).find('input[type="submit"]').button('loading'); } else { - $('#modal').find('.modal-body').html(response.data+'!'); - $('#modal').find('.modal-header h3').html('Error!'); - $('#modal').modal('show'); + Lightbox.displayError(response.data); } } }); - $(form).find('input[type="submit"]').button('loading'); return false; }); // Delete links diff --git a/themes/bootstrap3/templates/RecordTab/usercomments.phtml b/themes/bootstrap3/templates/RecordTab/usercomments.phtml index d5629c09c4b95bc07f0ab0fd805dc5eff336f334..f8d5c9d5f6512cecd5e1727682e018f4f13c9657 100644 --- a/themes/bootstrap3/templates/RecordTab/usercomments.phtml +++ b/themes/bootstrap3/templates/RecordTab/usercomments.phtml @@ -13,7 +13,13 @@ <strong><?=$this->transEsc("Your Comment")?></strong> </div> <div class="col-sm-9"> - <textarea id="comment" name="comment" class="form-control" rows="3" required></textarea><br/> - <input class="btn btn-primary" data-loading-text="<?=$this->transEsc('Submitting') ?>..." type="submit" value="<?=$this->transEsc("Add your comment")?>"/> + <? $user = $this->auth()->isLoggedIn() ?> + <? if($user): ?> + <textarea id="comment" name="comment" class="form-control" rows="3" required></textarea><br/> + <input class="btn btn-primary" data-loading-text="<?=$this->transEsc('Submitting') ?>..." type="submit" value="<?=$this->transEsc("Add your comment")?>"/> + <? else: ?> + <textarea id="comment" name="comment" class="form-control" rows="3" disabled></textarea><br/> + <input class="btn btn-primary" type="submit" value="<?=$this->transEsc("You must be logged in first")?>" disabled/> + <? endif; ?> </div> </form>