Posted by moosh101 on October 10, 2010 at 6:40pm
9 followers
| Project: | Facebook-style Statuses (Microblog) |
| Version: | 6.x-3.x-dev |
| Component: | Code - Functionality |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi.
I would like to use ajax when deleting a status message, as opposed to being redirected to a confirmation page. Or at least, just have the status message deleted when a user clicks delete. Would this be possible to implement using views?
I sincerely appreciate any advice you can offer and thanks for sharing the module with us.
Kind regards,
Shane.
Comments
#1
Doing AJAX deletion securely is extremely difficult. I'm not adding new features to the 2.x branch and this is not a priority for the 3.x branch.
I am planning to support the ModalFrame module in the 3.x branch, which will make it possible to show the delete confirmation page in an AJAX modal dialog. I'm not planning to add in-place bubbles or anything like that.
#2
Wicked stuff ice. Double plus bump.
#3
Ice have you got an indication of when 3.x will be somewhat active and able to do live sites? There are so many places where i would love to see modalframe come in action for facebook_statusses. Reply, views conversation, delete etc etc.
#4
http://drupal.org/node/576278#comment-3486878
#5
Anything changed in the couple of days between posts? ;-)
I can do some work to make modalframe work with 2.x no problem. I allready got it working with quite some more modules. If you are interested i can post the work done here.
#6
If you post a patch against 2.x-dev I will probably commit it.
#7
Hi all,
Very interesting comments. Version 3 sounds really good. Also, would it be possible to integrate some kind of user privacy options? For example, allow users to choose who can view their statuses, public, self, or friends (using the relationships module). This option could be available in user account settings.
I would be very keen to learn how Iasac got modalframe working with FBSS 2.0, as this is what I would like to achieve, if only for a delete popup. It would be good if you could share your techniques :-)
Thanks everyone,
Shane.
#8
One topic per issue, please.
Also please only assign issues to yourself if you intend to work on a patch to resolve them.
#9
@#7: This is basically the whole javascript.
(function ($) {
Drupal.behaviors.modals = function(context) {
$('#messaging', context).addClass('modalframe-message-processed').each(function() {
$(this).parent().prepend('<div class="modalframe-modals-messages" style="display:none;"></div>');
});
// Create an element to dynamically render status messages.
var modalsConfigurationClick = function(action, url, refreshAfterSubmit) {
// Hide status messages before opening the modal frame.
$('.modalframe-modals-messages').hide();
if (refreshAfterSubmit) {
url += (url.indexOf('?') == -1 ? '?' : '&') +'refresh=1';
}
var onSubmitCallback = function(args, statusMessages) {
if (args && args.submitted) {
// Render new status messages, if any.
if (statusMessages && statusMessages.length) {
$('.modalframe-modals-messages').html(statusMessages).show('fast');
window.scrollTo(0, 0);
}
if (refreshAfterSubmit) {
window.scrollTo(0, 0);
setTimeout(function() { window.location.reload(); }, 1500);
}
}
};
var modalFrameOptions = {
url: url,
width: 800,
height: 200,
draggable: false,
//customDialogOptions: (modalFrameOptions.height = 100),
onSubmit: onSubmitCallback
};
Drupal.modalFrame.open(modalFrameOptions);
return false;
};
//modalize facebook status react
$('a.facebook_status_conversation_link ', context).not('.modalframe-processed').attr('href', function() {
return this.href + '&modal=1'
}).addClass('use-modal').click(function(){
var $link = $(this), url = $link.attr('href');
return modalsConfigurationClick('', url, true);
});
};
})(jQuery)
And your php
<?php
function modals_init() {
drupal_add_js(drupal_get_path('module', 'modals') .'/assets/modals.js');
if(!isset($_GET['modal'])){
modalframe_parent_js();
} else{
modalframe_child_js();
//modalframe_close_dialog($args);
}
}
/**
* Implementation of hook_form_alter().
*/
function modals_form_alter(&$form, $form_state, $form_id) {
if(isset($_GET['modal'])){
if ($form_id == 'user_login' || $form_id == 'user_register' || $form_id == 'user_relationships_ui_request' || $form_id == 'flag_confirm' || $form_id == 'user_relationships_ui_pending_requested') {
$form['#submit'][] = 'modals_child_form_submit';
//print 'testing';
//dvr($form);
// remove cancle links
if( $form_id == 'flag_confirm' || $form_id == 'user_relationships_ui_pending_requested' || $form_id == 'user_relationships_ui_request'){
unset($form['actions']['cancel']);
}
}
if ($form_id == 'privatemsg_new') {
$form['privatemsg']['submit']['#submit'][] = 'modals_child_form_submit';
}
}
}
/**
* Process the block settings or block delete forms.
*/
function modals_child_form_submit($form, &$form_state) {
$modalframe_args = array(
'submitted' => TRUE,
);
modalframe_close_dialog($modalframe_args);
}
The php side has some other form_id's in it because i use modalframe on multiple places, but above should help you. But you will have to tweak it for your own use.
Privacy thing, i completely agree, but you should make a new issue for that and not place it here.
#10
mm dont know why it changed the assigned to option.
#11
Hi Iasac,
Did you put your code from #9 in a custom module? I'm not a very good module programmer so if you could provide just a bit more guidance that would be super appreciated.
Best,
Thomas
#12
Hi Iasac,
I would also like to request a custom module using the code in #9, or at lease could you please describe how to implement your code?
I sincerely appreciate all your time and support.
Many thanks,
Shane.
#13
Subscribe
#14
I put it in a own module,yes. Search how to make your own module call it modals and use the code
#15
#14 @lasac - I am a beginner, you can explain this more as they have done. Unfortunately I can not create your own modules. Sorry for my bad english. regards
#16
Hey fugazi,
I'll try assembling this into a module and attaching it in a zip file for everyone else sometime today.
#17
ohh that would be great ... many thanks
#18
subscribe
#19
If you have this module assembled could you send it to me also please?
thanks
#20
Hi, here's the module made from Iasac's code in #9. I can't seem to get this to work. Any help would be much appreciated. I've checked to see if the javascript is being attached by the module via firebug and it seems to be. Beyond that my debugging skills are limited - sorry.
#21
wow i didn't know this issue was a roadmap blocker. I'll dive in to this as soon as i can.
#22
subscribe
#23
So it turns out there is a related issue for the comments submodule and I went to solve that one and wasn't paying attention and added Modal Frame integration for the main module instead. There is still a bug in that for some reason submitting the edit-status form doesn't force the modal frame to close; however, this can be addressed in a new issue. (The delete process works well.)
(Also, only committing new features to 3.x.)
#24
Automatically closed -- issue fixed for 2 weeks with no activity.
#25
#20
enabled modals module but This module is not working...
the delete confirm form loads in separate page.
#26
Open a support request, please don't spam a closed issue.