18 require_once SQ_INCLUDE_PATH.
'/asset.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/data_source/data_source/data_source.inc';
20 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
21 require_once SQ_PACKAGES_PATH.
'/sharepoint/lib/sharepoint_common.inc';
46 parent::__construct($assetid);
48 $this->_ser_attrs = TRUE;
49 $this->search_clauses = NULL;
66 if (!parent::_createAdditional($link))
return FALSE;
67 $this->
setAttrValue(
'shadow_name',
'%ds__ows_FileLeafRef%');
90 $allowed_link[
'asset'][
'card'] =
'M';
91 $allowed_link[
'asset'][
'exclusive'] = FALSE;
93 $links[SQ_LINK_TYPE_1] = $allowed_link;
94 $links[SQ_LINK_TYPE_2] = $allowed_link;
95 $links[SQ_LINK_TYPE_3] = $allowed_link;
96 $links[SQ_LINK_NOTICE] = $allowed_link;
113 $data_list = $this->
attr(
'data_list');
114 if (!empty($data_list) && $data_list !=
'None') {
116 if (empty($result)) {
120 $all_lists = Array();
121 $lists_fields = Array();
122 $list_names = Array();
129 $list_names += $sp_lists;
132 $search_crits = $this->
attr(
'search_options');
133 $search_logic = $this->
attr(
'search_logic');
134 $row_limit = $this->
attr(
'row_limit');
135 $search_crit = isset($search_crits[$data_list]) ? $search_crits[$data_list] : Array();
136 $download_file = $this->
attr(
'download_file');
137 $bridge_info = $download_file ? Array(
'data_path' => $this->data_path,
'url' => $this->
getURL()) : Array();
140 if (!empty($result)) sort($result);
143 }
catch (SoapFault $sf) {
145 if (isset($sf->detail)) $detail = $sf->detail;
146 trigger_error($sf->getMessage().
'.'.$detail, E_USER_WARNING);
166 $result = $this->
attr(
'cached_result');
167 if (isset($result[$hash_key])) {
168 return $result[$hash_key];
187 $cached_result = $this->
attr(
'cached_result');
188 $cached_result[$hash_key] = $result;
189 $GLOBALS[
'SQ_SYSTEM']->am->acquireLock($this->
id,
'attributes');
193 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($this->
id,
'attributes');
210 $result = $this->
attr(
'cached_result');
211 if (isset($result[$hash])) {
212 unset($result[$hash]);
216 if (!empty($new_result)) {
238 $hash = md5(
'resultSet');
253 $connector_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, SQ_LINK_NOTICE,
'sharepoint_connector', FALSE,
'sharepoint_connector');
254 if (!empty($connector_link)) {
255 $connector = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($connector_link[
'minorid']);
260 $connection = Array();
261 $connection[
'url'] = $connector->attr(
'url');
262 $connection[
'authentication'] = Array (
263 'login' => $connector->attr(
'username'),
264 'password' => $connector->attr(
'password'),
284 $dynamic_vars = $this->
attr(
'dynamic_vars');
285 if (!isset($dynamic_vars[$variable_name]))
return '';
288 $value = $parameter_map->getParameterValue($variable_name);
291 $value = array_get_index($dynamic_vars, $variable_name,
'');
308 if (isset($_GET[
'synch_now']) && !empty($_GET[
'synch_now'])) {
319 if (isset($_GET[
'file_uri']) && !empty($_GET[
'file_uri'])) {
321 trigger_error(
'Cannot find the given file '.$_GET[
'file_uri'], E_USER_WARNING);
343 if ($name ==
'data_list' || $name ==
'row_limit' || $name ==
'search_logic' || $name ==
'download_file') {
344 $res_val = parent::setAttrValue($name, $value);
348 return parent::setAttrValue($name, $value);
367 public function getAsset($assetid, $type_code=
'', $mute_errors=FALSE)
369 $asset = parent::getAsset($assetid, $type_code=
'', $mute_errors=FALSE);
370 if (isset($_REQUEST[
'a']) && isset($_REQUEST[
'a']) == $assetid) {
372 if (!is_null($asset)) {
373 if (isset($asset->vars[
'Uri']) && !empty($asset->vars[
'Uri'])) {
374 if ($this->getAttachedFile(($asset->vars[
'Uri']))) {
395 require_once SQ_FUDGE_PATH.
'/standards_lists/mime_types.inc';
397 $GLOBALS[
'SQ_SYSTEM']->setGlobalDefine(
'SQ_REPLACE_MYSOURCE_LEVEL_KEYWORDS', FALSE);
399 $file_path = $this->data_path.
'/'.$uri;
400 if (!file_exists($file_path)) {
404 $file_info = pathinfo($file_path);
405 if (empty($file_info)) {
409 $ext = strtolower($file_info[
'extension']);
410 $type = (empty($standards_lists_mime_types[$ext])) ?
'text/plain' : $standards_lists_mime_types[$ext];
413 header(
"Pragma: public");
414 header(
"Expires: 0");
415 header(
"Cache-Control: must-revalidate, post-check=0, pre-check=0");
416 header(
"Cache-Control: private",
false);
419 header(
'Content-Type: '.$type);
422 header(
'Content-Disposition: attachment; filename="'.$file_info[
'basename'].
'";');
423 header(
'Content-Length: '.filesize($file_path));
426 readfile($file_path);