function GetPropertyNames($resource, $params) { $SYSLOG = SYSLOG::getInstance(); $result = new XajaxResponse(); $names = $SYSLOG->GetResourcePropertyNames($resource); $script = "var option;var propname = xjx.\$('propertyname');\n\t\twhile (propname.length > 1)\n\t\t\tpropname.remove(1);"; if (!empty($names)) { foreach ($names as $name) { $script .= "option = document.createElement('option');\n\t\t\t\toption.text = '" . $name . "';\n\t\t\t\toption.value = '" . $name . "';\n\t\t\t\tpropname.add(option, null);" . (!empty($params) && $params['propertyname'] == $name ? "option.selected = true;" : ''); } } $script .= "propname.disabled = false;"; $result->script($script); if (!empty($params) && isset($params['propertyvalue'])) { $result->script("GetPropertyValues('" . $params['propertyvalue'] . "');"); } $result->assign('propertyvaluedata', 'innerHTML', '<input type="text" size="20" name="propertyvalue" id="propertyvalue">'); return $result; }
function jdGetDirectory($callback, $folder, $getFiles = false, $filter = '*') { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.file'); $folder = JPath::clean(JPATH_ROOT . DS . $folder); JPath::check($folder); $response = new XajaxResponse(); if (!is_dir($folder)) { return $response; } $result = array(); $dirs = JFolder::folders($folder, '', false, true); foreach ($dirs as $dir) { $dirData = array(); $dirData['permission'] = substr(sprintf("%o", fileperms($dir)), -3); if ($getFiles) { $fileData = array(); $files = glob($folder . DS . $filter); foreach ($files as $f) { $fileData[$f]['permission'] = substr(sprintf("%o", fileperms($f)), -3); } } $result[$dir]['info'] = $dirData; $result[$dir]['files'] = $fileData; } $response->script($callback . '(' . JHTMLBehavior::_getJSObject($result) . ')'); return $response; }