Permalink
Browse files

Fix columns config not being sent. Was breaking shares list.

  • Loading branch information...
1 parent 0b551c0 commit 095529d439b8748a5e067fa7e243fd3fd63fcd4b @cdujeu cdujeu committed Jun 20, 2016
@@ -482,6 +482,26 @@ public static function sendFilesListComponentConfig($config)
print("<client_configs><component_config className=\"FilesList\">$config</component_config></client_configs>");
}
}
+
+ /**
+ * Simple XML element build from associative array. Can pass specific $children for nested elements.
+ * @param string $tagName
+ * @param array $attributes
+ * @param string $xmlChildren
+ * @return string
+ */
+ public static function toXmlElement($tagName, $attributes, $xmlChildren = ""){
+ $buffer = "<$tagName ";
+ foreach ($attributes as $attName => $attValue){
+ $buffer.= "$attName=\"".Utils::xmlEntities($attValue)."\" ";
+ }
+ if(!strlen($xmlChildren)) {
+ $buffer .= "/>";
+ } else{
+ $buffer .= ">".$xmlChildren."</$tagName>";
+ }
+ return $buffer;
+ }
/**
* Send a success or error message to the client.
* @static
@@ -118,6 +118,15 @@ public function toXML()
$this->paginationData["remoteSort"],
false);
}
+ if(isSet($this->columnsDescription)){
+ $xmlChildren = [];
+ foreach($this->columnsDescription['columns'] as $column){
+ $xmlChildren[] = XMLWriter::toXmlElement("column", $column);
+ }
+ $xmlConfig = XMLWriter::toXmlElement("columns", $this->columnsDescription['description'], implode("", $xmlChildren));
+ $xmlConfig = XMLWriter::toXmlElement("component_config", ["className" => "FilesList"], $xmlConfig);
+ $buffer .= XMLWriter::toXmlElement("client_configs", [], $xmlConfig);
+ }
foreach ($this->children as $child){
if($child instanceof NodesList){
$buffer .= $child->toXML();

0 comments on commit 095529d

Please sign in to comment.