Author: andre
Date: 2009-07-03 00:20:55 +0200 (Fri, 03 Jul 2009)
New Revision: 36529

Modified:
   openimages/trunk/src/main/webapp/editors/inc/form-create.jspx
   
openimages/trunk/src/main/webapp/mmbase/components/oip/user-mediatranslations.jspx
   openimages/trunk/src/main/webapp/style/css/main.css
   openimages/trunk/src/main/webapp/style/css/specific-styles.css
   openimages/trunk/src/main/webapp/style/js/mmajaxeditor.js
   openimages/trunk/src/main/webapp/user.jspx
Log:
editing and creating translations seems to go correct, except maybe for the 
messages after reloading

Modified: openimages/trunk/src/main/webapp/editors/inc/form-create.jspx
===================================================================
--- openimages/trunk/src/main/webapp/editors/inc/form-create.jspx       
2009-07-02 19:29:07 UTC (rev 36528)
+++ openimages/trunk/src/main/webapp/editors/inc/form-create.jspx       
2009-07-02 22:20:55 UTC (rev 36529)
@@ -74,7 +74,7 @@
                 </mm:createrelation>
                </c:otherwise>
             </c:choose>
-            and related to <mm:node number="$nr"><mm:function name="gui" 
/></mm:node>
+            and related to <mm:node number="$nr"><mm:function name="gui" 
escape="tagstripper" /></mm:node>
           </c:if>.
         </p>
         <mm:commit />

Modified: 
openimages/trunk/src/main/webapp/mmbase/components/oip/user-mediatranslations.jspx
===================================================================
--- 
openimages/trunk/src/main/webapp/mmbase/components/oip/user-mediatranslations.jspx
  2009-07-02 19:29:07 UTC (rev 36528)
+++ 
openimages/trunk/src/main/webapp/mmbase/components/oip/user-mediatranslations.jspx
  2009-07-02 22:20:55 UTC (rev 36529)
@@ -25,7 +25,6 @@
             
             <oip:h2 block="user-mediatranslations" />
             
-            <div id="mmajaxeditor-msg"> <!-- target for mmajaxeditor --> </div>
             <mm:import externid="msg" />
             <mm:present referid="msg">
               <p class="msg">${msg}</p>
@@ -54,7 +53,6 @@
                           - <mm:function name="gui" />
                         </a>
                       </mm:link>
-                      <div id="edit${translation}" class="hidden"> </div>
                       
                       <mm:maydelete> -
                         <mm:link page="/editors/inc/form-delete.jspx" 
referids="translat...@nr">
@@ -63,6 +61,8 @@
                         <div id="deletenode${translation}" class="hidden">  
</div>
                       </mm:maydelete>
                       
+                      <div id="edit${translation}" class="hidden"> </div>
+                      
                     </li>
                 </mm:relatednodes>
               </mm:relatednodescontainer>

Modified: openimages/trunk/src/main/webapp/style/css/main.css
===================================================================
--- openimages/trunk/src/main/webapp/style/css/main.css 2009-07-02 19:29:07 UTC 
(rev 36528)
+++ openimages/trunk/src/main/webapp/style/css/main.css 2009-07-02 22:20:55 UTC 
(rev 36529)
@@ -192,7 +192,7 @@
 
 input.radiobutton { width: auto; }
 
-input.submit
+input.submit, input.cancel
 {
        width: auto;
        float: right;
@@ -204,6 +204,7 @@
        padding: 2px 10px 2px 10px;
        margin-top: 8px;
        font-size: 1.1em;
+       margin-left: 16px;
 }
 
 

Modified: openimages/trunk/src/main/webapp/style/css/specific-styles.css
===================================================================
--- openimages/trunk/src/main/webapp/style/css/specific-styles.css      
2009-07-02 19:29:07 UTC (rev 36528)
+++ openimages/trunk/src/main/webapp/style/css/specific-styles.css      
2009-07-02 22:20:55 UTC (rev 36529)
@@ -367,7 +367,7 @@
 
 div.right-column > p.more { margin-right: 16px; }
 div.right-column input, div.right-column textarea, div.right-column select { 
width: 280px; }
-div.right-column input.submit { width: auto; }
+div.right-column input.submit, div.right-column input.cancel { width: auto; }
 
 
 form#loginform { margin-top: 3em; }

Modified: openimages/trunk/src/main/webapp/style/js/mmajaxeditor.js
===================================================================
--- openimages/trunk/src/main/webapp/style/js/mmajaxeditor.js   2009-07-02 
19:29:07 UTC (rev 36528)
+++ openimages/trunk/src/main/webapp/style/js/mmajaxeditor.js   2009-07-02 
22:20:55 UTC (rev 36529)
@@ -50,31 +50,57 @@
 
 MMAjaxeditor.prototype.loadElement = function(url, params) {
     var result;
-    $.ajax({async: false, url: url, type: "GET", dataType: "html", data: 
params,
-            complete: function(response, status){
-                if (status == "success" || status == "notmodified") {
-                    result = response.responseText;
-                } else {
-                    var div = $('<div>Error: ' + response.status + ' - ' + 
response.statusText + '</div>');
-                    result = div;
-                }
+    $.ajax({async: false, url: url, type: "GET", dataType: "xml", data: params,
+        complete: function(response, status) {
+            if (status == "success" || status == "notmodified") {
+                result = response.responseText;
+            } else {
+                var div = $('<p class="err">Error: ' + response.status + ' - ' 
+ response.statusText + '</p>');
+                result = div;
             }
-           });
+        }
+       });
 
     return result;
 }
 
 MMAjaxeditor.prototype.bindFormEvents = function() {
-       // bind save with form plugin
-       var options = { target: '#mmajaxeditor-msg', success: this.afterSubmit 
};
+       var self = this;
+       var result;
+       var options = { 
+           dataType: "html", 
+           complete: function(response, status) {
+            if (status == "success" || status == "notmodified") {
+                result = response.responseText;
+            } else {
+                result = $('<p class="err">Error: ' + response.status + ' - ' 
+ response.statusText + '</p>');
+            }
+               
+               $(self.div).html(result);
+            if ($(self.div).find('form input').length == 0) {
+                //console.log("No inputs left, we're finished editing.");
+                var msg = $(self.div).find('.msg').text();
+                self.reload(msg);
+            } else {
+                   $(self.div).find("form").ajaxForm(options);
+                if (typeof MMBaseValidator == "function") {
+                    self.validator = new MMBaseValidator(self.div);
+                }
+                self.bindFormClose();
+            }
+           }
+       };
+    $(this.div).html(result);
     $(this.div).find("form").ajaxForm(options);
-       
        if (typeof MMBaseValidator == "function") {
         this.validator = new MMBaseValidator(this.div);
     }
     this.bindFormClose();
 }
 
+/*
+ * Binds a link with class 'mmajaxeditor_close' to close the form.
+ */
 MMAjaxeditor.prototype.bindFormClose = function() {
     var editor = this;
     $("a.mmajaxeditor_close").click(function(ev) {
@@ -103,25 +129,25 @@
 }
 */
 
-MMAjaxeditor.prototype.afterSubmit = function() {
-       // this function gets the response passed from ajaxForm()
-       // so, 'this' contains the returned form/html (not the current 
mmmajaxeditor div)
-       $("#" + this.id).removeClass("mmajaxeditor");
-       $(this).find(".msg").hide();    // find the msg from the result and 
hide it
-       var msg = $(this).find('.msg').text();  // but get its text
-    
+MMAjaxeditor.prototype.reload = function(msg) {
     var loc = "" + document.location;
+    //console.log("1 loc: " + loc);
     var pos = loc.indexOf('msg=');
     if (pos > -1) {
-               var epos = loc.indexOf(pos, '&');
-               if (epos < 0) epos = loc.length;
-               var start = loc.substring(0, pos);
-               var end = loc.substring(epos, loc.length);
-        loc = start + end;
+               var first = loc.substring(0, pos - 1);
+               var epos = loc.indexOf(pos + 1, '&');
+               if (epos == -1) epos = loc.length;
+               var last = "";
+               if (epos < loc.length) {
+                   last = loc.substring(epos + 1, loc.length);
+               }
+        loc = first + last;
     }
-    var connector = (loc.indexOf('?') > -1) ? '&' : '?';
+    //console.log("2 loc: " + loc);
+    var connector = loc.indexOf('?') == -1 ? '?' : '&';
     loc = loc + connector + "msg=" + msg;
-    document.location = loc;
+    //console.log("reloading: " + loc);
+   // document.location = loc;
 }
 
 /*
@@ -143,7 +169,6 @@
 
 function prepMMAjaxeditor() {
     $("a.mmajaxeditor").click(function(ev) {
-        //console.log("aha mmjx");
         ev.preventDefault();
         var anchor = ev.target;
                new MMAjaxeditor(anchor);

Modified: openimages/trunk/src/main/webapp/user.jspx
===================================================================
--- openimages/trunk/src/main/webapp/user.jspx  2009-07-02 19:29:07 UTC (rev 
36528)
+++ openimages/trunk/src/main/webapp/user.jspx  2009-07-02 22:20:55 UTC (rev 
36529)
@@ -36,10 +36,10 @@
 
         <c:if test="${block eq 'user-media'}">
           <div class="related-grey">
-            <mm:component name="oip" block="user-mediapreview" />
+            <mm:component name="oip" block="user-mediatranslations" />
           </div>
           <div class="related-grey-border">
-            <mm:component name="oip" block="user-mediatranslations" />
+            <mm:component name="oip" block="user-mediapreview" />
           </div>
         </c:if>
 

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to