merge stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 23 Jun 2009 12:12:56 +0200
branchstable
changeset 2139 8969443bd21c
parent 2138 c9263a17aed5 (current diff)
parent 2136 ffd6c68bc485 (diff)
child 2142 098aa2075903
merge
--- a/interfaces.py	Tue Jun 23 11:48:40 2009 +0200
+++ b/interfaces.py	Tue Jun 23 12:12:56 2009 +0200
@@ -197,6 +197,14 @@
     """interface for items that do have a begin date 'start' and an end date 'stop'
     """
 
+    @property
+    def start(self):
+        """return start date"""
+
+    @property
+    def stop(self):
+        """return stop state"""
+
 class ICalendarViews(Interface):
     """calendar views interface"""
     def matching_dates(self, begin, end):
--- a/web/data/cubicweb.preferences.js	Tue Jun 23 11:48:40 2009 +0200
+++ b/web/data/cubicweb.preferences.js	Tue Jun 23 12:12:56 2009 +0200
@@ -4,6 +4,8 @@
  *     move me in a more appropriate place
  */
 
+var prefsValues = {};
+
 function togglePrefVisibility(elemId) {
     clearPreviousMessages();
     jQuery('#' + elemId).toggleClass('hidden');
@@ -21,7 +23,6 @@
     _toggleFieldset(fieldsetid, 0, linklabel, linkhref);
 }
 
-
 function _toggleFieldset(fieldsetid, closeaction, linklabel, linkhref){
     jQuery('#'+fieldsetid).find('div.openlink').each(function(){
 	    var link = A({'href' : "javascript:noop();",
@@ -75,7 +76,6 @@
     jQuery('#err-value:' + formid).remove();
 }
 
-
 function checkValues(form, success){
     var unfreezeButtons = false;
     jQuery(form).find('select').each(function () {
@@ -100,8 +100,8 @@
 }
 
 function _checkValue(input, unfreezeButtons){
-     var currentValueInput = jQuery("input[name=current-" + input.attr('name') + "]");
-     if (currentValueInput.val() != input.val()){
+    var currentValue = prefsValues[input.attr('name')];
+     if (currentValue != input.val()){
 	 input.addClass('changed');
 	 unfreezeButtons = true;
      }else{
@@ -112,27 +112,22 @@
      return unfreezeButtons;
 }
 
-
 function setCurrentValues(form){
-    jQuery(form).find('input[name^=current-value]').each(function () {
-	    var currentValueInput = jQuery(this);
-	    var name = currentValueInput.attr('name').split('-')[1];
-	    jQuery(form).find("[name=" + name + "]").each(function (){
-		    var input = jQuery(this);
-		    if(input.attr('type') == 'radio'){
-			// NOTE: there seems to be a bug with jQuery(input).attr('checked')
-			//       in our case, we can't rely on its value, we use
-			//       the DOM API instead.
-			if(input[0].checked){
-			    currentValueInput.val(input.val());
-			}
-		    }else{
-			currentValueInput.val(input.val());
-		    }
-		});
-    });
+    jQuery(form).find('input[name^=value]').each(function () {
+	    var input = jQuery(this);
+	    if(input.attr('type') == 'radio'){
+		// NOTE: there seems to be a bug with jQuery(input).attr('checked')
+		//       in our case, we can't rely on its value, we use
+		//       the DOM API instead.
+		if(input[0].checked){
+		    prefsValues[input.attr('name')] = input.val();
+		}
+	    }else{
+		prefsValues[input.attr('name')] = input.val();
+	    }
+	});
 }
-
+     
 function initEvents(){
   jQuery('form').each(function() {
 	  var form = jQuery(this);
@@ -153,4 +148,3 @@
 $(document).ready(function() {
 	initEvents();
 });
-
--- a/web/views/cwproperties.py	Tue Jun 23 11:48:40 2009 +0200
+++ b/web/views/cwproperties.py	Tue Jun 23 12:12:56 2009 +0200
@@ -139,7 +139,6 @@
             w(u'<h2 class="propertiesform">%s</h2>\n' %
               (make_togglable_link('fieldset_' + group, label.capitalize())))
             w(u'<div id="fieldset_%s" %s>' % (group, status))
-
             # create selection
             sorted_objects =  sorted((self.req.__('%s_%s' % (group, o)), o, f)
                                            for o, f in objects.iteritems())
@@ -217,10 +216,9 @@
                                                 eidparam=True))
         subform.vreg = self.vreg
         subform.form_add_hidden('pkey', key, eidparam=True)
-        subform.form_add_hidden("current-value:%s" % entity.eid,)
         form.form_add_subform(subform)
         return subform
-
+    
 def is_user_prefs(cls, req, rset, row=None, col=0, **kwargs):
     return req.user.eid == rset[row or 0][col]
 
@@ -303,7 +301,7 @@
         choices = entity.vreg.user_property_keys()
         return [(u'', u'')] + sorted(zip((_(v) for v in choices), choices))
 
-
+    
 class PropertyValueField(StringField):
     """specific field for CWProperty.value  which will be different according to
     the selected key type and vocabulary information
@@ -355,7 +353,6 @@
                 self.choices = field.vocabulary(form)
         self.widget = wdg
 
-
 uicfg.autoform_field.tag_attribute(('CWProperty', 'pkey'), PropertyKeyField)
 uicfg.autoform_field.tag_attribute(('CWProperty', 'value'), PropertyValueField)
 
--- a/web/views/idownloadable.py	Tue Jun 23 11:48:40 2009 +0200
+++ b/web/views/idownloadable.py	Tue Jun 23 12:12:56 2009 +0200
@@ -125,7 +125,7 @@
         """the secondary view is a link to download the file"""
         entity = self.entity(row, col)
         url = html_escape(entity.absolute_url())
-        name = html_escape(entity.download_file_name())
+        name = html_escape(title or entity.download_file_name())
         durl = html_escape(entity.download_url())
         self.w(u'<a href="%s">%s</a> [<a href="%s">%s</a>]' %
                (url, name, durl, self.req._('download')))
--- a/web/views/primary.py	Tue Jun 23 11:48:40 2009 +0200
+++ b/web/views/primary.py	Tue Jun 23 12:12:56 2009 +0200
@@ -54,6 +54,7 @@
             self.w(u'<table width="100%"><tr><td style="width: 75%">')
         self.w(u'<div>')
         self.w(u'<div class="mainInfo">')
+        self.content_navigation_components('navcontenttop')
         try:
             self.render_entity_attributes(entity)
         except TypeError: # XXX bw compat
@@ -61,7 +62,6 @@
                  'deprecated (%s)' % self.__class__)
             self.render_entity_attributes(entity, [])
         self.w(u'</div>')
-        self.content_navigation_components('navcontenttop')
         if self.main_related_section:
             try:
                 self.render_entity_relations(entity)