- Posts: 119
COMMUNITY FORUM
Save items nicely for users
- juju
-
Topic Author
- Offline
- Premium Member
Less
More
14 years 4 weeks ago #95529
by juju
Save items nicely for users was created by juju
Hi everyone,
I apply modifications here by Hanny : community.getk2.org/forum/topics/k2-add-new-item-window-resize?xg_source=msg_com_forum&id=3536014%3ATopic%3A73456&page=16#comments
With that, when the user click on the save button, the pop-up box is closed and the page refresh.
But I would do a more friendly system for the users :
When they click on the save button, they would have a gif animation in the window while the article is saved, and when it's done, they would have a message who said them "Item send".
I want to do that because when you put an image and attachments, it's pretty long to saved the article, and I think the user will find the time long...
I know that I can display an alert like : alert( 'Item send' ) when the article was save, but how I can display a gif or a message while the article is saved ?
Thanks ;)
PS : Also, I have an other question to ask you, in form.php :
How I can have the category selected by the user in the drop box ? Because I have to customize the message to the user if he can publish or not ;)
So I wrote that code :
$user = &JFactory::getUser();if ($user->authorize('com_k2', 'publish', 'category', 'all') || $user->authorize('com_k2', 'publish', 'category', [Category])){ alert('Item published'); }else{
alert('Item send to an administrator');
}
But I need the if of the category :/
I apply modifications here by Hanny : community.getk2.org/forum/topics/k2-add-new-item-window-resize?xg_source=msg_com_forum&id=3536014%3ATopic%3A73456&page=16#comments
With that, when the user click on the save button, the pop-up box is closed and the page refresh.
But I would do a more friendly system for the users :
When they click on the save button, they would have a gif animation in the window while the article is saved, and when it's done, they would have a message who said them "Item send".
I want to do that because when you put an image and attachments, it's pretty long to saved the article, and I think the user will find the time long...
I know that I can display an alert like : alert( 'Item send' ) when the article was save, but how I can display a gif or a message while the article is saved ?
Thanks ;)
PS : Also, I have an other question to ask you, in form.php :
How I can have the category selected by the user in the drop box ? Because I have to customize the message to the user if he can publish or not ;)
So I wrote that code :
$user = &JFactory::getUser();if ($user->authorize('com_k2', 'publish', 'category', 'all') || $user->authorize('com_k2', 'publish', 'category', [Category])){ alert('Item published'); }else{
alert('Item send to an administrator');
}
But I need the if of the category :/
Please Log in or Create an account to join the conversation.
- juju
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 119
14 years 4 weeks ago #95530
by juju
Replied by juju on topic Save items nicely for users
With this code, I don't know why, but I have an alert with an error "Calendar.setup" , how I can fix it ?
Here is the code :
<?php if (JRequest::getInt('step')=='1') { ?> <script language="javascript"> var XHRCheckin = new Ajax('index.php?option=com_k2&view=item&task=checkin&cid=<?php echo $this->row->id; ?>', { method: 'post' }); dummy = $time() + $random(0, 100); XHRCheckin.request("t"+dummy); parent.$('sbox-window').close(); var urlredirecttest='index.php?option=com_k2&view=item&id=<?php echo $this->row->id; ?>'; <?php $user = &JFactory::getUser(); $db = & JFactory::getDBO(); $query = "SELECT * FROM #__k2_users WHERE userID=".(int)$user->id; $db->setQuery($query, 0, 1); $profile = $db->loadObject(); require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'permissions'.'.php'); if (K2HelperPermissions::canPublishItem($this->row->catid)) { ?> alert('Votre article a été publié sur le site, cliquez sur ok pour voir votre article.'); window.parent.location.replace(urlredirecttest); <?php }else{ ?> alert('Votre article a été envoyé à un administrateur, il sera publié après vérification.'); window.parent.location.reload();<?php } ?> </script> <?php } ?>
Here is the code :
<?php if (JRequest::getInt('step')=='1') { ?> <script language="javascript"> var XHRCheckin = new Ajax('index.php?option=com_k2&view=item&task=checkin&cid=<?php echo $this->row->id; ?>', { method: 'post' }); dummy = $time() + $random(0, 100); XHRCheckin.request("t"+dummy); parent.$('sbox-window').close(); var urlredirecttest='index.php?option=com_k2&view=item&id=<?php echo $this->row->id; ?>'; <?php $user = &JFactory::getUser(); $db = & JFactory::getDBO(); $query = "SELECT * FROM #__k2_users WHERE userID=".(int)$user->id; $db->setQuery($query, 0, 1); $profile = $db->loadObject(); require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'permissions'.'.php'); if (K2HelperPermissions::canPublishItem($this->row->catid)) { ?> alert('Votre article a été publié sur le site, cliquez sur ok pour voir votre article.'); window.parent.location.replace(urlredirecttest); <?php }else{ ?> alert('Votre article a été envoyé à un administrateur, il sera publié après vérification.'); window.parent.location.reload();<?php } ?> </script> <?php } ?>
Please Log in or Create an account to join the conversation.