- Posts: 119
COMMUNITY FORUM
K2 Add new item window resize
- juju
-
- Offline
- Premium Member
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
I test with JS code, but I do something wrong and it doesn't work :/
Please Log in or Create an account to join the conversation.
- Hanny
-
- Offline
- Senior Member
- Posts: 48
That has to do with the calender functions in the form.php (around lines 818-828)
If you comment those out, or remove them the calender error goes away and you can redirect users wherever you'd like with the javascript. I haven't figured out a more clean way to do it unfortunately :( I think it would require some digging into the core joomla stuff in the calender code - but I am not 100%.
Please Log in or Create an account to join the conversation.
- Hanny
-
- Offline
- Senior Member
- Posts: 48
parent.$('sbox-window').close(); <?php $user = &JFactory::getUser($userID);?> parent.window.location="<?php echo (JRoute::_(K2HelperRoute::getUserRoute($user->id))); ?>"; <?php } ?> </script>
It's not 100% however, at least with my particular site. You guys can play with it and see if it works for you...
So - in summation - for me in form.php on lines 819-830 I now have this (calender bits commented out to get rid of the error):
<tr> <td align="right" class="key"><?php echo JText::_('Creation date'); ?></td> <td class="k2ItemFormDateField"><?php /*echo JHTML::_( 'calendar',$this->row->created, 'created', 'created', '%Y-%m-%d %H:%M:%S'); */ ?></td> </tr> <tr> <td align="right" class="key"><?php echo JText::_('Start publishing'); ?></td> <td class="k2ItemFormDateField"><?php /*echo JHTML::_( 'calendar',$this->row->publish_up, 'publish_up', 'publish_up', '%Y-%m-%d %H:%M:%S'); */ ?></td> </tr> <tr> <td align="right" class="key"><?php echo JText::_('Finish publishing'); ?></td> <td class="k2ItemFormDateField"><?php /* echo JHTML::_( 'calendar',$this->row->publish_down, 'publish_down', 'publish_down', '%Y-%m-%d %H:%M:%S'); */ ?></td> </tr>
And my redirect now reads like this:
parent.$('sbox-window').close(); <?php $user = &JFactory::getUser($userID);?> parent.window.location="<?php echo (JRoute::_(K2HelperRoute::getUserRoute($user->id))); ?>";
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
For now, I have a little system and it works pretty good :
I'll do a little test :
- If the user can publish item, I display an alert box message, who said :"Thanks, Your item has been published." , the pop up close, and I refresh the page.
- If the user can't publish, I display an alert box message, who said :"Thanks, Your item was submitted to a moderator, it will be published after verification." the pop up close, and I refresh the page.
Now, if your trick work, I will be able to redirect the user to his article instead of refresh the page (for user who can publish only).
But, one question, with your trick we hide this Calendar warning, but do you think the warning isn't here for a good reason ? Or it's just a bug so we can hide it without fear a futur problem ?
I wanted to get to stop using pop-up for the add form, but, it's too difficult. So I adapt my JCE editor and I managed to do exactly the same editor like on this site, exactly !
So now I have a very clean editor, with one simple line with button, and it's pretty good.
One last problem : Display a little pop up while the article is saved (on my website I installed K2 Multi Notify so it takes a little longer time because I need to send several emails to moderator). And for that, I don't know at all how I can do that :/
Thanks again ;)
Thanks ;)
Please Log in or Create an account to join the conversation.
- Hanny
-
- Offline
- Senior Member
- Posts: 48
But, one question, with your trick we hide this Calendar warning, but do you think the warning isn't here for a good reason ? Or it's just a bug so we can hide it without fear a futur problem ?
Honestly, I have no idea. If you allow your users to mess with the calenders/publish dates it will affect that - commenting them out essentially disables the calenders from what I can tell. I don't use the sidebar at all (it doesn't show on my site - I've disabled it) - so it doesn't affect me. If you've got a site where people do utilize dates and such it will probably be a pointless fix that won't help you.
I wish I had a better fix than commenting out the calender features.... but I don't. If you google that calender error you can see a good number of users/threads on the Joomla forums having the same issue with no solutions found.
One last problem : Display a little pop up while the article is saved (on my website I installed K2 Multi Notify so it takes a little longer time because I need to send several emails to moderator). And for that, I don't know at all how I can do that :/
Yea, I don't know anything about the multi-notify or any of that stuff... not sure how to go about that yet.
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
For the last problem, it's totally unrelated to K2 Multi Notify.
In fact, try simply to add few images to your article, or a video, or attached files... It takes more time to save when you do this, sometimes more than 5 or 10 seconds...
So the user have to wait and doesn't know if all is ok... I want to display a little pop-up box while the item is saved in K2 (while all images, video, attached files... are uploaded). Simply display this pop-up while Firefox is loading something, maybe it's a solution I don't know...
Do you understand ?
Thanks again ;)
Please Log in or Create an account to join the conversation.
- Hanny
-
- Offline
- Senior Member
- Posts: 48
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
Maybe users are interested so I put my code here :
Between <div class="k2Frontend"> (line 253) and <table class="toolbar" cellpadding="2" cellspacing="4"> (line 294) in form.php
I have :
<?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(); <?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, vous allez être redirigé vers celui-ci..'); window.parent.location='index.php?option=com_k2&view=item&id=<?php echo $this->row->id; ?>'; <?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.
- juju
-
- Offline
- Premium Member
- Posts: 119
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
But really really dirty, and I don't all understand what I do ^^ But it's work :p
It display a little gif in center of the screen (not sure in the center) while saving the item.
So, here is how I do , but warning : it's just a test version...
In form.php :
Just before <form action="index.php" enctype="multipart/form-data" method="post" name="adminForm" id="adminForm">, add :
<div id="charge-sbox-overlay" style="z-index: 65555; xg-p: fixed; top: 0px; left: 0px; visibility: hidden; opacity: 0.7; width: 1349px; height: 619px;" class=""></div>
<div id="charge-sbox-window" style="z-index: 0; xg-p: fixed; top: 35%; left: 50%; padding: 2px; width: 100px; height: 100px; margin-left:-50px;" class=""><div id="charge-sbox-content" style="visibility: hidden; opacity: 1;" class="ssbox-content-iframe"><iframe height="100" frameborder="0" width="100" src="www.notreassurance.com/img/gif-anime_80px.gif"></iframe></div></div>
After that, in the beginning of the file, after <script type="text/javascript"> , add :
function chargement(){ document.getElementById("charge-sbox-window").style.zIndex="70000"; document.getElementById("charge-sbox-content").style.visibility="visible"; document.getElementById("charge-sbox-overlay").style.visibility="visible"; }
And finally, add this just before syncExtraFieldsEditor(), at the beginning of the function submitbutton(pressbutton) :
chargement();
Try to save an item, and watch the animation ;) Try with an image in the article, to see the animation few seconds ;)
I hope you could help me to simplify this code and make it better :)
Please Log in or Create an account to join the conversation.
- rexkramer
-
- Offline
- Senior Member
- Posts: 71
Interesting post! A lot of people have problems with the "silent progress", especially when people upload zipped galleries. Also, i am not a friend of the open modal window, when you hit the save button?! Is it possible to close the modal window after the save or cancel action automaticly?
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
(see also previous pages), with K2 Multi Notify, and also others modifications I do,
I have now :
- The user click on "add an item", a pop up appear, the size of the pop-up is automatically sized to 80% of the screen.
- The editor is JCE, and I modified the skin to have the same minimal editor like on this forum.
- The user write his article, and click on save.
- An animation appear while the article is saved
- When it's finished, an alert message is displayed, with different message if the user can publish or not.
If the user can publish, I display an alert message "Thanks, Your item have been published !".
If the user can't publish, I display an alert message "Thanks, your item has been sent to a moderator, it will be published after verification." and an email is automatically sent to a moderator, with in the mail : a preview link and a link for publish article.
- The pop-up box for adding article is closed automatically and the page is refresh. If the user could publish, he is redirected to his fresh article ;)
I think it's really complete :) I'll do a complete tuto if you are interested ;)
Please Log in or Create an account to join the conversation.
- rexkramer
-
- Offline
- Senior Member
- Posts: 71
Many thanks for the compact overview. I was getting off-topic, i know. Sometimes its hard to find, join and understand a disscussion, which is already going on for quiet some time. Thanks again.
By the way, is there any interest from JoomlaWorks in all this neat stuff. All the modifications sounds really usefull and should be integrated.
Please Log in or Create an account to join the conversation.
- rexkramer
-
- Offline
- Senior Member
- Posts: 71
Please Log in or Create an account to join the conversation.
- Hanny
-
- Offline
- Senior Member
- Posts: 48
We should fork it for that one feature! J'k!
Please Log in or Create an account to join the conversation.
- rexkramer
-
- Offline
- Senior Member
- Posts: 71
(Replying with quotes is a real pain on ning)
It is a big usability-bug. Period.
A fork: Definitely worth a thought :-) ;-)
...the developers have said it's not a bug
...We should fork it for that one feature!
Please Log in or Create an account to join the conversation.
- rexkramer
-
- Offline
- Senior Member
- Posts: 71
Thousand thumbs up for all your efforts!
Please Log in or Create an account to join the conversation.