public function initMeta($accessDriver)
 {
     parent::initMeta($accessDriver);
     if (!function_exists("exif_read_data")) {
         return;
     }
     //$messages = ConfService::getMessages();
     $def = $this->getMetaDefinition();
     if (!count($def)) {
         return;
     }
     $cdataHead = '<div>
                     <div class="panelHeader infoPanelGroup" colspan="2"><span class="user_meta_change" title="AJXP_MESSAGE[meta.exif.1]">AJXP_MESSAGE[meta.exif.2]</span>AJXP_MESSAGE[meta.exif.3]</div>
                     <div class="infoPanelTable" cellspacing="0" border="0" cellpadding="0">';
     $cdataFoot = '</div></div>';
     $cdataParts = "";
     $even = false;
     foreach ($def as $key => $label) {
         $trClass = $even ? " class=\"even\"" : "";
         $even = !$even;
         $cdataParts .= '<div' . $trClass . '><div class="infoPanelLabel">' . $label . '</div><div class="infoPanelValue" id="ip_' . $key . '">#{' . $key . '}</div></div>';
     }
     $selection = $this->getXPath()->query('registry_contributions/client_configs/component_config[@className="InfoPanel"]/infoPanelExtension');
     $contrib = $selection->item(0);
     $contrib->setAttribute("attributes", implode(",", array_keys($def)));
     $contrib->setAttribute("modifier", "ExifCellRenderer.prototype.infoPanelModifier");
     $htmlSel = $this->getXPath()->query('html', $contrib);
     $html = $htmlSel->item(0);
     $cdata = $this->manifestDoc->createCDATASection($cdataHead . $cdataParts . $cdataFoot);
     $html->appendChild($cdata);
     parent::init($this->options);
 }
 public function initMeta($accessDriver)
 {
     parent::initMeta($accessDriver);
     if (!empty($this->metaFields) || $this->indexContent) {
         $metaFields = $this->metaFields;
         $el = $this->xPath->query("/indexer")->item(0);
         if ($this->indexContent) {
             if ($this->indexContent) {
                 $metaFields[] = "ajxp_document_content";
             }
             $data = array("indexed_meta_fields" => $metaFields, "additionnal_meta_columns" => array("ajxp_document_content" => "Content"));
             $el->setAttribute("indexed_meta_fields", json_encode($data));
         } else {
             $el->setAttribute("indexed_meta_fields", json_encode($metaFields));
         }
     }
     parent::init($this->options);
 }
Esempio n. 3
0
 public function initMeta($accessDriver)
 {
     require_once "svn_lib.inc.php";
     parent::initMeta($accessDriver);
     parent::init($this->options);
 }
 public function init($options)
 {
     $this->sqlDriver = AJXP_Utils::cleanDibiDriverParameters(array("group_switch_value" => "core"));
     parent::init($options);
 }
 public function initMeta($accessDriver)
 {
     parent::initMeta($accessDriver);
     $store = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("metastore");
     if ($store === false) {
         throw new Exception("The 'meta.user' plugin requires at least one active 'metastore' plugin");
     }
     $this->metaStore = $store;
     $this->metaStore->initMeta($accessDriver);
     //$messages = ConfService::getMessages();
     $def = $this->getMetaDefinition();
     foreach ($def as $k => &$d) {
         if (isset($this->fieldsAdditionalData[$k])) {
             $d["data"] = $this->fieldsAdditionalData[$k];
         }
     }
     $this->exposeConfigInManifest("meta_definitions", json_encode($def));
     if (!isset($this->options["meta_visibility"])) {
         $visibilities = array("visible");
     } else {
         $visibilities = explode(",", $this->options["meta_visibility"]);
     }
     $editButton = '';
     $u = AuthService::getLoggedUser();
     if ($u != null && $u->canWrite($this->accessDriver->repository->getId())) {
         $editButton = '<span class="icon-edit" data-ajxpAction="edit_user_meta" title="AJXP_MESSAGE[meta.user.1]"></span><span class="user_meta_change" style="display: none;" data-ajxpAction="edit_user_meta" title="AJXP_MESSAGE[meta.user.1]">AJXP_MESSAGE[457]</span>';
     }
     $cdataHead = '<div>
                     <div class="panelHeader infoPanelGroup" colspan="2">' . $editButton . 'AJXP_MESSAGE[meta.user.1]</div>
                  ';
     $cdataFoot = '</div>';
     $cdataParts = "";
     $selection = $this->getXPath()->query('registry_contributions/client_configs/component_config[@className="FilesList"]/columns');
     $contrib = $selection->item(0);
     $even = false;
     $searchables = array();
     $searchablesRenderers = array();
     $index = 0;
     $fieldType = "text";
     foreach ($def as $key => $data) {
         $label = $data["label"];
         $fieldType = $data["type"];
         if (isset($visibilities[$index])) {
             $lastVisibility = $visibilities[$index];
         }
         $index++;
         $col = $this->manifestDoc->createElement("additional_column");
         $col->setAttribute("messageString", $label);
         $col->setAttribute("attributeName", $key);
         $col->setAttribute("sortType", "String");
         if (isset($lastVisibility)) {
             $col->setAttribute("defaultVisibilty", $lastVisibility);
         }
         switch ($fieldType) {
             case "stars_rate":
                 $col->setAttribute("modifier", "MetaCellRenderer.prototype.starsRateFilter");
                 $col->setAttribute("sortType", "CellSorterValue");
                 $searchables[$key] = $label;
                 $searchablesRenderers[$key] = "MetaCellRenderer.prototype.formPanelStars";
                 break;
             case "css_label":
                 $col->setAttribute("modifier", "MetaCellRenderer.prototype.cssLabelsFilter");
                 $col->setAttribute("sortType", "CellSorterValue");
                 $searchables[$key] = $label;
                 $searchablesRenderers[$key] = "MetaCellRenderer.prototype.formPanelCssLabels";
                 break;
             case "textarea":
                 $searchables[$key] = $label;
                 break;
             case "string":
                 $searchables[$key] = $label;
                 break;
             case "choice":
                 $searchables[$key] = $label;
                 $col->setAttribute("modifier", "MetaCellRenderer.prototype.selectorsFilter");
                 $col->setAttribute("sortType", "CellSorterValue");
                 $col->setAttribute("metaAdditional", $this->fieldsAdditionalData[$key]);
                 $searchablesRenderers[$key] = "MetaCellRenderer.prototype.formPanelSelectorFilter";
                 break;
             case "tags":
                 $searchables[$key] = $label;
                 $searchablesRenderers[$key] = "MetaCellRenderer.prototype.formPanelTags";
                 break;
             default:
                 break;
         }
         $contrib->appendChild($col);
         $trClass = $even ? " class=\"even infoPanelRow\"" : " class=\"infoPanelRow\"";
         $even = !$even;
         $cdataParts .= '<div' . $trClass . '><div class="infoPanelLabel">' . $label . '</div><div class="infoPanelValue" data-metaType="' . $fieldType . '" id="ip_' . $key . '">#{' . $key . '}</div></div>';
     }
     $selection = $this->getXPath()->query('registry_contributions/client_configs/component_config[@className="InfoPanel"]/infoPanelExtension');
     $contrib = $selection->item(0);
     $contrib->setAttribute("attributes", implode(",", array_keys($def)));
     if (!empty($this->fieldsAdditionalData)) {
         $contrib->setAttribute("metaAdditional", json_encode($this->fieldsAdditionalData));
     }
     $contrib->setAttribute("modifier", "MetaCellRenderer.prototype.infoPanelModifier");
     $htmlSel = $this->getXPath()->query('html', $contrib);
     $html = $htmlSel->item(0);
     $cdata = $this->manifestDoc->createCDATASection($cdataHead . $cdataParts . $cdataFoot);
     $html->appendChild($cdata);
     $selection = $this->getXPath()->query('registry_contributions/client_configs/template_part[@ajxpClass="SearchEngine"]');
     foreach ($selection as $tag) {
         $v = $tag->attributes->getNamedItem("ajxpOptions")->nodeValue;
         $metaV = count($searchables) ? '"metaColumns":' . json_encode($searchables) : "";
         if (count($searchablesRenderers)) {
             $metaV .= ',"metaColumnsRenderers":' . json_encode($searchablesRenderers);
         }
         if (!empty($v) && trim($v) != "{}" && !empty($metaV)) {
             $v = str_replace("}", ", " . $metaV . "}", $v);
         } else {
             $v = "{" . $metaV . "}";
         }
         $tag->setAttribute("ajxpOptions", $v);
     }
     parent::init($this->options);
 }