-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry, computer crash.  Sure--go ahead or describe the solution and I'll do it. 
 Deleting the RegionWidget from Region's list was the only way I saw to do the 
delete.


Marlon


On 6/6/11 1:55 PM, Franklin, Matthew B. wrote:
> Ahh.  That makes sense.  I think there might be a way to simplify the
> server side delete operation so that this wouldn't happen.  Specifically,
> removing the need to pass the regionId and just use the regionWidgetId to
> delete the widget.
> 
> -Matt
> 
> On 6/6/11 1:52 PM, "Marlon Pierce" <[email protected]> wrote:
> 
> Trying to delete a gadget that you have moved on the page throws this
> error:Rave attempted to update the server with your recent changes,  but
> the changes were rejected by the server as invalid.
> 
> On 6/6/11 1:46 PM, Franklin, Matthew B. wrote:
>>>>
>>>> On 6/6/11 1:43 PM, "Marlon Pierce" <[email protected]> wrote:
>>>>
>>>> I cleaned it up a bit already, but let me look at the init.  There is
>>>> still a bug associated with deleting gadgets that have been moved.
>>>>
>>>>> Moved or deleted? Can you elaborate on the bug a bit?
>>>>
>>>>
>>>>
>>>>
>>>> Marlon
>>>>
>>>>
>>>> On 6/6/11 1:36 PM, Franklin, Matthew B. wrote:
>>>>>>> On 6/6/11 1:10 PM, "[email protected]" <[email protected]> wrote:
>>>>>>>
>>>>>>>> Author: mpierce
>>>>>>>> Date: Mon Jun  6 17:10:32 2011
>>>>>>>> New Revision: 1132706
>>>>>>>>
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1132706&view=rev
>>>>>>>> Log:
>>>>>>>> Reorganizing the widget deletion code (RAVE-41) so that most of the
>>>>>>>> action takes place in rave.js rather than home.jsp.  Probably this
>>>>>>>> needs
>>>>>>>> a better design pattern applied to it.
>>>>>>>
>>>>>>> Thanks for taking that on.  I haven't had a ton of time to look over
>>>>>>> the
>>>>>>> delete code yet, but from what I have seen, it looks like there
>>>>>>> should
>>>>>>> be
>>>>>>> no reason that we can't do what is left in the home.jsp in the
>>>>>>> ui.init
>>>>>>> function of rave.js (init the buttons for all widgets with one
>>>>>>> expression).  This would allow us to move the script includes for
>>>>>>> jquery,
>>>>>>> etc back to the bottom of the page, which is where we really want
>>>>>>> them.
>>>>>>>
>>>>>>> I can go ahead and make this change unless Marlon or others who have
>>>>>>> been
>>>>>>> working on it want to give it a go.
>>>>>>>
>>>>>>> -Matt
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Modified:
>>>>>>>>    
>>>>>>>>
>>>>>>>> incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.j
>>>>>>>> sp
>>>>>>>>    incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
>>>>>>>>
>>>>>>>> Modified: 
>>>>>>>>
>>>>>>>> incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.j
>>>>>>>> sp
>>>>>>>> URL: 
>>>>>>>>
>>>>>>>>
>>>>>>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/mai
>>>>>>>> n/w
>>>>>>>> eb
>>>>>>>>
>>>>>>>> app/WEB-INF/views/home.jsp?rev=1132706&r1=1132705&r2=1132706&view=dif
>>>>>>>> f
>>>>>>>>
>>>>>>>>
>>>>>>>> =====================================================================
>>>>>>>> ===
>>>>>>>> ==
>>>>>>>> ====
>>>>>>>> --- 
>>>>>>>>
>>>>>>>> incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.j
>>>>>>>> sp
>>>>>>>> (original)
>>>>>>>> +++ 
>>>>>>>>
>>>>>>>> incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.j
>>>>>>>> sp
>>>>>>>> Mon Jun  6 17:10:32 2011
>>>>>>>> @@ -64,41 +64,35 @@
>>>>>>>>         <div class="widget-title-bar" >
>>>>>>>>             <span
>>>>>>>>
>>>>>>>>
>>>>>>>> id="widget-${regionWidget.id}-title">${regionWidget.widget.title}</sp
>>>>>>>> an>
>>>>>>>>             
>>>>>>>> -            <span id="widget-${regionWidget.id}-toolbar"
>>>>>>>> style="float:right;">
>>>>>>>> -              <button id="widget-${regionWidget.id}-max"
>>>>>>>> class="widget-toolbar-btn"></button>
>>>>>>>> -                                                <button 
>>>>>>>> id="widget-${regionWidget.id}-remove"
>>>>>>>> class="widget-toolbar-btn"></button>
>>>>>>>> -                                                <script>
>>>>>>>> -              $("#widget-${regionWidget.id}-max").button({
>>>>>>>> -                text: false,
>>>>>>>> -                icons: {
>>>>>>>> -                  primary: "ui-icon-arrow-4-diag"
>>>>>>>> -                }
>>>>>>>> -              }).click(function() {
>>>>>>>> -                alert("not implemented yet.");
>>>>>>>> -              });
>>>>>>>> -                                                
>>>>>>>> $("#widget-${regionWidget.id}-remove").button({
>>>>>>>> -                                            text: false,
>>>>>>>> -                                            icons: {
>>>>>>>> -                                              primary: "ui-icon-close"
>>>>>>>> -                                            }
>>>>>>>> -                                          
>>>>>>>> }).unbind("click").click(function() {
>>>>>>>> -                                              alert("remove gadget");
>>>>>>>> -                                            
>>>>>>>> rave.api.rpc.removeWidget({
>>>>>>>> -                                                regionWidgetId: 
>>>>>>>> "${regionWidget.id}",
>>>>>>>> -                                                pageId: 
>>>>>>>> "${defaultPage.id}",
>>>>>>>> -                                                region: {
>>>>>>>> -                                                    id : 
>>>>>>>> rave.getGadgetRegion("${regionWidget.id}")
>>>>>>>> -                                                },
>>>>>>>> -                                                succCB: function() {
>>>>>>>> -                                                        
>>>>>>>> $("#widget-wrapper-${regionWidget.id}").remove();
>>>>>>>> -                                                }
>>>>>>>> -                                              });
>>>>>>>> -                                          });
>>>>>>>> -                                                
>>>>>>>> rave.mapGadgetToRegion("${regionWidget.id}",
>>>>>>>> "${region.id}");
>>>>>>>> -                                                </script>
>>>>>>>> -                                              </span>
>>>>>>>> -           
>>>>>>>> -        </div>
>>>>>>>> +                              <!-- These are toolbar buttons -->
>>>>>>>> +                              <span 
>>>>>>>> id="widget-${regionWidget.id}-toolbar"
>>>>>>>> style="float:right;">
>>>>>>>> +                                <button 
>>>>>>>> id="widget-${regionWidget.id}-max"
>>>>>>>> +                                                       
>>>>>>>> class="widget-toolbar-btn"
>>>>>>>> +                                                       
>>>>>>>> onclick="rave.toolbarMaximize(this)"></button>
>>>>>>>> +                                <button 
>>>>>>>> id="widget-${regionWidget.id}-remove"
>>>>>>>> +                                                       
>>>>>>>> class="widget-toolbar-btn"
>>>>>>>> +                                                       
>>>>>>>>
>>>>>>>>
>>>>>>>> onclick="rave.toolbarDelete(this,${regionWidget.id},${region.id},${de
>>>>>>>> fau
>>>>>>>> lt
>>>>>>>> Page.id})">
>>>>>>>> +                                </button>
>>>>>>>> +                                <script>
>>>>>>>> +                                       //This decorates the toolbar 
>>>>>>>> buttons.  As currently written,
>>>>>>>> +                                       //it needs to be in the 
>>>>>>>> forEach loop.
>>>>>>>> +                                       
>>>>>>>> $("#widget-${regionWidget.id}-max").button({
>>>>>>>> +                                       text: false,
>>>>>>>> +                                       icons: {
>>>>>>>> +                                       primary: "ui-icon-arrow-4-diag"
>>>>>>>> +                                       }
>>>>>>>> +                                       });
>>>>>>>> +
>>>>>>>> +                                       
>>>>>>>> $("#widget-${regionWidget.id}-remove").button({
>>>>>>>> +                                       text: false,
>>>>>>>> +                                       icons: {
>>>>>>>> +                                       primary: "ui-icon-close"
>>>>>>>> +                                       }
>>>>>>>> +                                       });
>>>>>>>> +                                </script>
>>>>>>>> +
>>>>>>>> +                              </span>
>>>>>>>> +                </div>
>>>>>>>>         <div class="widget" id="widget-${regionWidget.id}-body">
>>>>>>>>                         <!-- 
>>>>>>>>                                        Among other things, the 
>>>>>>>> render-widget tag will populate the
>>>>>>>> widgets[] array.
>>>>>>>>
>>>>>>>> Modified: 
>>>>>>>> incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
>>>>>>>> URL: 
>>>>>>>>
>>>>>>>>
>>>>>>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/mai
>>>>>>>> n/w
>>>>>>>> eb
>>>>>>>> app/script/rave.js?rev=1132706&r1=1132705&r2=1132706&view=diff
>>>>>>>>
>>>>>>>>
>>>>>>>> =====================================================================
>>>>>>>> ===
>>>>>>>> ==
>>>>>>>> ====
>>>>>>>> --- incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
>>>>>>>> (original)
>>>>>>>> +++ incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
>>>>>>>> Mon
>>>>>>>> Jun  6 17:10:32 2011
>>>>>>>> @@ -105,6 +105,36 @@ var rave = rave || (function() {
>>>>>>>>
>>>>>>>>     })();
>>>>>>>>
>>>>>>>> +       /**
>>>>>>>> +        * Group widget toolbar functions
>>>>>>>> +        */
>>>>>>>> +       var toolbar = (function() {
>>>>>>>> +                function init(){
>>>>>>>> +                }
>>>>>>>> +                function maximizeAction(button){
>>>>>>>> +                              alert("Maximize: "+button.id+" not yet 
>>>>>>>> implemented.");
>>>>>>>> +                              
>>>>>>>> +                };
>>>>>>>> +                function
>>>>>>>> deleteAction(button,myRegionWidgetId,myRegionId,myPageId){
>>>>>>>> +//                            alert("Delete:"+button.id+" 
>>>>>>>> "+myRegionWidgetId+"
>>>>>>>> "+myRegionId+"
>>>>>>>> "+myPageId);
>>>>>>>> +                              rave.api.rpc.removeWidget({
>>>>>>>> +                                       regionWidgetId: 
>>>>>>>> myRegionWidgetId,
>>>>>>>> +                                       pageId : myPageId,
>>>>>>>> +                                       region: {
>>>>>>>> +                                                id : myRegionId
>>>>>>>> +                                       },
>>>>>>>> +                                       succCB: function() {
>>>>>>>> +                                                
>>>>>>>> $("#widget-wrapper-"+myRegionWidgetId).remove();
>>>>>>>> +                                       }
>>>>>>>> +                              });
>>>>>>>> +                              
>>>>>>>> rave.mapGadgetToRegion(myRegionWidgetId, myRegionId);
>>>>>>>> +                };
>>>>>>>> +                return {
>>>>>>>> +                              maximizeAction : maximizeAction,
>>>>>>>> +                              deleteAction : deleteAction
>>>>>>>> +                }
>>>>>>>> +       })();
>>>>>>>> +
>>>>>>>>     function initializeProviders() {
>>>>>>>>                  //Current providers are rave.wookie and 
>>>>>>>> rave.opensocial.
>>>>>>>>                  //Providers register themselves when loaded, so
>>>>>>>> @@ -161,14 +191,6 @@ var rave = rave || (function() {
>>>>>>>>     }
>>>>>>>>         
>>>>>>>>         /**
>>>>>>>> -        * Deletes the gadget/widget from the display.
>>>>>>>> -     * TODO: must be implemented.
>>>>>>>> -        */
>>>>>>>> -       function deleteWidgetFromPage() {
>>>>>>>> -                return null;
>>>>>>>> -       }
>>>>>>>> -       
>>>>>>>> -       /**
>>>>>>>>          * Map a widget to the region where it is located.
>>>>>>>>          * 
>>>>>>>>          * @param widgetId: id of the widget (not DOM id)
>>>>>>>> @@ -248,10 +270,6 @@ var rave = rave || (function() {
>>>>>>>>          */
>>>>>>>>         getContext: getContext,
>>>>>>>>
>>>>>>>> -      /**
>>>>>>>> -      * Remove a selected gadget from the page
>>>>>>>> -      */
>>>>>>>> -      deleteGadget : deleteWidgetFromPage,
>>>>>>>>
>>>>>>>>        /**
>>>>>>>>         * Change or delete gadget to region map entry.
>>>>>>>> @@ -261,6 +279,12 @@ var rave = rave || (function() {
>>>>>>>>        /**
>>>>>>>>         * Get the region where a widget/gadget belongs to.
>>>>>>>>         */
>>>>>>>> -      getGadgetRegion : getGadgetRegion
>>>>>>>> +        getGadgetRegion : getGadgetRegion,
>>>>>>>> +
>>>>>>>> +                /**
>>>>>>>> +                      * These are exposed toolbar actions, associated 
>>>>>>>> with widget
>>>>>>>> toolbar
>>>>>>>> buttons
>>>>>>>> +                      */
>>>>>>>> +                toolbarMaximize : toolbar.maximizeAction,
>>>>>>>> +                toolbarDelete : toolbar.deleteAction
>>>>>>>>     }
>>>>>>>> })();
>>>>>>>> \ No newline at end of file
>>>>>>>>
>>>>>>>>
>>>>>>>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJN7R24AAoJEEfVXEODPFIDH2oH/0nB6T0QNlDBjeUzs4WLM+pu
khbPiuBmkvs+DP8wRubJVLbebIlVVoL1egIUamz2tmyjItGkTfs7PQ8GtxxB96QP
twOPF7l4irX64yaPYanYiInn70bIm5RPJsXeFmursjCI3dyEqxHHAWGop+r8m/Iy
KVPDpeJtHr7hMkkPiShZe0lJDKIZzHlFwq+fArgVPIXK9mcgna1E00zq2e0F1TgM
oj5tuYvwSXDYLEaPl7X50PWQMqOQ7yX5KR4A8H0o9NVDMkvn6mXw+CSHp3lzAKzj
ubqI+mCwzoXdQclBaJafss+7loK8zbeyy+EAkFHg1SyfIzynWcZJcaDWlssebyw=
=08Wn
-----END PGP SIGNATURE-----

Reply via email to