Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix user-defined metadata: fix #431 (quotes in long text), fix choice…
Browse files Browse the repository at this point in the history
…s, remove "comments feed" it's a dedicated plugin.
  • Loading branch information
cdujeu committed Feb 20, 2014
1 parent a77b0b7 commit a64bdfd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 13 additions & 2 deletions core/src/plugins/meta.user/class.MetaCellRenderer.js
Expand Up @@ -73,7 +73,7 @@ Class.create("MetaCellRenderer", {
var value = formElement.getValue();
var select = new Element('select', {name: formElement.name,style:'width:56%;height:24px;'});
$H(selectorValues).each(function(pair){
select.insert(new Element("option", {value:pair.value}).update(pair.key));
select.insert(new Element("option", {value:pair.key}).update(pair.value));
if(value) select.setValue(value);
});
formElement.replace(select);
Expand Down Expand Up @@ -213,6 +213,17 @@ Class.create("MetaCellRenderer", {
td.update(rule.label);
}
break;
case "choice":
if(MetaCellRenderer.staticMetadataCache && MetaCellRenderer.staticMetadataCache.get(metaName)){
var selectorValues = MetaCellRenderer.staticMetadataCache.get(metaName);
if(!selectorValues) break;
console.log(selectorValues);
var value = td.innerHTML.strip();
if(selectorValues[value]){
td.update(selectorValues[value]);
}
}
break;
case "text":
case "textarea":
if(typeof td.contentEditable != 'undefined'){
Expand Down Expand Up @@ -345,7 +356,7 @@ Class.create("MetaCellRenderer", {
// mod for textarea
formTextarea: function(formElement, form){
var obj = new MetaCellRenderer();
var cont = new Element('textarea', {name:formElement.name,style:'float: left;width: 136;border-radius: 3px;padding: 2px;height:100px;'});
var cont = new Element('textarea', {name:formElement.name,style:'float: left;width: 161px;border-radius: 3px;padding: 2px;height:100px;'});
cont.innerHTML = formElement.value;
formElement.replace(cont);
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/plugins/meta.user/manifest.xml
Expand Up @@ -12,7 +12,7 @@
<!--<param name="meta_file_name" type="string" label="CONF_MESSAGE[Meta File]" description="CONF_MESSAGE[Hidden file used inside folders to save meta data]" mandatory="true" default=".ajxp_meta"/>-->
<param name="meta_fields" type="string" replicationGroup="group1" label="CONF_MESSAGE[Field ID]" description="CONF_MESSAGE[Id of fiels, use standard characters here.]" mandatory="true" default="comment_field"/>
<param name="meta_labels" type="string" replicationGroup="group1" label="CONF_MESSAGE[Label]" description="CONF_MESSAGE[Label of the field, human friendly]" mandatory="true" default="My Comments"/>
<param name="meta_types" type="select" choices="string|Short text,textarea|Long text,stars_rate|Stars Rating,css_label|Color labels,comments_feed|Comments Feed,choice|Selection (set choices in Label)" replicationGroup="group1" label="CONF_MESSAGE[Field Type]" description="CONF_MESSAGE[Type of field]" mandatory="true" default="string"/>
<param name="meta_types" type="select" choices="string|Short text,textarea|Long text,stars_rate|Stars Rating,css_label|Color labels,choice|Selection (set choices in Additional Info)" replicationGroup="group1" label="CONF_MESSAGE[Field Type]" description="CONF_MESSAGE[Type of field]" mandatory="true" default="string"/>
<param name="meta_visibility" type="select" replicationGroup="group1" label="CONF_MESSAGE[Column visibility]" description="CONF_MESSAGE[Set default visibility.]" mandatory="true" default="visible" choices="visible|Visible,hidden|Hidden"/>
<param name="meta_additional" type="string" replicationGroup="group1" label="CONF_MESSAGE[Additional info]" description="CONF_MESSAGE[Depending on the field type. Currently used for selection only]" mandatory="false"/>
</server_settings>
Expand Down Expand Up @@ -54,7 +54,7 @@
var metaTypes = nodeMeta.get('meta_types').split(',');
for(var i=0;i<metaFields.length;i++){
var value = nodeMeta.get(metaFields[i]) || '';
form.insert('<div class="SF_element"><div class="SF_label">'+metaLabels[i]+' : </div><input class="SF_input" name="'+metaFields[i]+'" value="'+value+'"/></div>');
form.insert('<div class="SF_element"><div class="SF_label">'+metaLabels[i]+' : </div><input class="SF_input" name="'+metaFields[i]+'" value="'+value.replace(/"/g, '&quot;')+'"/></div>');
var element = form.down('input[name="'+metaFields[i]+'"]');
var fieldType = metaTypes[i];
if(fieldType == 'stars_rate'){
Expand All @@ -78,7 +78,7 @@
modal.showDialogForm('Meta Edit', 'user_meta_form', loadFunc, closeFunc);
]]></clientCallback>
<clientForm id="user_meta_form"><![CDATA[
<div id="user_meta_form" action="edit_user_meta" box_width="250"></div>
<div id="user_meta_form" action="edit_user_meta" box_width="320"></div>
]]></clientForm>
<serverCallback methodName="editMeta"></serverCallback>
</processing>
Expand Down

0 comments on commit a64bdfd

Please sign in to comment.