Révision 6eb8d15f
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/imce/imce.info | ||
---|---|---|
4 | 4 |
package = "Media" |
5 | 5 |
configure = "admin/config/media/imce" |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2013-12-17
|
|
8 |
version = "7.x-1.8"
|
|
7 |
; Information added by Drupal.org packaging script on 2014-05-16
|
|
8 |
version = "7.x-1.9"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "imce" |
11 |
datestamp = "1387302359"
|
|
11 |
datestamp = "1400275428"
|
|
12 | 12 |
|
drupal7/sites/all/modules/imce/imce.install | ||
---|---|---|
101 | 101 |
db_drop_table('imce_files'); |
102 | 102 |
return t('Migrated IMCE files.'); |
103 | 103 |
} |
104 |
} |
|
105 |
|
|
106 |
/** |
|
107 |
* Fixes misconfigurations where anonymous user is given User-1 profile |
|
108 |
*/ |
|
109 |
function imce_update_7002() { |
|
110 |
$roles = variable_get('imce_roles_profiles', array()); |
|
111 |
$rid = DRUPAL_ANONYMOUS_RID; |
|
112 |
if (!empty($roles[$rid])) { |
|
113 |
$update = FALSE; |
|
114 |
foreach ($roles[$rid] as $key => $value) { |
|
115 |
if ($value == 1 && substr($key, -4) == '_pid') { |
|
116 |
$roles[$rid][$key] = '0'; |
|
117 |
$update = TRUE; |
|
118 |
} |
|
119 |
} |
|
120 |
if ($update) { |
|
121 |
variable_set('imce_roles_profiles', $roles); |
|
122 |
} |
|
123 |
} |
|
104 | 124 |
} |
drupal7/sites/all/modules/imce/inc/imce.admin.inc | ||
---|---|---|
35 | 35 |
'#attributes' => array('id' => 'imce-profiles-list'), |
36 | 36 |
); |
37 | 37 |
$output['form'] = drupal_get_form('imce_admin_form'); |
38 |
|
|
39 |
// Display security warnings |
|
40 |
if (empty($_POST)) { |
|
41 |
$roles = variable_get('imce_roles_profiles', array()); |
|
42 |
if (!empty($roles[DRUPAL_ANONYMOUS_RID]['public_pid']) || !empty($roles[DRUPAL_ANONYMOUS_RID]['private_pid'])) { |
|
43 |
drupal_set_message(t('Anonymous user role has access to IMCE.') . ' ' . t('Make sure this is not a misconfiguration.'), 'warning'); |
|
44 |
} |
|
45 |
if (imce_admin_check_wildcard_upload(DRUPAL_AUTHENTICATED_RID, $roles)) { |
|
46 |
drupal_set_message(t('Authenticated user role is assigned a configuration profile with unrestricted file extensions.') . ' ' . t('Make sure this is not a misconfiguration.'), 'warning'); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
38 | 50 |
return $output; |
39 | 51 |
} |
40 | 52 |
|
... | ... | |
146 | 158 |
return $output; |
147 | 159 |
} |
148 | 160 |
|
161 |
/** |
|
162 |
* Validate admin form. |
|
163 |
*/ |
|
164 |
function imce_admin_form_validate($form, &$form_state) { |
|
165 |
$roles = $form_state['values']['roles']; |
|
166 |
// Check anonymous profile. Do not allow wildcard upload. |
|
167 |
if ($key = imce_admin_check_wildcard_upload(DRUPAL_ANONYMOUS_RID, $roles)) { |
|
168 |
form_error($form['roles'][DRUPAL_ANONYMOUS_RID][$key], t('Anonymous user role can not have a configuration profile with unrestricted file extensions.')); |
|
169 |
} |
|
170 |
} |
|
171 |
|
|
149 | 172 |
/** |
150 | 173 |
* Submit admin form. |
151 | 174 |
*/ |
... | ... | |
173 | 196 |
return drupal_get_form('imce_profile_delete_form', $pid); |
174 | 197 |
} |
175 | 198 |
//add-edit |
176 |
if ($pid != 1 || $GLOBALS['user']->uid == 1) {
|
|
199 |
if ($op === 'add' || $op === 'edit') {
|
|
177 | 200 |
return drupal_get_form('imce_profile_form', $pid); |
178 | 201 |
} |
179 | 202 |
drupal_access_denied(); |
... | ... | |
688 | 711 |
return $r1['weight']-$r2['weight']; |
689 | 712 |
} |
690 | 713 |
|
714 |
/** |
|
715 |
* Checks if the given role can upload all extensions. |
|
716 |
*/ |
|
717 |
function imce_admin_check_wildcard_upload($rid, $conf = NULL) { |
|
718 |
if (!isset($conf)) { |
|
719 |
$conf = variable_get('imce_roles_profiles', array()); |
|
720 |
} |
|
721 |
if (!empty($conf[$rid])) { |
|
722 |
foreach ($conf[$rid] as $key => $pid) { |
|
723 |
if ($pid && substr($key, -4) == '_pid') { |
|
724 |
if ($profile = imce_load_profile($pid)) { |
|
725 |
if ($profile['extensions'] === '*' && !empty($profile['directories'])) { |
|
726 |
foreach ($profile['directories'] as $dirconf) { |
|
727 |
if (!empty($dirconf['upload'])) { |
|
728 |
return $key; |
|
729 |
} |
|
730 |
} |
|
731 |
} |
|
732 |
} |
|
733 |
} |
|
734 |
} |
|
735 |
} |
|
736 |
return FALSE; |
|
737 |
} |
|
738 |
|
|
691 | 739 |
//Include core profile functions. |
692 | 740 |
include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'imce') . '/inc/imce.core.profiles.inc'; |
drupal7/sites/all/modules/imce/inc/imce.page.inc | ||
---|---|---|
116 | 116 |
//disable devel log. |
117 | 117 |
$GLOBALS['devel_shutdown'] = FALSE; |
118 | 118 |
//for upload we must return plain text header. |
119 |
drupal_add_http_header('Content-Type', 'text/' . ($jsop == 'upload' ? 'html' : 'javascript') . '; charset=utf-8');
|
|
119 |
drupal_add_http_header('Content-Type', (!empty($_POST['html_response']) ? 'text/html' : 'application/json') . '; charset=utf-8');
|
|
120 | 120 |
print drupal_json_encode($response); |
121 | 121 |
exit(); |
122 | 122 |
} |
... | ... | |
144 | 144 |
'#submit' => $imce['perm']['upload'] ? array('imce_upload_submit') : NULL, |
145 | 145 |
); |
146 | 146 |
$form = array('fset_upload' => array('#type' => 'fieldset', '#title' => t('Upload file')) + $form); |
147 |
$form['html_response'] = array('#type' => 'hidden', '#default_value' => '1'); |
|
147 | 148 |
$form['#attributes']['enctype'] = 'multipart/form-data'; |
148 | 149 |
$form['#action'] = $imce['url']; |
149 | 150 |
return $form; |
drupal7/sites/all/modules/imce/js/imce.js | ||
---|---|---|
7 | 7 |
//initiate imce. |
8 | 8 |
initiate: function() { |
9 | 9 |
imce.conf = Drupal.settings.imce || {}; |
10 |
imce.ie = (navigator.userAgent.match(/msie (\d+)/i) || ['', 0])[1] * 1; |
|
11 | 10 |
if (imce.conf.error != false) return; |
11 |
imce.ie = (navigator.userAgent.match(/msie (\d+)/i) || ['', 0])[1] * 1; |
|
12 | 12 |
imce.FLW = imce.el('file-list-wrapper'), imce.SBW = imce.el('sub-browse-wrapper'); |
13 | 13 |
imce.NW = imce.el('navigation-wrapper'), imce.BW = imce.el('browse-wrapper'); |
14 | 14 |
imce.PW = imce.el('preview-wrapper'), imce.FW = imce.el('forms-wrapper'); |
... | ... | |
19 | 19 |
imce.initiateList();//process file list |
20 | 20 |
imce.initiateOps();//prepare operation tabs |
21 | 21 |
imce.refreshOps(); |
22 |
// Bind global error handler |
|
23 |
$(document).ajaxError(imce.ajaxError); |
|
22 | 24 |
imce.invoke('load', window);//run functions set by external applications. |
23 | 25 |
}, |
24 | 26 |
|
... | ... | |
241 | 243 |
|
242 | 244 |
//convert upload form to an op. |
243 | 245 |
setUploadOp: function () { |
244 |
var form = imce.el('imce-upload-form'); |
|
246 |
var el, form = imce.el('imce-upload-form');
|
|
245 | 247 |
if (!form) return; |
246 | 248 |
$(form).ajaxForm(imce.uploadSettings()).find('fieldset').each(function() {//clean up fieldsets |
247 | 249 |
this.removeChild(this.firstChild); |
248 | 250 |
$(this).after(this.childNodes); |
249 | 251 |
}).remove(); |
252 |
// Set html response flag |
|
253 |
el = form.elements['files[imce]']; |
|
254 |
if (el && el.files && window.FormData) { |
|
255 |
if (el = form.elements.html_response) { |
|
256 |
el.value = 0; |
|
257 |
} |
|
258 |
} |
|
250 | 259 |
imce.opAdd({name: 'upload', title: Drupal.t('Upload'), content: form});//add op |
251 | 260 |
}, |
252 | 261 |
|
... | ... | |
257 | 266 |
$(form.elements.filenames).parent().remove(); |
258 | 267 |
$(form).find('fieldset').each(function() {//remove fieldsets |
259 | 268 |
var $sbmt = $('input:submit', this); |
260 |
if (!$sbmt.size()) return;
|
|
269 |
if (!$sbmt.length) return;
|
|
261 | 270 |
var Op = {name: $sbmt.attr('id').substr(5)}; |
262 | 271 |
var func = function() {imce.fopSubmit(Op.name); return false;}; |
263 | 272 |
$sbmt.click(func); |
... | ... | |
279 | 288 |
//add a new file operation |
280 | 289 |
opAdd: function (op) { |
281 | 290 |
var oplist = imce.el('ops-list'), opcons = imce.el('op-contents'); |
282 |
var name = op.name || ('op-'+ $(oplist).children('li').size());
|
|
291 |
var name = op.name || ('op-'+ $(oplist).children('li').length);
|
|
283 | 292 |
var title = op.title || 'Untitled'; |
284 | 293 |
var Op = imce.ops[name] = {title: title}; |
285 | 294 |
if (op.content) { |
... | ... | |
323 | 332 |
var $inputs = $('input', imce.ops[imce.vars.op].div); |
324 | 333 |
$inputs.eq(0).focus(); |
325 | 334 |
//form inputs become invisible in IE. Solution is as stupid as the behavior. |
326 |
$('html').is('.ie') && $inputs.addClass('dummyie').removeClass('dummyie');
|
|
335 |
$('html').hasClass('ie') && $inputs.addClass('dummyie').removeClass('dummyie');
|
|
327 | 336 |
} |
328 | 337 |
}); |
329 | 338 |
}); |
... | ... | |
439 | 448 |
|
440 | 449 |
//settings for upload |
441 | 450 |
uploadSettings: function () { |
442 |
return {beforeSubmit: imce.uploadValidate, success: function (response) {imce.processResponse($.parseJSON(response));}, complete: function () {imce.fopLoading('upload', false);}, resetForm: true}; |
|
451 |
return { |
|
452 |
beforeSubmit: imce.uploadValidate, |
|
453 |
success: function (response) { |
|
454 |
try{ |
|
455 |
imce.processResponse($.parseJSON(response)); |
|
456 |
} catch(e) {} |
|
457 |
}, |
|
458 |
complete: function () { |
|
459 |
imce.fopLoading('upload', false); |
|
460 |
}, |
|
461 |
resetForm: true, |
|
462 |
dataType: 'text' |
|
463 |
}; |
|
443 | 464 |
}, |
444 | 465 |
|
445 | 466 |
//validate default ops(delete, thumb, resize) |
... | ... | |
449 | 470 |
case 'delete': |
450 | 471 |
return confirm(Drupal.t('Delete selected files?')); |
451 | 472 |
case 'thumb': |
452 |
if (!$('input:checked', imce.ops['thumb'].div).size()) {
|
|
473 |
if (!$('input:checked', imce.ops['thumb'].div).length) {
|
|
453 | 474 |
return imce.setMessage(Drupal.t('Please select a thumbnail.'), 'error'); |
454 | 475 |
} |
455 | 476 |
return imce.validateImage(); |
... | ... | |
486 | 507 |
|
487 | 508 |
//settings for default file operations |
488 | 509 |
fopSettings: function (fop) { |
489 |
return {url: imce.ajaxURL(fop), type: 'POST', dataType: 'json', success: imce.processResponse, complete: function (response) {imce.fopLoading(fop, false);}, data: imce.vars.opform +'&filenames='+ escape(imce.serialNames()) +'&jsop='+ fop + (imce.ops[fop].div ? '&'+ $('input, select, textarea', imce.ops[fop].div).serialize() : '')};
|
|
510 |
return {url: imce.ajaxURL(fop), type: 'POST', dataType: 'json', success: imce.processResponse, complete: function (response) {imce.fopLoading(fop, false);}, data: imce.vars.opform +'&filenames='+ encodeURIComponent(imce.serialNames()) +'&jsop='+ fop + (imce.ops[fop].div ? '&'+ $('input, select, textarea', imce.ops[fop].div).serialize() : '')};
|
|
490 | 511 |
}, |
491 | 512 |
|
492 | 513 |
//toggle loading state |
... | ... | |
536 | 557 |
$('>div', msgs).each(function (){ |
537 | 558 |
var type = this.className.split(' ')[1]; |
538 | 559 |
var li = $('>ul li', this); |
539 |
if (li.size()) li.each(function () {imce.setMessage(this.innerHTML, type);});
|
|
560 |
if (li.length) li.each(function () {imce.setMessage(this.innerHTML, type);});
|
|
540 | 561 |
else imce.setMessage(this.innerHTML, type); |
541 | 562 |
}); |
542 | 563 |
$(msgs).remove(); |
... | ... | |
703 | 724 |
|
704 | 725 |
//decode urls. uses unescape. can be overridden to use decodeURIComponent |
705 | 726 |
decode: function (str) { |
706 |
return unescape(str); |
|
727 |
try { |
|
728 |
return decodeURIComponent(str); |
|
729 |
} catch(e) {} |
|
730 |
return str; |
|
707 | 731 |
}, |
708 | 732 |
|
709 | 733 |
//decode and convert to plain text |
... | ... | |
771 | 795 |
return false; |
772 | 796 |
}).appendTo('#op-contents')[0]; |
773 | 797 |
//navigation-header |
774 |
if (!$('#navigation-header').size()) {
|
|
798 |
if (!$('#navigation-header').length) {
|
|
775 | 799 |
$(imce.NW).children('.navigation-text').attr('id', 'navigation-header').wrapInner('<span></span>'); |
776 | 800 |
} |
777 | 801 |
//log |
... | ... | |
801 | 825 |
}; |
802 | 826 |
|
803 | 827 |
//initiate |
804 |
$(document).ready(imce.initiate).ajaxError(imce.ajaxError);
|
|
828 |
$(document).ready(imce.initiate); |
|
805 | 829 |
|
806 | 830 |
})(jQuery); |
drupal7/sites/all/modules/imce/js/imce_extras.js | ||
---|---|---|
180 | 180 |
//get&set area dimensions of the last session from the cookie |
181 | 181 |
imce.recallDimensions = function() { |
182 | 182 |
var $body = $(document.body); |
183 |
if (!$body.is('.imce')) return;
|
|
183 |
if (!$body.hasClass('imce')) return;
|
|
184 | 184 |
//row heights |
185 | 185 |
imce.recallHeights(imce.cookie('imcebwh') * 1); |
186 | 186 |
$(window).resize(function(){imce.recallHeights()}); |
... | ... | |
214 | 214 |
//cookie get & set |
215 | 215 |
imce.cookie = function (name, value) { |
216 | 216 |
if (typeof(value) == 'undefined') {//get |
217 |
return unescape((document.cookie.match(new RegExp('(^|;) *'+ name +'=([^;]*)(;|$)')) || ['', '', ''])[2]);
|
|
217 |
return document.cookie ? imce.decode((document.cookie.match(new RegExp('(?:^|;) *' + name + '=([^;]*)(?:;|$)')) || ['', ''])[1].replace(/\+/g, '%20')) : '';
|
|
218 | 218 |
} |
219 |
document.cookie = name +'='+ escape(value) +'; expires='+ (new Date(new Date() * 1 + 15 * 86400000)).toGMTString() +'; path=' + Drupal.settings.basePath + 'imce';//set
|
|
219 |
document.cookie = name +'='+ encodeURIComponent(value) +'; expires='+ (new Date(new Date() * 1 + 15 * 86400000)).toUTCString() +'; path=' + Drupal.settings.basePath + 'imce';//set
|
|
220 | 220 |
}; |
221 | 221 |
|
222 | 222 |
//view thumbnails(smaller than tMaxW x tMaxH) inside the rows. |
drupal7/sites/all/modules/imce/js/imce_set_app.js | ||
---|---|---|
53 | 53 |
if (appFields.url.indexOf(',') > -1) { |
54 | 54 |
var arr = appFields.url.split(','); |
55 | 55 |
for (var i in arr) { |
56 |
if ($('#'+ arr[i], appWindow.document).size()) {
|
|
56 |
if ($('#'+ arr[i], appWindow.document).length) {
|
|
57 | 57 |
appFields.url = arr[i]; |
58 | 58 |
break; |
59 | 59 |
} |
drupal7/sites/all/modules/imce/js/imce_set_inline.js | ||
---|---|---|
21 | 21 |
//function to be executed when imce loads. |
22 | 22 |
ii.load = function(win) { |
23 | 23 |
win.imce.setSendTo(Drupal.t('Insert file'), ii.insert); |
24 |
$(window).unload(function() {
|
|
24 |
$(window).bind('unload', function() {
|
|
25 | 25 |
if (ii.pop && !ii.pop.closed) ii.pop.close(); |
26 | 26 |
}); |
27 | 27 |
}; |
drupal7/sites/all/modules/imce/js/jquery.form.js | ||
---|---|---|
1 |
/* |
|
1 |
/*!
|
|
2 | 2 |
* jQuery Form Plugin |
3 |
* version: 2.67 (12-MAR-2011)
|
|
3 |
* version: 3.17 (25-SEP-2012)
|
|
4 | 4 |
* @requires jQuery v1.3.2 or later |
5 | 5 |
*/ |
6 |
(function(b){b.fn.ajaxSubmit=function(t){if(!this.length){a("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof t=="function"){t={success:t}}var h=this.attr("action");var d=(typeof h==="string")?b.trim(h):"";if(d){d=(d.match(/^([^#]+)/)||[])[1]}d=d||window.location.href||"";t=b.extend(true,{url:d,type:this[0].getAttribute("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var u={};this.trigger("form-pre-serialize",[this,t,u]);if(u.veto){a("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(t.beforeSerialize&&t.beforeSerialize(this,t)===false){a("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var f,p,m=this.formToArray(t.semantic);if(t.data){t.extraData=t.data;for(f in t.data){if(t.data[f] instanceof Array){for(var i in t.data[f]){m.push({name:f,value:t.data[f][i]})}}else{p=t.data[f];p=b.isFunction(p)?p():p;m.push({name:f,value:p})}}}if(t.beforeSubmit&&t.beforeSubmit(m,this,t)===false){a("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[m,this,t,u]);if(u.veto){a("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var c=b.param(m);if(t.type.toUpperCase()=="GET"){t.url+=(t.url.indexOf("?")>=0?"&":"?")+c;t.data=null}else{t.data=c}var s=this,l=[];if(t.resetForm){l.push(function(){s.resetForm()})}if(t.clearForm){l.push(function(){s.clearForm()})}if(!t.dataType&&t.target){var r=t.success||function(){};l.push(function(n){var k=t.replaceTarget?"replaceWith":"html";b(t.target)[k](n).each(r,arguments)})}else{if(t.success){l.push(t.success)}}t.success=function(w,n,x){var v=t.context||t;for(var q=0,k=l.length;q<k;q++){l[q].apply(v,[w,n,x||s,s])}};var g=b("input:file",this).length>0;var e="multipart/form-data";var j=(s.attr("enctype")==e||s.attr("encoding")==e);if(t.iframe!==false&&(g||t.iframe||j)){if(t.closeKeepAlive){b.get(t.closeKeepAlive,o)}else{o()}}else{b.ajax(t)}this.trigger("form-submit-notify",[this,t]);return this;function o(){var v=s[0];if(b(":input[name=submit],:input[id=submit]",v).length){alert('Error: Form elements must not have name or id of "submit".');return}var B=b.extend(true,{},b.ajaxSettings,t);B.context=B.context||B;var E="jqFormIO"+(new Date().getTime()),z="_"+E;var w=b('<iframe id="'+E+'" name="'+E+'" src="'+B.iframeSrc+'" />');var A=w[0];w.css({position:"absolute",top:"-1000px",left:"-1000px"});var x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){a("aborting upload...");var n="aborted";this.aborted=1;w.attr("src",B.iframeSrc);x.error=n;B.error&&B.error.call(B.context,x,"error",n);I&&b.event.trigger("ajaxError",[x,B,n]);B.complete&&B.complete.call(B.context,x,"error")}};var I=B.global;if(I&&!b.active++){b.event.trigger("ajaxStart")}if(I){b.event.trigger("ajaxSend",[x,B])}if(B.beforeSend&&B.beforeSend.call(B.context,x,B)===false){if(B.global){b.active--}return}if(x.aborted){return}var H=0;var y=v.clk;if(y){var F=y.name;if(F&&!y.disabled){B.extraData=B.extraData||{};B.extraData[F]=y.value;if(y.type=="image"){B.extraData[F+".x"]=v.clk_x;B.extraData[F+".y"]=v.clk_y}}}function G(){var O=s.attr("target"),M=s.attr("action");v.setAttribute("target",E);if(v.getAttribute("method")!="POST"){v.setAttribute("method","POST")}if(v.getAttribute("action")!=B.url){v.setAttribute("action",B.url)}if(!B.skipEncodingOverride){s.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(B.timeout){setTimeout(function(){H=true;D()},B.timeout)}var N=[];try{if(B.extraData){for(var P in B.extraData){N.push(b('<input type="hidden" name="'+P+'" value="'+B.extraData[P]+'" />').appendTo(v)[0])}}w.appendTo("body");A.attachEvent?A.attachEvent("onload",D):A.addEventListener("load",D,false);v.submit()}finally{v.setAttribute("action",M);if(O){v.setAttribute("target",O)}else{s.removeAttr("target")}b(N).remove()}}if(B.forceSync){G()}else{setTimeout(G,10)}var K,L,J=50;function D(){if(x.aborted){return}var R=A.contentWindow?A.contentWindow.document:A.contentDocument?A.contentDocument:A.document;if(!R||R.location.href==B.iframeSrc){return}A.detachEvent?A.detachEvent("onload",D):A.removeEventListener("load",D,false);var N=true;try{if(H){throw"timeout"}var S=B.dataType=="xml"||R.XMLDocument||b.isXMLDoc(R);a("isXml="+S);if(!S&&window.opera&&(R.body==null||R.body.innerHTML=="")){if(--J){a("requeing onLoad callback, DOM not available");setTimeout(D,250);return}}x.responseText=R.body?R.body.innerHTML:R.documentElement?R.documentElement.innerHTML:null;x.responseXML=R.XMLDocument?R.XMLDocument:R;x.getResponseHeader=function(U){var T={"content-type":B.dataType};return T[U]};var Q=/(json|script)/.test(B.dataType);if(Q||B.textarea){var M=R.getElementsByTagName("textarea")[0];if(M){x.responseText=M.value}else{if(Q){var P=R.getElementsByTagName("pre")[0];var n=R.getElementsByTagName("body")[0];if(P){x.responseText=P.textContent}else{if(n){x.responseText=n.innerHTML}}}}}else{if(B.dataType=="xml"&&!x.responseXML&&x.responseText!=null){x.responseXML=C(x.responseText)}}K=k(x,B.dataType,B)}catch(O){a("error caught:",O);N=false;x.error=O;B.error&&B.error.call(B.context,x,"error",O);I&&b.event.trigger("ajaxError",[x,B,O])}if(x.aborted){a("upload aborted");N=false}if(N){B.success&&B.success.call(B.context,K,"success",x);I&&b.event.trigger("ajaxSuccess",[x,B])}I&&b.event.trigger("ajaxComplete",[x,B]);if(I&&!--b.active){b.event.trigger("ajaxStop")}B.complete&&B.complete.call(B.context,x,N?"success":"error");setTimeout(function(){w.removeData("form-plugin-onload");w.remove();x.responseXML=null},100)}var C=b.parseXML||function(n,M){if(window.ActiveXObject){M=new ActiveXObject("Microsoft.XMLDOM");M.async="false";M.loadXML(n)}else{M=(new DOMParser()).parseFromString(n,"text/xml")}return(M&&M.documentElement&&M.documentElement.nodeName!="parsererror")?M:null};var q=b.parseJSON||function(n){return window["eval"]("("+n+")")};var k=function(Q,O,N){var M=Q.getResponseHeader("content-type")||"",n=O==="xml"||!O&&M.indexOf("xml")>=0,P=n?Q.responseXML:Q.responseText;if(n&&P.documentElement.nodeName==="parsererror"){b.error&&b.error("parsererror")}if(N&&N.dataFilter){P=N.dataFilter(P,O)}if(typeof P==="string"){if(O==="json"||!O&&M.indexOf("json")>=0){P=q(P)}else{if(O==="script"||!O&&M.indexOf("javascript")>=0){b.globalEval(P)}}}return P}}};b.fn.ajaxForm=function(c){if(this.length===0){var d={s:this.selector,c:this.context};if(!b.isReady&&d.s){a("DOM not ready, queuing ajaxForm");b(function(){b(d.s,d.c).ajaxForm(c)});return this}a("terminating; zero elements found by selector"+(b.isReady?"":" (DOM not ready)"));return this}return this.ajaxFormUnbind().bind("submit.form-plugin",function(f){if(!f.isDefaultPrevented()){f.preventDefault();b(this).ajaxSubmit(c)}}).bind("click.form-plugin",function(j){var i=j.target;var g=b(i);if(!(g.is(":submit,input:image"))){var f=g.closest(":submit");if(f.length==0){return}i=f[0]}var h=this;h.clk=i;if(i.type=="image"){if(j.offsetX!=undefined){h.clk_x=j.offsetX;h.clk_y=j.offsetY}else{if(typeof b.fn.offset=="function"){var k=g.offset();h.clk_x=j.pageX-k.left;h.clk_y=j.pageY-k.top}else{h.clk_x=j.pageX-i.offsetLeft;h.clk_y=j.pageY-i.offsetTop}}}setTimeout(function(){h.clk=h.clk_x=h.clk_y=null},100)})};b.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};b.fn.formToArray=function(q){var p=[];if(this.length===0){return p}var d=this[0];var g=q?d.getElementsByTagName("*"):d.elements;if(!g){return p}var k,h,f,r,e,m,c;for(k=0,m=g.length;k<m;k++){e=g[k];f=e.name;if(!f){continue}if(q&&d.clk&&e.type=="image"){if(!e.disabled&&d.clk==e){p.push({name:f,value:b(e).val()});p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}continue}r=b.fieldValue(e,true);if(r&&r.constructor==Array){for(h=0,c=r.length;h<c;h++){p.push({name:f,value:r[h]})}}else{if(r!==null&&typeof r!="undefined"){p.push({name:f,value:r})}}}if(!q&&d.clk){var l=b(d.clk),o=l[0];f=o.name;if(f&&!o.disabled&&o.type=="image"){p.push({name:f,value:l.val()});p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}}return p};b.fn.formSerialize=function(c){return b.param(this.formToArray(c))};b.fn.fieldSerialize=function(d){var c=[];this.each(function(){var h=this.name;if(!h){return}var f=b.fieldValue(this,d);if(f&&f.constructor==Array){for(var g=0,e=f.length;g<e;g++){c.push({name:h,value:f[g]})}}else{if(f!==null&&typeof f!="undefined"){c.push({name:this.name,value:f})}}});return b.param(c)};b.fn.fieldValue=function(h){for(var g=[],e=0,c=this.length;e<c;e++){var f=this[e];var d=b.fieldValue(f,h);if(d===null||typeof d=="undefined"||(d.constructor==Array&&!d.length)){continue}d.constructor==Array?b.merge(g,d):g.push(d)}return g};b.fieldValue=function(c,j){var e=c.name,p=c.type,q=c.tagName.toLowerCase();if(j===undefined){j=true}if(j&&(!e||c.disabled||p=="reset"||p=="button"||(p=="checkbox"||p=="radio")&&!c.checked||(p=="submit"||p=="image")&&c.form&&c.form.clk!=c||q=="select"&&c.selectedIndex==-1)){return null}if(q=="select"){var k=c.selectedIndex;if(k<0){return null}var m=[],d=c.options;var g=(p=="select-one");var l=(g?k+1:d.length);for(var f=(g?k:0);f<l;f++){var h=d[f];if(h.selected){var o=h.value;if(!o){o=(h.attributes&&h.attributes.value&&!(h.attributes.value.specified))?h.text:h.value}if(g){return o}m.push(o)}}return m}return b(c).val()};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea",this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var d=this.type,c=this.tagName.toLowerCase();if(d=="text"||d=="password"||c=="textarea"){this.value=""}else{if(d=="checkbox"||d=="radio"){this.checked=false}else{if(c=="select"){this.selectedIndex=-1}}}})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};b.fn.enable=function(c){if(c===undefined){c=true}return this.each(function(){this.disabled=!c})};b.fn.selected=function(c){if(c===undefined){c=true}return this.each(function(){var d=this.type;if(d=="checkbox"||d=="radio"){this.checked=c}else{if(this.tagName.toLowerCase()=="option"){var e=b(this).parent("select");if(c&&e[0]&&e[0].type=="select-one"){e.find("option").selected(false)}this.selected=c}}})};function a(){if(b.fn.ajaxSubmit.debug){var c="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(c)}else{if(window.opera&&window.opera.postError){window.opera.postError(c)}}}}})(jQuery); |
|
6 |
(function(c){'use strict';function v(a){var d=a.data;a.isDefaultPrevented()||(a.preventDefault(),c(a.target).ajaxSubmit(d))}function y(a){var d=a.target,g=c(d);if(!g.is(":submit,input:image")){d=g.closest(":submit");if(0===d.length)return;d=d[0]}var f=this;f.clk=d;"image"==d.type&&(void 0!==a.offsetX?(f.clk_x=a.offsetX,f.clk_y=a.offsetY):"function"==typeof c.fn.offset?(g=g.offset(),f.clk_x=a.pageX-g.left,f.clk_y=a.pageY-g.top):(f.clk_x=a.pageX-d.offsetLeft,f.clk_y=a.pageY-d.offsetTop));setTimeout(function(){f.clk= |
|
7 |
f.clk_x=f.clk_y=null},100)}function s(){if(c.fn.ajaxSubmit.debug){var a="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(a):window.opera&&window.opera.postError&&window.opera.postError(a)}}var x,z;x=void 0!==c("<input type='file'/>").get(0).files;z=void 0!==window.FormData;c.fn.ajaxSubmit=function(a){function d(b){b=c.param(b,a.traditional).replace(/\+/g," ").split("&");var f=b.length,h=[],d,e;for(d=0;d<f;d++)e=b[d].split("="),h.push([decodeURIComponent(e[0]), |
|
8 |
decodeURIComponent(e[1])]);return h}function g(b){for(var f=new FormData,g=0;g<b.length;g++)f.append(b[g].name,b[g].value);if(a.extraData)for(b=d(a.extraData),g=0;g<b.length;g++)f.append(b[g][0],b[g][1]);a.data=null;g=c.extend(!0,{},c.ajaxSettings,a,{contentType:!1,processData:!1,cache:!1,type:h||"POST"});a.uploadProgress&&(g.xhr=function(){var e=c.ajaxSettings.xhr();e.upload&&(e.upload.onprogress=function(c){var e=0,b=c.loaded||c.position,f=c.total;c.lengthComputable&&(e=Math.ceil(b/f*100));a.uploadProgress(c, |
|
9 |
b,f,e)});return e});g.data=null;var l=g.beforeSend;g.beforeSend=function(c,b){b.data=a.formData||f;l&&l.call(this,c,b)};return c.ajax(g)}function f(b){function f(){function a(){try{var c=(q.contentWindow?q.contentWindow.document:q.contentDocument?q.contentDocument:q.document).readyState;s("state = "+c);c&&"uninitialized"==c.toLowerCase()&&setTimeout(a,50)}catch(b){s("Server abort: ",b," (",b.name,")"),g(x),v&&clearTimeout(v),v=void 0}}var b=d.target,k=d.action,l=d.enctype||d.encoding||"multipart/form-data"; |
|
10 |
d.target=m;d.action=e.url;if(!h||/post/i.test(h))d.method="POST";e.skipEncodingOverride||h&&!/post/i.test(h)||(d.enctype="multipart/form-data");e.timeout&&(v=setTimeout(function(){w=!0;g(y)},e.timeout));var p=[];try{if(e.extraData)for(var n in e.extraData)e.extraData.hasOwnProperty(n)&&(e.extraData[n].constructor===Object&&e.extraData[n].hasOwnProperty("name")&&e.extraData[n].hasOwnProperty("value")?p.push(c('<input type="hidden" name="'+e.extraData[n].name+'">').val(e.extraData[n].value).appendTo(d)[0]): |
|
11 |
p.push(c('<input type="hidden" name="'+n+'">').val(e.extraData[n]).appendTo(d)[0]));e.iframeTarget||(r.appendTo("body"),q.attachEvent?q.attachEvent("onload",g):q.addEventListener("load",g,!1));setTimeout(a,15);d.submit.call?d.submit():document.createElement("form").submit.call(d)}finally{d.action=k,d.target=b,d.enctype=l,c(p).remove()}}function g(a){if(!k.aborted&&!C){try{t=q.contentWindow?q.contentWindow.document:q.contentDocument?q.contentDocument:q.document}catch(b){s("cannot access response document: ", |
|
12 |
b),a=x}if(a===y&&k)k.abort("timeout");else if(a==x&&k)k.abort("server abort");else if(t&&t.location.href!=e.iframeSrc||w){q.detachEvent?q.detachEvent("onload",g):q.removeEventListener("load",g,!1);a="success";var d;try{if(w)throw"timeout";var f="xml"==e.dataType||t.XMLDocument||c.isXMLDoc(t);s("isXml="+f);if(!f&&window.opera&&(null===t.body||!t.body.innerHTML)&&--E){s("requeing onLoad callback, DOM not available");setTimeout(g,250);return}var h=t.body?t.body:t.documentElement;k.responseText=h?h.innerHTML: |
|
13 |
null;k.responseXML=t.XMLDocument?t.XMLDocument:t;f&&(e.dataType="xml");k.getResponseHeader=function(a){return{"content-type":e.dataType}[a.toLowerCase()]};h&&(k.status=Number(h.getAttribute("status"))||k.status,k.statusText=h.getAttribute("statusText")||k.statusText);var m=(e.dataType||"").toLowerCase(),n=/(json|script|text)/.test(m);if(n||e.textarea){var p=t.getElementsByTagName("textarea")[0];if(p)k.responseText=p.value,k.status=Number(p.getAttribute("status"))||k.status,k.statusText=p.getAttribute("statusText")|| |
|
14 |
k.statusText;else if(n){var u=t.getElementsByTagName("pre")[0],A=t.getElementsByTagName("body")[0];u?k.responseText=u.textContent?u.textContent:u.innerText:A&&(k.responseText=A.textContent?A.textContent:A.innerText)}}else"xml"==m&&!k.responseXML&&k.responseText&&(k.responseXML=F(k.responseText));try{z=G(k,m,e)}catch(D){a="parsererror",k.error=d=D||a}}catch(B){s("error caught: ",B),a="error",k.error=d=B||a}k.aborted&&(s("upload aborted"),a=null);k.status&&(a=200<=k.status&&300>k.status||304===k.status? |
|
15 |
"success":"error");"success"===a?(e.success&&e.success.call(e.context,z,"success",k),l&&c.event.trigger("ajaxSuccess",[k,e])):a&&(void 0===d&&(d=k.statusText),e.error&&e.error.call(e.context,k,a,d),l&&c.event.trigger("ajaxError",[k,e,d]));l&&c.event.trigger("ajaxComplete",[k,e]);l&&!--c.active&&c.event.trigger("ajaxStop");e.complete&&e.complete.call(e.context,k,a);C=!0;e.timeout&&clearTimeout(v);setTimeout(function(){e.iframeTarget||r.remove();k.responseXML=null},100)}}}var d=n[0],e,l,m,r,q,k,u,w, |
|
16 |
v;if(b)for(b=0;b<p.length;b++)p[b].disabled=!1;e=c.extend(!0,{},c.ajaxSettings,a);e.context=e.context||e;m="jqFormIO"+(new Date).getTime();e.iframeTarget?(r=c(e.iframeTarget),(u=r[0].name)?m=u:r[0].name=m):(r=c('<iframe name="'+m+'" src="'+e.iframeSrc+'" />'),r.css({position:"absolute",top:"-1000px",left:"-1000px"}));q=r[0];k={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(a){var b= |
|
17 |
"timeout"===a?"timeout":"aborted";s("aborting upload... "+b);this.aborted=1;try{q.contentWindow.document.execCommand&&q.contentWindow.document.execCommand("Stop")}catch(d){}q.src=e.iframeSrc;k.error=b;e.error&&e.error.call(e.context,k,b,a);l&&c.event.trigger("ajaxError",[k,e,b]);e.complete&&e.complete.call(e.context,k,b)}};(l=e.global)&&0===c.active++&&c.event.trigger("ajaxStart");l&&c.event.trigger("ajaxSend",[k,e]);if(e.beforeSend&&!1===e.beforeSend.call(e.context,k,e))e.global&&c.active--;else if(!k.aborted){(b= |
|
18 |
d.clk)&&(u=b.name)&&!b.disabled&&(e.extraData=e.extraData||{},e.extraData[u]=b.value,"image"==b.type&&(e.extraData[u+".x"]=d.clk_x,e.extraData[u+".y"]=d.clk_y));var y=1,x=2;b=c("meta[name=csrf-token]").attr("content");(u=c("meta[name=csrf-param]").attr("content"))&&b&&(e.extraData=e.extraData||{},e.extraData[u]=b);e.forceSync?f():setTimeout(f,10);var z,t,E=50,C,F=c.parseXML||function(a,b){window.ActiveXObject?(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a)):b=(new DOMParser).parseFromString(a, |
|
19 |
"text/xml");return b&&b.documentElement&&"parsererror"!=b.documentElement.nodeName?b:null},H=c.parseJSON||function(a){return window.eval("("+a+")")},G=function(a,b,e){var d=a.getResponseHeader("content-type")||"",f="xml"===b||!b&&0<=d.indexOf("xml");a=f?a.responseXML:a.responseText;f&&"parsererror"===a.documentElement.nodeName&&c.error&&c.error("parsererror");e&&e.dataFilter&&(a=e.dataFilter(a,b));"string"===typeof a&&("json"===b||!b&&0<=d.indexOf("json")?a=H(a):("script"===b||!b&&0<=d.indexOf("javascript"))&& |
|
20 |
c.globalEval(a));return a}}}if(!this.length)return s("ajaxSubmit: skipping submit process - no element selected"),this;var h,b,n=this;a?"function"===typeof a&&(a={success:a}):a={};h=a.type||n[0].method;b=a.url||n[0].action;(b=(b="string"===typeof b?c.trim(b):"")||window.location.href||"")&&(b=(b.match(/^([^#]+)/)||[])[1]);a=c.extend(!0,{url:b,success:c.ajaxSettings.success,type:h||c.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},a);b={};this.trigger("form-pre-serialize", |
|
21 |
[this,a,b]);if(b.veto)return s("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(a.beforeSerialize&&!1===a.beforeSerialize(this,a))return s("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var m=a.traditional;void 0===m&&(m=c.ajaxSettings.traditional);var p=[],l,r=this.formToArray(a.semantic,p);a.data&&(a.extraData=a.data,l=c.param(a.data,m));if(a.beforeSubmit&&!1===a.beforeSubmit(r,this,a))return s("ajaxSubmit: submit aborted via beforeSubmit callback"),this;this.trigger("form-submit-validate", |
|
22 |
[r,this,a,b]);if(b.veto)return s("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;b=c.param(r,m);l&&(b=b?b+"&"+l:l);"GET"==a.type.toUpperCase()?(a.url+=(0<=a.url.indexOf("?")?"&":"?")+b,a.data=null):a.data=b;var w=[];a.resetForm&&w.push(function(){n.resetForm()});a.clearForm&&w.push(function(){n.clearForm(a.includeHidden)});if(!a.dataType&&a.target){var v=a.success||function(){};w.push(function(b){var d=a.replaceTarget?"replaceWith":"html";c(a.target)[d](b).each(v,arguments)})}else a.success&& |
|
23 |
w.push(a.success);a.success=function(b,c,d){for(var f=a.context||this,e=0,g=w.length;e<g;e++)w[e].apply(f,[b,c,d||n,n])};l=0<c("input:file:enabled[value]",this).length;b="multipart/form-data"==n[0].enctype||"multipart/form-data"==n[0].encoding;m=x&&z;s("fileAPI :"+m);!1!==a.iframe&&(a.iframe||(l||b)&&!m)?a.closeKeepAlive?c.get(a.closeKeepAlive,function(){f(r)}):f(r):a.jqxhr=(l||b)&&m?g(r):c.ajax(a);for(l=0;l<p.length;l++)p[l]=null;this.trigger("form-submit-notify",[this,a]);return this};c.fn.ajaxForm= |
|
24 |
function(a){a=a||{};a.delegation=a.delegation&&c.isFunction(c.fn.on);if(!a.delegation&&0===this.length){var d=this.selector,g=this.context;if(!c.isReady&&d)return s("DOM not ready, queuing ajaxForm"),c(function(){c(d,g).ajaxForm(a)}),this;s("terminating; zero elements found by selector"+(c.isReady?"":" (DOM not ready)"));return this}return a.delegation?(c(document).off("submit.form-plugin",this.selector,v).off("click.form-plugin",this.selector,y).on("submit.form-plugin",this.selector,a,v).on("click.form-plugin", |
|
25 |
this.selector,a,y),this):this.ajaxFormUnbind().bind("submit.form-plugin",a,v).bind("click.form-plugin",a,y)};c.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};c.fn.formToArray=function(a,d){var g=[];if(0===this.length)return g;var f=this[0],h=a?f.getElementsByTagName("*"):f.elements;if(!h||!h.length)return g;var b,n,m,p,l,r;b=0;for(r=h.length;b<r;b++)if(l=h[b],(m=l.name)&&!l.disabled)if(a&&f.clk&&"image"==l.type)f.clk==l&&(g.push({name:m,value:c(l).val(),type:l.type}), |
|
26 |
g.push({name:m+".x",value:f.clk_x},{name:m+".y",value:f.clk_y}));else if((p=c.fieldValue(l,!0))&&p.constructor==Array)for(d&&d.push(l),n=0,l=p.length;n<l;n++)g.push({name:m,value:p[n]});else if(x&&"file"==l.type)if(d&&d.push(l),p=l.files,p.length)for(n=0;n<p.length;n++)g.push({name:m,value:p[n],type:l.type});else g.push({name:m,value:"",type:l.type});else null!==p&&"undefined"!=typeof p&&(d&&d.push(l),g.push({name:m,value:p,type:l.type,required:l.required}));!a&&f.clk&&(h=c(f.clk),b=h[0],(m=b.name)&& |
|
27 |
!b.disabled&&"image"==b.type&&(g.push({name:m,value:h.val()}),g.push({name:m+".x",value:f.clk_x},{name:m+".y",value:f.clk_y})));return g};c.fn.formSerialize=function(a){return c.param(this.formToArray(a))};c.fn.fieldSerialize=function(a){var d=[];this.each(function(){var g=this.name;if(g){var f=c.fieldValue(this,a);if(f&&f.constructor==Array)for(var h=0,b=f.length;h<b;h++)d.push({name:g,value:f[h]});else null!==f&&"undefined"!=typeof f&&d.push({name:this.name,value:f})}});return c.param(d)};c.fn.fieldValue= |
|
28 |
function(a){for(var d=[],g=0,f=this.length;g<f;g++){var h=c.fieldValue(this[g],a);null===h||"undefined"==typeof h||h.constructor==Array&&!h.length||(h.constructor==Array?c.merge(d,h):d.push(h))}return d};c.fieldValue=function(a,d){var g=a.name,f=a.type,h=a.tagName.toLowerCase();void 0===d&&(d=!0);if(d&&(!g||a.disabled||"reset"==f||"button"==f||("checkbox"==f||"radio"==f)&&!a.checked||("submit"==f||"image"==f)&&a.form&&a.form.clk!=a||"select"==h&&-1==a.selectedIndex))return null;if("select"==h){var b= |
|
29 |
a.selectedIndex;if(0>b)return null;for(var g=[],h=a.options,n=(f="select-one"==f)?b+1:h.length,b=f?b:0;b<n;b++){var m=h[b];if(m.selected){var p=m.value;p||(p=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value);if(f)return p;g.push(p)}}return g}return c(a).val()};c.fn.clearForm=function(a){return this.each(function(){c("input,select,textarea",this).clearFields(a)})};c.fn.clearFields=c.fn.clearInputs=function(a){var d=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; |
|
30 |
return this.each(function(g,f){var h=this.type,b=this.tagName.toLowerCase();d.test(h)||"textarea"==b?this.value="":"checkbox"==h||"radio"==h?this.checked=!1:"file"==h?c(this).val("").val()&&(h=document.createElement("form"),b=this.parentNode)&&(h.style.display="none",b.insertBefore(h,this),h.appendChild(this),h.reset(),b.insertBefore(this,h),b.removeChild(h)):"select"==b?this.selectedIndex=-1:a&&(!0===a&&/hidden/.test(h)||"string"==typeof a&&c(this).is(a))&&(this.value="")})};c.fn.resetForm=function(){return this.each(function(){("function"== |
|
31 |
typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})};c.fn.enable=function(a){void 0===a&&(a=!0);return this.each(function(){this.disabled=!a})};c.fn.selected=function(a){void 0===a&&(a=!0);return this.each(function(){var d=this.type;"checkbox"==d||"radio"==d?this.checked=a:"option"==this.tagName.toLowerCase()&&(d=c(this).parent("select"),a&&d[0]&&"select-one"==d[0].type&&d.find("option").selected(!1),this.selected=a)})};c.fn.ajaxSubmit.debug=!1})(jQuery); |
drupal7/sites/all/modules/views/handlers/views_handler_area_messages.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Contains views_handler_area_messages. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* Provides an area for messages. |
|
10 |
*/ |
|
11 |
class views_handler_area_messages extends views_handler_area { |
|
12 |
|
|
13 |
/** |
|
14 |
* {@inheritdoc} |
|
15 |
*/ |
|
16 |
public function option_definition() { |
|
17 |
$options = parent::option_definition(); |
|
18 |
// Set the default to TRUE so it shows on empty pages by default. |
|
19 |
$options['empty']['default'] = TRUE; |
|
20 |
return $options; |
|
21 |
} |
|
22 |
|
|
23 |
/** |
|
24 |
* {@inheritdoc} |
|
25 |
*/ |
|
26 |
public function render($empty = FALSE) { |
|
27 |
$return = ''; |
|
28 |
if (!$empty || !empty($this->options['empty'])) { |
|
29 |
$return = theme('status_messages'); |
|
30 |
} |
|
31 |
return $return; |
|
32 |
} |
|
33 |
|
|
34 |
} |
drupal7/sites/all/modules/views/handlers/views_handler_field_date.inc | ||
---|---|---|
16 | 16 |
|
17 | 17 |
$options['date_format'] = array('default' => 'small'); |
18 | 18 |
$options['custom_date_format'] = array('default' => ''); |
19 |
$options['second_date_format_custom'] = array('default' => ''); |
|
20 |
$options['second_date_format'] = array('default' => 'small'); |
|
19 | 21 |
$options['timezone'] = array('default' => ''); |
20 | 22 |
|
21 | 23 |
return $options; |
... | ... | |
36 | 38 |
'custom' => t('Custom'), |
37 | 39 |
'raw time ago' => t('Time ago'), |
38 | 40 |
'time ago' => t('Time ago (with "ago" appended)'), |
41 |
'today time ago' => t('Time ago (with "ago" appended) for today\'s date, but not for other dates'), |
|
39 | 42 |
'raw time hence' => t('Time hence'), |
40 | 43 |
'time hence' => t('Time hence (with "hence" appended)'), |
41 | 44 |
'raw time span' => t('Time span (future dates have "-" prepended)'), |
... | ... | |
49 | 52 |
'#title' => t('Custom date format'), |
50 | 53 |
'#description' => t('If "Custom", see the <a href="@url" target="_blank">PHP manual</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.', array('@url' => 'http://php.net/manual/function.date.php')), |
51 | 54 |
'#default_value' => isset($this->options['custom_date_format']) ? $this->options['custom_date_format'] : '', |
52 |
'#dependency' => array('edit-options-date-format' => array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span')), |
|
55 |
'#dependency' => array('edit-options-date-format' => array('custom', 'raw time ago', 'time ago', 'today time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span')),
|
|
53 | 56 |
); |
57 |
$form['second_date_format'] = array( |
|
58 |
'#type' => 'select', |
|
59 |
'#title' => t('Second date format'), |
|
60 |
'#options' => $date_formats + array( |
|
61 |
'custom' => t('Custom'), |
|
62 |
), |
|
63 |
'#description' => t('The date format which will be used for rendering dates other than today.'), |
|
64 |
'#default_value' => isset($this->options['second_date_format']) ? $this->options['second_date_format'] : 'small', |
|
65 |
'#dependency' => array('edit-options-date-format' => array('today time ago')), |
|
66 |
); |
|
67 |
$form['second_date_format_custom'] = array( |
|
68 |
'#type' => 'textfield', |
|
69 |
'#title' => t('Custom date format of second date'), |
|
70 |
'#description' => t('If "Custom" is selected in "Second date format", see the <a href="@url" target="_blank">PHP manual</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.', array('@url' => 'http://php.net/manual/function.date.php')), |
|
71 |
'#default_value' => isset($this->options['second_date_format_custom']) ? $this->options['second_date_format_custom'] : '', |
|
72 |
// We have to use states instead of ctools dependency because dependency |
|
73 |
// doesn't handle multiple conditions. |
|
74 |
'#states' => array( |
|
75 |
'visible' => array( |
|
76 |
'#edit-options-date-format' => array('value' => 'today time ago'), |
|
77 |
'#edit-options-second-date-format' => array('value' => 'custom'), |
|
78 |
), |
|
79 |
), |
|
80 |
// We have to use ctools dependency too because states doesn't add the |
|
81 |
// correct left margin to the element's wrapper. |
|
82 |
'#dependency' => array( |
|
83 |
// This condition is handled by form API's states. |
|
84 |
// 'edit-options-date-format' => array('today time ago'), |
|
85 |
'edit-options-second-date-format' => array('custom'), |
|
86 |
), |
|
87 |
); |
|
54 | 88 |
$form['timezone'] = array( |
55 | 89 |
'#type' => 'select', |
56 | 90 |
'#title' => t('Timezone'), |
... | ... | |
66 | 100 |
function render($values) { |
67 | 101 |
$value = $this->get_value($values); |
68 | 102 |
$format = $this->options['date_format']; |
69 |
if (in_array($format, array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span'))) { |
|
103 |
if (in_array($format, array('custom', 'raw time ago', 'time ago', 'today time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span'))) {
|
|
70 | 104 |
$custom_format = $this->options['custom_date_format']; |
71 | 105 |
} |
72 | 106 |
|
... | ... | |
78 | 112 |
return format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2); |
79 | 113 |
case 'time ago': |
80 | 114 |
return t('%time ago', array('%time' => format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2))); |
115 |
case 'today time ago': |
|
116 |
$second_format = $this->options['second_date_format']; |
|
117 |
$second_custom_format = $this->options['second_date_format_custom']; |
|
118 |
if (format_date(REQUEST_TIME, 'custom', 'Y-m-d', $timezone) == format_date($value, 'custom', 'Y-m-d', $timezone)) { |
|
119 |
return t('%time ago', array('%time' => format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2))); |
|
120 |
} |
|
121 |
elseif ($second_format == 'custom') { |
|
122 |
if ($second_custom_format == 'r') { |
|
123 |
return format_date($value, $second_format, $second_custom_format, $timezone, 'en'); |
|
124 |
} |
|
125 |
return format_date($value, $second_format, $second_custom_format, $timezone); |
|
126 |
} |
|
127 |
else { |
|
128 |
return format_date($value, $this->options['second_date_format'], '', $timezone); |
|
129 |
} |
|
81 | 130 |
case 'raw time hence': |
82 | 131 |
return format_interval(-$time_diff, is_numeric($custom_format) ? $custom_format : 2); |
83 | 132 |
case 'time hence': |
drupal7/sites/all/modules/views/handlers/views_handler_filter.inc | ||
---|---|---|
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
if ($this->multiple_exposed_input()) { |
94 |
$this->group_info = array_filter($options['group_info']['default_group_multiple']); |
|
94 |
$this->group_info = NULL; |
|
95 |
if (!empty($options['group_info']['default_group_multiple'])) { |
|
96 |
$this->group_info = array_filter($options['group_info']['default_group_multiple']); |
|
97 |
} |
|
98 |
|
|
95 | 99 |
$this->options['expose']['multiple'] = TRUE; |
96 | 100 |
} |
97 | 101 |
|
... | ... | |
116 | 120 |
'label' => array('default' => '', 'translatable' => TRUE), |
117 | 121 |
'description' => array('default' => '', 'translatable' => TRUE), |
118 | 122 |
'use_operator' => array('default' => FALSE, 'bool' => TRUE), |
123 |
'operator_label' => array('default' => '', 'translatable' => TRUE), |
|
119 | 124 |
'operator' => array('default' => ''), |
120 | 125 |
'identifier' => array('default' => ''), |
121 | 126 |
'required' => array('default' => FALSE, 'bool' => TRUE), |
... | ... | |
510 | 515 |
'#description' => t('Allow the user to choose the operator.'), |
511 | 516 |
'#default_value' => !empty($this->options['expose']['use_operator']), |
512 | 517 |
); |
518 |
$form['expose']['operator_label'] = array( |
|
519 |
'#type' => 'textfield', |
|
520 |
'#default_value' => $this->options['expose']['operator_label'], |
|
521 |
'#title' => t('Operator label'), |
|
522 |
'#size' => 40, |
|
523 |
'#description' => t('This will appear before your operator select field.'), |
|
524 |
'#dependency' => array( |
|
525 |
'edit-options-expose-use-operator' => array(1) |
|
526 |
), |
|
527 |
); |
|
513 | 528 |
$form['expose']['operator_id'] = array( |
514 | 529 |
'#type' => 'textfield', |
515 | 530 |
'#default_value' => $this->options['expose']['operator_id'], |
... | ... | |
754 | 769 |
$operator = $this->options['expose']['operator_id']; |
755 | 770 |
$this->operator_form($form, $form_state); |
756 | 771 |
$form[$operator] = $form['operator']; |
757 |
|
|
758 |
if (isset($form[$operator]['#title'])) { |
|
759 |
unset($form[$operator]['#title']); |
|
760 |
} |
|
772 |
$form[$operator]['#title'] = $this->options['expose']['operator_label']; |
|
773 |
$form[$operator]['#title_display'] = 'invisible'; |
|
761 | 774 |
|
762 | 775 |
$this->exposed_translate($form[$operator], 'operator'); |
763 | 776 |
|
drupal7/sites/all/modules/views/handlers/views_handler_filter_boolean_operator_string.inc | ||
---|---|---|
30 | 30 |
else { |
31 | 31 |
$where .= "<> ''"; |
32 | 32 |
} |
33 |
$this->query->add_where($this->options['group'], $where); |
|
33 |
$this->query->add_where_expression($this->options['group'], $where);
|
|
34 | 34 |
} |
35 | 35 |
} |
drupal7/sites/all/modules/views/handlers/views_handler_filter_fields_compare.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Definition of views_handler_filter_fields_compare. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* A handler to filter a view using fields comparison. |
|
10 |
* |
|
11 |
* @ingroup views_filter_handlers |
|
12 |
*/ |
|
13 |
|
|
14 |
class views_handler_filter_fields_compare extends views_handler_filter { |
|
15 |
|
|
16 |
function can_expose() { |
|
17 |
return FALSE; |
|
18 |
} |
|
19 |
|
|
20 |
/** |
|
21 |
* Overrides views_handler_filter#option_definition(). |
|
22 |
*/ |
|
23 |
function option_definition() { |
|
24 |
$options = parent::option_definition(); |
|
25 |
|
|
26 |
$options['left_field'] = $options['right_field'] = array('default' => ''); |
|
27 |
|
|
28 |
return $options; |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* Provide a list of all operators. |
|
33 |
*/ |
|
34 |
function fields_operator_options() { |
|
35 |
return array( |
|
36 |
'<' => t('Is less than'), |
|
37 |
'<=' => t('Is less than or equal to'), |
|
38 |
'=' => t('Is equal to'), |
|
39 |
'<>' => t('Is not equal to'), |
|
40 |
'>=' => t('Is greater than or equal to'), |
|
41 |
'>' => t('Is greater than') |
|
42 |
); |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* Provide a list of available fields. |
|
47 |
*/ |
|
48 |
function field_options() { |
|
49 |
$options = array(); |
|
50 |
|
|
51 |
$field_handlers = $this->view->display_handler->get_handlers('field'); |
|
52 |
foreach ($field_handlers as $field => $handler) { |
|
53 |
if ($handler->table != 'views') { |
|
54 |
$options[$field] = $handler->ui_name(); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
return $options; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Overrides views_handler_filter#options_form(). |
|
63 |
*/ |
|
64 |
function options_form(&$form, &$form_state) { |
|
65 |
parent::options_form($form, $form_state); |
|
66 |
|
|
67 |
$field_options = $this->field_options(); |
|
68 |
|
|
69 |
$form['left_field'] = array( |
|
70 |
'#type' => 'select', |
|
71 |
'#title' => t('Left field'), |
|
72 |
'#default_value' => $this->options['left_field'], |
|
73 |
'#options' => $field_options, |
|
74 |
'#weight' => -3, |
|
75 |
); |
|
76 |
|
|
77 |
$form['operator'] = array( |
|
78 |
'#type' => 'select', |
|
79 |
'#title' => t('Operator'), |
|
80 |
'#default_value' => $this->options['operator'], |
|
81 |
'#options' => $this->fields_operator_options(), |
|
82 |
'#weight' => -2, |
|
83 |
); |
|
84 |
|
|
85 |
$form['right_field'] = array( |
|
86 |
'#type' => 'select', |
|
87 |
'#title' => t('Right field'), |
|
88 |
'#default_value' => $this->options['right_field'], |
|
89 |
'#options' => $field_options, |
|
90 |
'#weight' => -1, |
|
91 |
); |
|
92 |
|
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* Overrides views_handler_filter#query(). |
|
97 |
* |
|
98 |
* Build extra condition from existing fields (from existing joins). |
|
99 |
*/ |
|
100 |
function query() { |
|
101 |
$left = $this->options['left_field']; |
|
102 |
$right = $this->options['right_field']; |
|
103 |
|
|
104 |
// Get all existing field handlers. |
|
105 |
$field_handlers = $this->view->display_handler->get_handlers('field'); |
|
106 |
|
|
107 |
// Make sure the selected fields still exist. |
|
108 |
if (!isset($field_handlers[$left], $field_handlers[$right])) { |
|
109 |
return; |
|
110 |
} |
|
111 |
|
|
112 |
// Get the left table and field. |
|
113 |
$left_handler = $field_handlers[$left]; |
|
114 |
$left_handler->set_relationship(); |
|
115 |
$left_table_alias = $this->query->ensure_table($left_handler->table, $left_handler->relationship); |
|
116 |
|
|
117 |
// Get the left table and field. |
|
118 |
$right_handler = $field_handlers[$right]; |
|
119 |
$right_handler->set_relationship(); |
|
120 |
$right_table_alias = $this->query->ensure_table($right_handler->table, $right_handler->relationship); |
|
121 |
|
|
122 |
// Build piece of SQL. |
|
123 |
$snippet = |
|
124 |
$left_table_alias . '.' . $left_handler->real_field . |
|
125 |
' ' . $this->options['operator'] . ' ' . |
|
126 |
$right_table_alias . '.' . $right_handler->real_field; |
|
127 |
|
|
128 |
$this->query->add_where_expression($this->options['group'], $snippet); |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* Overrides views_handler_filter#admin_summary(). |
|
133 |
*/ |
|
134 |
function admin_summary() { |
|
135 |
return check_plain( |
|
136 |
$this->options['left_field'] . ' ' . |
|
137 |
$this->options['operator'] . ' ' . |
|
138 |
$this->options['right_field'] |
|
139 |
); |
|
140 |
} |
|
141 |
|
|
142 |
} |
drupal7/sites/all/modules/views/includes/admin.inc | ||
---|---|---|
408 | 408 |
*/ |
409 | 409 |
function views_element_validate_integer($element, &$form_state) { |
410 | 410 |
$value = $element['#value']; |
411 |
if ($value !== '' && (!is_numeric($value) || intval($value) != $value)) { |
|
411 |
if ($value !== '' && (!is_numeric($value) || intval($value) != $value || abs($value) != $value)) {
|
|
412 | 412 |
form_error($element, t('%name must be a positive integer.', array('%name' => $element['#title']))); |
413 | 413 |
} |
414 | 414 |
} |
drupal7/sites/all/modules/views/includes/cache.inc | ||
---|---|---|
23 | 23 |
if ($table) { |
24 | 24 |
if (!isset($cache[$table])) { |
25 | 25 |
$cid = 'views_data:' . $table; |
26 |
$data = views_cache_get($cid, TRUE); |
|
27 |
if (!empty($data->data)) { |
|
26 |
if ($data = views_cache_get($cid, TRUE)) { |
|
28 | 27 |
$cache[$table] = $data->data; |
29 | 28 |
} |
30 | 29 |
else { |
31 | 30 |
if (!$fully_loaded) { |
32 |
// No cache entry, rebuild. |
|
33 |
$cache = _views_fetch_data_build(); |
|
31 |
// Try to load the full views cache. |
|
32 |
if ($data = views_cache_get('views_data', TRUE)) { |
|
33 |
$cache = $data->data; |
|
34 |
} |
|
35 |
else { |
|
36 |
// No cache entry, rebuild. |
|
37 |
$cache = _views_fetch_data_build(); |
|
38 |
} |
|
34 | 39 |
$fully_loaded = TRUE; |
35 | 40 |
} |
41 |
|
|
42 |
// Write back a cache for this table. |
|
43 |
if (isset($cache[$table])) { |
|
44 |
views_cache_set($cid, $cache[$table], TRUE); |
|
45 |
} |
|
46 |
else { |
|
47 |
// If there is still no information about that table, it is missing. |
|
48 |
// Write an empty array to avoid repeated rebuilds. |
|
49 |
views_cache_set($cid, array(), TRUE); |
|
50 |
} |
|
36 | 51 |
} |
37 | 52 |
} |
38 | 53 |
if (isset($cache[$table])) { |
... | ... | |
82 | 97 |
|
83 | 98 |
// Keep a record with all data. |
84 | 99 |
views_cache_set('views_data', $cache, TRUE); |
85 |
// Save data in seperate cache entries. |
|
86 |
foreach ($cache as $key => $data) { |
|
87 |
$cid = 'views_data:' . $key; |
|
88 |
views_cache_set($cid, $data, TRUE); |
|
89 |
} |
|
90 | 100 |
return $cache; |
91 | 101 |
} |
92 | 102 |
|
drupal7/sites/all/modules/views/includes/handlers.inc | ||
---|---|---|
1581 | 1581 |
// With an array of values, we need multiple placeholders and the |
1582 | 1582 |
// 'IN' operator is implicit. |
1583 | 1583 |
foreach ($info['value'] as $value) { |
1584 |
$placeholder_i = ':views_join_condition_' . $select_query->nextPlaceholder();
|
|
1584 |
$placeholder_i = $view_query->placeholder('views_join_condition_');
|
|
1585 | 1585 |
$arguments[$placeholder_i] = $value; |
1586 | 1586 |
} |
1587 | 1587 |
|
... | ... | |
1591 | 1591 |
else { |
1592 | 1592 |
// With a single value, the '=' operator is implicit. |
1593 | 1593 |
$operator = !empty($info['operator']) ? $info['operator'] : '='; |
1594 |
$placeholder = ':views_join_condition_' . $select_query->nextPlaceholder();
|
|
1594 |
$placeholder = $view_query->placeholder('views_join_condition_');
|
|
1595 | 1595 |
$arguments[$placeholder] = $info['value']; |
1596 | 1596 |
} |
1597 |
|
|
1598 | 1597 |
$extras[] = "$join_table$info[field] $operator $placeholder"; |
1599 | 1598 |
} |
1600 | 1599 |
|
drupal7/sites/all/modules/views/includes/view.inc | ||
---|---|---|
756 | 756 |
*/ |
757 | 757 |
function _init_handler($key, $info) { |
758 | 758 |
// Load the requested items from the display onto the object. |
759 |
$this->$key = $this->display_handler->get_handlers($key); |
|
759 |
$this->$key = &$this->display_handler->get_handlers($key);
|
|
760 | 760 |
|
761 | 761 |
// This reference deals with difficult PHP indirection. |
762 | 762 |
$handlers = &$this->$key; |
drupal7/sites/all/modules/views/js/ajax_view.js | ||
---|---|---|
66 | 66 |
// to a given element. |
67 | 67 |
.filter(jQuery.proxy(this.filterNestedViews, this)) |
68 | 68 |
.once(jQuery.proxy(this.attachPagerAjax, this)); |
69 |
|
|
70 |
// Add a trigger to update this view specifically. |
|
71 |
var self_settings = this.element_settings; |
|
72 |
self_settings.event = 'RefreshView'; |
|
73 |
this.refreshViewAjax = new Drupal.ajax(this.selector, this.$view, self_settings); |
|
69 | 74 |
}; |
70 | 75 |
|
71 | 76 |
Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() { |
drupal7/sites/all/modules/views/modules/field/views_handler_field_field.inc | ||
---|---|---|
820 | 820 |
* Return an array of items for the field. |
821 | 821 |
*/ |
822 | 822 |
function set_items($values, $row_id) { |
823 |
if (empty($values->_field_data[$this->field_alias]) || empty($values->_field_data[$this->field_alias]['entity'])) { |
|
823 |
// In some cases the instance on the entity might be easy, see |
|
824 |
// https://drupal.org/node/1161708 and https://drupal.org/node/1461536 for |
|
825 |
// more information. |
|
826 |
if (empty($values->_field_data[$this->field_alias]) || empty($values->_field_data[$this->field_alias]['entity']) || !isset($values->_field_data[$this->field_alias]['entity']->{$this->definition['field_name']})) { |
|
824 | 827 |
return array(); |
825 | 828 |
} |
826 | 829 |
|
drupal7/sites/all/modules/views/modules/profile/views_handler_field_profile_date.inc | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// But we *can* deal with non-year stuff: |
53 | 53 |
$date = gmmktime(0, 0, 0, $value['month'], $value['day'], $value['year']); |
54 |
|
|
54 | 55 |
$replace = array( |
55 | 56 |
// day |
56 | 57 |
'd' => sprintf('%02d', $value['day']), |
57 | 58 |
'D' => NULL, |
58 | 59 |
'l' => NULL, |
59 | 60 |
'N' => NULL, |
60 |
'S' => date('S', $date), |
|
61 |
'S' => gmdate('S', $date),
|
|
61 | 62 |
'w' => NULL, |
62 | 63 |
'j' => $value['day'], |
63 | 64 |
// month |
64 |
'F' => date('F', $date), |
|
65 |
'F' => gmdate('F', $date),
|
|
65 | 66 |
'm' => sprintf('%02d', $value['month']), |
66 |
'M' => date('M', $date), |
|
67 |
'n' => date('n', $date), |
|
67 |
'M' => gmdate('M', $date),
|
|
68 |
'n' => gmdate('n', $date),
|
|
68 | 69 |
|
69 | 70 |
'Y' => $value['year'], |
70 | 71 |
'y' => substr($value['year'], 2, 2), |
drupal7/sites/all/modules/views/modules/system/views_handler_field_file_extension.inc | ||
---|---|---|
10 | 10 |
* @ingroup views_field_handlers |
11 | 11 |
*/ |
12 | 12 |
class views_handler_field_file_extension extends views_handler_field { |
13 |
public function option_definition() { |
|
14 |
$options = parent::option_definition(); |
|
15 |
$options['extension_detect_tar'] = array('default' => FALSE, 'bool' => TRUE); |
|
16 |
return $options; |
|
17 |
} |
|
18 |
|
|
19 |
public function options_form(&$form, &$form_state) { |
|
20 |
parent::options_form($form, $form_state); |
|
21 |
$form['extension_detect_tar'] = array( |
|
22 |
'#type' => 'checkbox', |
|
23 |
'#title' => t('Detect if tar is part of the extension'), |
|
24 |
'#description' => t("See if the previous extension is '.tar' and if so, add that, so we see 'tar.gz' or 'tar.bz2' instead of just 'gz'."), |
|
25 |
'#default_value' => $this->options['extension_detect_tar'], |
|
26 |
); |
|
27 |
} |
|
28 |
|
|
13 | 29 |
function render($values) { |
14 | 30 |
$value = $this->get_value($values); |
15 |
if (preg_match('/\.([^\.]+)$/', $value, $match)) { |
|
16 |
return $this->sanitize_value($match[1]); |
|
31 |
if (!$this->options['extension_detect_tar']) { |
|
32 |
if (preg_match('/\.([^\.]+)$/', $value, $match)) { |
|
33 |
return $this->sanitize_value($match[1]); |
|
34 |
} |
|
35 |
} |
|
36 |
else { |
|
37 |
$file_parts = explode('.', basename($value)); |
|
38 |
// If there is an extension. |
|
39 |
if (count($file_parts) > 1) { |
|
40 |
$extension = array_pop($file_parts); |
|
41 |
$last_part_in_name = array_pop($file_parts); |
|
42 |
if ($last_part_in_name === 'tar') { |
|
43 |
$extension = 'tar.' . $extension; |
|
44 |
} |
|
45 |
return $this->sanitize_value($extension); |
|
46 |
} |
|
17 | 47 |
} |
18 | 48 |
} |
19 | 49 |
} |
drupal7/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc | ||
---|---|---|
98 | 98 |
if ($this->options['type'] == 'textfield') { |
99 | 99 |
$default = ''; |
100 | 100 |
if ($this->value) { |
101 |
$result = db_select('taxonomy_term_data', 'td') |
|
102 |
->fields('td') |
|
103 |
->condition('td.tid', $this->value) |
|
104 |
->execute(); |
|
105 |
foreach ($result as $term) { |
|
101 |
$result = taxonomy_term_load_multiple($this->value); |
|
102 |
foreach ($result as $entity_term) { |
|
106 | 103 |
if ($default) { |
107 | 104 |
$default .= ', '; |
108 | 105 |
} |
109 |
$default .= $term->name;
|
|
106 |
$default .= entity_label('taxonomy_term', $entity_term);
|
|
110 | 107 |
} |
111 | 108 |
} |
112 | 109 |
|
... | ... | |
122 | 119 |
} |
123 | 120 |
else { |
124 | 121 |
if (!empty($this->options['hierarchy']) && $this->options['limit']) { |
125 |
$tree = taxonomy_get_tree($vocabulary->vid); |
|
122 |
$tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE);
|
|
126 | 123 |
$options = array(); |
127 | 124 |
|
128 | 125 |
if ($tree) { |
126 |
// Translation system needs full entity objects, so we have access to label. |
|
129 | 127 |
foreach ($tree as $term) { |
130 | 128 |
$choice = new stdClass(); |
131 |
$choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
|
|
129 |
$choice->option = array($term->tid => str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term));
|
|
132 | 130 |
$options[] = $choice; |
133 | 131 |
} |
134 | 132 |
} |
... | ... | |
147 | 145 |
$query->condition('tv.machine_name', $vocabulary->machine_name); |
148 | 146 |
} |
149 | 147 |
$result = $query->execute(); |
148 |
|
|
149 |
$tids = array(); |
|
150 | 150 |
foreach ($result as $term) { |
151 |
$options[$term->tid] = $term->name; |
|
151 |
$tids[] = $term->tid; |
|
152 |
} |
|
153 |
$entities = taxonomy_term_load_multiple($tids); |
|
154 |
foreach ($entities as $entity_term) { |
|
155 |
$options[$entity_term->tid] = entity_label('taxonomy_term', $entity_term); |
|
152 | 156 |
} |
153 | 157 |
} |
154 | 158 |
|
... | ... | |
238 | 242 |
$rc = parent::accept_exposed_input($input); |
239 | 243 |
if ($rc) { |
240 | 244 |
// If we have previously validated input, override. |
241 |
if (isset($this->validated_exposed_input)) { |
|
245 |
if (!$this->is_a_group() && isset($this->validated_exposed_input)) {
|
|
242 | 246 |
$this->value = $this->validated_exposed_input; |
243 | 247 |
} |
244 | 248 |
} |
... | ... | |
347 | 351 |
|
348 | 352 |
if ($this->value) { |
349 | 353 |
$this->value = array_filter($this->value); |
350 |
$result = db_select('taxonomy_term_data', 'td') |
|
351 |
->fields('td') |
|
352 |
->condition('td.tid', $this->value) |
|
353 |
->execute(); |
|
354 |
foreach ($result as $term) { |
|
355 |
$this->value_options[$term->tid] = $term->name; |
|
354 |
$result = taxonomy_term_load_multiple($this->value); |
|
355 |
foreach ($result as $entity_term) { |
|
356 |
$this->value_options[$entity_term->tid] = entity_label('taxonomy_term', $entity_term); |
|
356 | 357 |
} |
357 | 358 |
} |
358 | 359 |
return parent::admin_summary(); |
drupal7/sites/all/modules/views/modules/taxonomy/views_handler_relationship_node_term_data.inc | ||
---|---|---|
75 | 75 |
$query->addJoin($def['type'], 'taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); |
76 | 76 |
$query->addJoin($def['type'], 'taxonomy_index', 'tn', 'tn.tid = td.tid'); |
77 | 77 |
$query->condition('tv.machine_name', array_filter($this->options['vocabularies'])); |
78 |
$query->addTag('term_access'); |
|
78 |
if (empty($this->query->options['disable_sql_rewrite'])) { |
|
79 |
$query->addTag('term_access'); |
|
80 |
} |
|
79 | 81 |
$query->fields('td'); |
80 | 82 |
$query->fields('tn', array('nid')); |
81 | 83 |
$def['table formula'] = $query; |
drupal7/sites/all/modules/views/modules/user/views_handler_field_user_link_cancel.inc | ||
---|---|---|
22 | 22 |
if ($uid && user_cancel_access($account)) { |
23 | 23 |
$this->options['alter']['make_link'] = TRUE; |
24 | 24 |
|
25 |
$text = !empty($this->options['text']) ? $this->options['text'] : t('cancel');
|
|
25 |
$text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel account');
|
|
26 | 26 |
|
27 | 27 |
$this->options['alter']['path'] = "user/$uid/cancel"; |
28 | 28 |
$this->options['alter']['query'] = drupal_get_destination(); |
drupal7/sites/all/modules/views/modules/views.views.inc | ||
---|---|---|
81 | 81 |
), |
82 | 82 |
); |
83 | 83 |
|
84 |
$data['views']['messages'] = array( |
|
85 |
'title' => t('Messages'), |
|
86 |
'help' => t('Displays messages in the area.'), |
|
87 |
'area' => array( |
|
88 |
'handler' => 'views_handler_area_messages', |
|
89 |
), |
|
90 |
); |
|
91 |
|
|
84 | 92 |
if (module_exists('contextual')) { |
85 | 93 |
$data['views']['contextual_links'] = array( |
86 | 94 |
'title' => t('Contextual Links'), |
... | ... | |
110 | 118 |
); |
111 | 119 |
} |
112 | 120 |
|
121 |
$data['views']['fields_compare'] = array( |
|
122 |
'title' => t('Fields comparison'), |
|
123 |
'help' => t('Compare database fields against eachother.'), |
|
124 |
'filter' => array( |
|
125 |
'help' => t('Use fields comparison to filter the result of the view.'), |
|
126 |
'handler' => 'views_handler_filter_fields_compare', |
|
127 |
) |
|
128 |
); |
|
129 |
|
|
113 | 130 |
return $data; |
114 | 131 |
} |
drupal7/sites/all/modules/views/plugins/views_plugin_cache.inc | ||
---|---|---|
200 | 200 |
$this->storage['head'] = ''; |
201 | 201 |
} |
202 | 202 |
|
203 |
// Check if the advanced mapping function of D 7.23 is available. |
|
204 |
$array_mapping_func = function_exists('drupal_array_diff_assoc_recursive') ? 'drupal_array_diff_assoc_recursive' : 'array_diff_assoc'; |
|
205 |
|
|
203 | 206 |
// Slightly less simple for CSS: |
204 | 207 |
$css = drupal_add_css(); |
205 | 208 |
$css_start = isset($this->storage['css']) ? $this->storage['css'] : array(); |
206 |
$this->storage['css'] = array_diff_assoc($css, $css_start);
|
|
209 |
$this->storage['css'] = $array_mapping_func($css, $css_start);
|
|
207 | 210 |
|
208 | 211 |
// Get javascript after/before views renders. |
209 | 212 |
$js = drupal_add_js(); |
210 | 213 |
$js_start = isset($this->storage['js']) ? $this->storage['js'] : array(); |
211 | 214 |
// If there are any differences between the old and the new javascript then |
212 | 215 |
// store them to be added later. |
213 |
$this->storage['js'] = array_diff_assoc($js, $js_start);
|
|
216 |
$this->storage['js'] = $array_mapping_func($js, $js_start);
|
|
214 | 217 |
|
215 | 218 |
// Special case the settings key and get the difference of the data. |
216 | 219 |
$settings = isset($js['settings']['data']) ? $js['settings']['data'] : array(); |
217 | 220 |
$settings_start = isset($js_start['settings']['data']) ? $js_start['settings']['data'] : array(); |
218 |
$this->storage['js']['settings'] = array_diff_assoc($settings, $settings_start);
|
|
221 |
$this->storage['js']['settings'] = $array_mapping_func($settings, $settings_start);
|
|
219 | 222 |
|
220 | 223 |
// Get difference of HTTP headers. |
221 |
$this->storage['headers'] = array_diff_assoc(drupal_get_http_header(), $this->storage['headers']);
|
|
224 |
$this->storage['headers'] = $array_mapping_func(drupal_get_http_header(), $this->storage['headers']);
|
|
222 | 225 |
} |
223 | 226 |
|
224 | 227 |
/** |
... | ... | |
253 | 256 |
} |
254 | 257 |
|
255 | 258 |
function get_results_key() { |
256 |
global $user; |
|
257 |
|
|
258 | 259 |
if (!isset($this->_results_key)) { |
259 |
|
|
260 |
$build_info = $this->view->build_info; |
|
261 |
|
|
262 |
$query_plugin = $this->view->display_handler->get_plugin('query'); |
|
263 |
|
|
264 |
foreach (array('query','count_query') as $index) { |
|
265 |
// If the default query back-end is used generate SQL query strings from |
|
266 |
// the query objects. |
|
267 |
if ($build_info[$index] instanceof SelectQueryInterface) { |
|
268 |
$query = clone $build_info[$index]; |
|
269 |
$query->preExecute(); |
|
270 |
$build_info[$index] = (string) $query; |
|
271 |
} |
|
272 |
} |
|
273 |
$key_data = array( |
|
274 |
'build_info' => $build_info, |
|
275 |
'roles' => array_keys($user->roles), |
|
276 |
'super-user' => $user->uid == 1, // special caching for super user. |
|
277 |
'language' => $GLOBALS['language']->language, |
|
278 |
'base_url' => $GLOBALS['base_url'], |
|
279 |
); |
|
280 |
foreach (array('exposed_info', 'page', 'sort', 'order', 'items_per_page', 'offset') as $key) { |
|
281 |
if (isset($_GET[$key])) { |
|
282 |
$key_data[$key] = $_GET[$key]; |
|
283 |
} |
|
284 |
} |
|
285 |
|
|
286 |
$this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . md5(serialize($key_data)); |
|
260 |
$this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . $this->get_cache_key(); |
|
287 | 261 |
} |
288 | 262 |
|
289 | 263 |
return $this->_results_key; |
290 | 264 |
} |
291 | 265 |
|
292 | 266 |
function get_output_key() { |
293 |
global $user; |
|
294 | 267 |
if (!isset($this->_output_key)) { |
295 | 268 |
$key_data = array( |
296 |
'result' => $this->view->result, |
|
297 |
'roles' => array_keys($user->roles), |
|
298 |
'super-user' => $user->uid == 1, // special caching for super user. |
|
299 | 269 |
'theme' => $GLOBALS['theme'], |
300 |
'language' => $GLOBALS['language']->language, |
|
301 |
'base_url' => $GLOBALS['base_url'], |
|
302 | 270 |
); |
303 |
|
|
304 |
$this->_output_key = $this->view->name . ':' . $this->display->id . ':output:' . md5(serialize($key_data)); |
|
271 |
$this->_output_key = $this->view->name . ':' . $this->display->id . ':output:' . $this->get_cache_key($key_data); |
|
305 | 272 |
} |
306 | 273 |
|
307 | 274 |
return $this->_output_key; |
308 | 275 |
} |
276 |
|
|
277 |
/** |
|
278 |
* Returns cache key. |
|
279 |
* |
|
280 |
* @param array $key_data |
|
281 |
* Additional data for cache segmentation and/or overrides for default |
|
282 |
* segmentation. |
|
283 |
* |
|
284 |
* @return string |
|
285 |
*/ |
|
286 |
function get_cache_key($key_data = array()) { |
|
287 |
global $user; |
|
288 |
|
|
289 |
$key_data += array( |
|
290 |
'roles' => array_keys($user->roles), |
|
291 |
'super-user' => $user->uid == 1, // special caching for super user. |
|
292 |
'language' => $GLOBALS['language']->language, |
|
293 |
'base_url' => $GLOBALS['base_url'], |
|
294 |
); |
|
295 |
|
|
296 |
if (empty($key_data['build_info'])) { |
|
297 |
$build_info = $this->view->build_info; |
|
298 |
foreach (array('query','count_query') as $index) { |
|
299 |
// If the default query back-end is used generate SQL query strings from |
|
300 |
// the query objects. |
|
301 |
if ($build_info[$index] instanceof SelectQueryInterface) { |
|
302 |
$query = clone $build_info[$index]; |
|
303 |
$query->preExecute(); |
|
304 |
$key_data['build_info'][$index] = array( |
|
305 |
'sql' => (string) $query, |
|
306 |
'arguments' => $query->getArguments(), |
|
307 |
); |
|
308 |
} |
|
309 |
} |
|
310 |
} |
|
311 |
$key = md5(serialize($key_data)); |
|
312 |
return $key; |
|
313 |
} |
|
309 | 314 |
} |
310 | 315 |
|
311 | 316 |
/** |
drupal7/sites/all/modules/views/plugins/views_plugin_display.inc | ||
---|---|---|
918 | 918 |
/** |
919 | 919 |
* Get a full array of handlers for $type. This caches them. |
920 | 920 |
*/ |
921 |
function get_handlers($type) { |
|
921 |
function &get_handlers($type) {
|
|
922 | 922 |
if (!isset($this->handlers[$type])) { |
923 | 923 |
$this->handlers[$type] = array(); |
924 | 924 |
$types = views_object_types(); |
drupal7/sites/all/modules/views/plugins/views_plugin_display_feed.inc | ||
---|---|---|
37 | 37 |
function execute() { |
38 | 38 |
$output = $this->view->render(); |
39 | 39 |
if (empty($output)) { |
40 |
return drupal_not_found();
|
|
40 |
return MENU_NOT_FOUND;
|
|
41 | 41 |
} |
42 | 42 |
print $output; |
43 | 43 |
} |
drupal7/sites/all/modules/views/plugins/views_plugin_display_page.inc | ||
---|---|---|
216 | 216 |
// display, and arguments should be set on the view. |
217 | 217 |
$this->view->build(); |
218 | 218 |
if (!empty($this->view->build_info['fail'])) { |
219 |
return drupal_not_found();
|
|
219 |
return MENU_NOT_FOUND;
|
|
220 | 220 |
} |
221 | 221 |
|
222 | 222 |
if (!empty($this->view->build_info['denied'])) { |
223 |
return drupal_access_denied();
|
|
223 |
return MENU_ACCESS_DENIED;
|
|
224 | 224 |
} |
225 | 225 |
|
226 | 226 |
$this->view->get_breadcrumb(TRUE); |
drupal7/sites/all/modules/views/plugins/views_plugin_exposed_form.inc | ||
---|---|---|
173 | 173 |
$view = $this->view; |
174 | 174 |
$exposed_data = isset($view->exposed_data) ? $view->exposed_data : array(); |
175 | 175 |
$sort_by = isset($exposed_data['sort_by']) ? $exposed_data['sort_by'] : NULL; |
176 |
if (!empty($sort_by)) { |
|
176 |
if (!empty($sort_by) && $this->view->style_plugin->build_sort()) {
|
|
177 | 177 |
// Make sure the original order of sorts is preserved |
178 | 178 |
// (e.g. a sticky sort is often first) |
179 | 179 |
if (isset($view->sort[$sort_by])) { |
drupal7/sites/all/modules/views/plugins/views_plugin_exposed_form_input_required.inc | ||
---|---|---|
71 | 71 |
'group_type' => 'group', |
72 | 72 |
'content' => $this->options['text_input_required'], |
73 | 73 |
'format' => $this->options['text_input_required_format'], |
74 |
'empty' => TRUE, |
|
74 | 75 |
); |
75 | 76 |
$handler = views_get_handler('views', 'area', 'area'); |
76 | 77 |
$handler->init($this->view, $options); |
drupal7/sites/all/modules/views/plugins/views_plugin_pager.inc | ||
---|---|---|
107 | 107 |
* Get the pager id, if it exists |
108 | 108 |
*/ |
109 | 109 |
function get_pager_id() { |
110 |
return isset($this->options['id']) ? $this->options['id'] : 0;
|
|
110 |
return !empty($this->options['id']) ? $this->options['id'] : 0;
|
|
111 | 111 |
} |
112 | 112 |
|
113 | 113 |
/** |
drupal7/sites/all/modules/views/plugins/views_plugin_pager_full.inc | ||
---|---|---|
276 | 276 |
); |
277 | 277 |
$output = theme($pager_theme, array( |
278 | 278 |
'tags' => $tags, |
279 |
'element' => $this->options['id'],
|
|
279 |
'element' => $this->get_pager_id(),
|
|
280 | 280 |
'parameters' => $input, |
281 | 281 |
'quantity' => $this->options['quantity'], |
282 | 282 |
)); |
... | ... | |
308 | 308 |
// array hasn't been initialized before. |
309 | 309 |
$page = isset($_GET['page']) ? explode(',', $_GET['page']) : array(); |
310 | 310 |
|
311 |
for ($i = 0; $i <= $this->options['id'] || $i < count($pager_page_array); $i++) { |
|
311 |
$pager_id = $this->get_pager_id(); |
|
312 |
for ($i = 0; $i <= $pager_id || $i < count($pager_page_array); $i++) { |
|
312 | 313 |
$pager_page_array[$i] = empty($page[$i]) ? 0 : $page[$i]; |
313 | 314 |
} |
314 | 315 |
|
315 |
$this->current_page = intval($pager_page_array[$this->options['id']]);
|
|
316 |
$this->current_page = intval($pager_page_array[$pager_id]);
|
|
316 | 317 |
|
317 | 318 |
if ($this->current_page < 0) { |
318 | 319 |
$this->current_page = 0; |
... | ... | |
348 | 349 |
// Dump information about what we already know into the globals. |
349 | 350 |
global $pager_page_array, $pager_total, $pager_total_items, $pager_limits; |
350 | 351 |
// Set the limit. |
351 |
$pager_limits[$this->options['id']] = $this->options['items_per_page']; |
|
352 |
$pager_id = $this->get_pager_id(); |
|
353 |
$pager_limits[$pager_id] = $this->options['items_per_page']; |
|
352 | 354 |
// Set the item count for the pager. |
353 |
$pager_total_items[$this->options['id']] = $this->total_items;
|
|
355 |
$pager_total_items[$pager_id] = $this->total_items;
|
|
354 | 356 |
// Calculate and set the count of available pages. |
355 |
$pager_total[$this->options['id']] = $this->get_pager_total();
|
|
357 |
$pager_total[$pager_id] = $this->get_pager_total();
|
|
356 | 358 |
|
357 | 359 |
// See if the requested page was within range: |
358 | 360 |
if ($this->current_page < 0) { |
359 | 361 |
$this->current_page = 0; |
360 | 362 |
} |
361 |
else if ($this->current_page >= $pager_total[$this->options['id']]) {
|
|
363 |
else if ($this->current_page >= $pager_total[$pager_id]) {
|
|
362 | 364 |
// Pages are numbered from 0 so if there are 10 pages, the last page is 9. |
363 |
$this->current_page = $pager_total[$this->options['id']] - 1;
|
|
365 |
$this->current_page = $pager_total[$pager_id] - 1;
|
|
364 | 366 |
} |
365 | 367 |
|
366 | 368 |
// Put this number in to guarantee that we do not generate notices when the pager |
367 | 369 |
// goes to look for it later. |
368 |
$pager_page_array[$this->options['id']] = $this->current_page;
|
|
370 |
$pager_page_array[$pager_id] = $this->current_page;
|
|
369 | 371 |
} |
370 | 372 |
} |
371 | 373 |
|
drupal7/sites/all/modules/views/plugins/views_plugin_pager_mini.inc | ||
---|---|---|
63 | 63 |
); |
64 | 64 |
return theme($pager_theme, array( |
65 | 65 |
'tags' => $tags, |
66 |
'element' => $this->options['id'],
|
|
66 |
'element' => $this->get_pager_id(),
|
|
67 | 67 |
'parameters' => $input, |
68 | 68 |
)); |
69 | 69 |
} |
drupal7/sites/all/modules/views/plugins/views_plugin_query_default.inc | ||
---|---|---|
1365 | 1365 |
// Add all query substitutions as metadata. |
1366 | 1366 |
$query->addMetaData('views_substitutions', module_invoke_all('views_query_substitutions', $this)); |
1367 | 1367 |
|
1368 |
if (!$get_count) { |
|
1369 |
if (!empty($this->limit) || !empty($this->offset)) { |
|
1370 |
// We can't have an offset without a limit, so provide a very large limit |
|
1371 |
// instead. |
|
1372 |
$limit = intval(!empty($this->limit) ? $this->limit : 999999); |
|
1373 |
$offset = intval(!empty($this->offset) ? $this->offset : 0); |
|
1374 |
$query->range($offset, $limit); |
|
1375 |
} |
|
1376 |
} |
|
1377 |
|
|
1368 | 1378 |
return $query; |
1369 | 1379 |
} |
1370 | 1380 |
|
... | ... | |
1469 | 1479 |
$this->pager->execute_count_query($count_query); |
1470 | 1480 |
} |
1471 | 1481 |
|
1472 |
// Let the pager modify the query to add limits. |
|
1473 | 1482 |
$this->pager->pre_execute($query); |
1474 | 1483 |
|
1475 |
if (!empty($this->limit) || !empty($this->offset)) { |
|
1476 |
// We can't have an offset without a limit, so provide a very large limit instead. |
|
1477 |
$limit = intval(!empty($this->limit) ? $this->limit : 999999); |
|
1478 |
$offset = intval(!empty($this->offset) ? $this->offset : 0); |
|
1479 |
$query->range($offset, $limit); |
|
1480 |
} |
|
1481 |
|
|
1482 | 1484 |
$result = $query->execute(); |
1483 | 1485 |
|
1484 | 1486 |
$view->result = array(); |
drupal7/sites/all/modules/views/plugins/views_plugin_style_jump_menu.inc | ||
---|---|---|
142 | 142 |
unset($this->view->row_index); |
143 | 143 |
|
144 | 144 |
$default_value = ''; |
145 |
if ($this->options['default_value'] && !empty($paths[url($_GET['q'])])) { |
|
146 |
$default_value = $paths[url($_GET['q'])]; |
|
145 |
if ($this->options['default_value']) { |
|
146 |
$lookup_options = array(); |
|
147 |
// We need to check if the path is absolute |
|
148 |
// or else language is not taken in account. |
|
149 |
if ($this->view->display[$this->view->current_display]->display_options['fields'][$this->options['path']]['absolute']) { |
|
150 |
$lookup_options['absolute'] = TRUE; |
|
151 |
} |
|
152 |
$lookup_url = url($_GET['q'], $lookup_options); |
|
153 |
if (!empty($paths[$lookup_url])) { |
|
154 |
$default_value = $paths[$lookup_url]; |
|
155 |
} |
|
147 | 156 |
} |
148 | 157 |
|
149 | 158 |
ctools_include('jump-menu'); |
drupal7/sites/all/modules/views/tests/handlers/views_handler_field_date.test | ||
---|---|---|
34 | 34 |
'relationship' => 'none', |
35 | 35 |
// c is iso 8601 date format @see http://php.net/manual/en/function.date.php |
36 | 36 |
'custom_date_format' => 'c', |
37 |
'second_date_format' => 'custom', |
|
38 |
'second_date_format_custom' => 'c', |
|
37 | 39 |
), |
38 | 40 |
)); |
39 | 41 |
$time = gmmktime(0, 0, 0, 1, 1, 2000); |
... | ... | |
51 | 53 |
'medium' => format_date($time, 'medium', '', $timezone), |
52 | 54 |
'large' => format_date($time, 'large', '', $timezone), |
53 | 55 |
'custom' => format_date($time, 'custom', 'c', $timezone), |
56 |
'today time ago custom' => format_date($time, 'custom', 'c', $timezone), |
|
57 |
'today time ago' => t('%time ago', array('%time' => format_interval(120, 2))), |
|
54 | 58 |
); |
55 | 59 |
$this->assertRenderedDatesEqual($view, $dates, $timezone); |
56 | 60 |
} |
... | ... | |
67 | 71 |
|
68 | 72 |
protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) { |
69 | 73 |
foreach ($map as $date_format => $expected_result) { |
74 |
$check_result_number = 0; |
|
75 |
|
|
76 |
// If it's "today time ago" format we have to check the 6th element. |
|
77 |
if ($date_format == 'today time ago') { |
|
78 |
$check_result_number = 5; |
|
79 |
} |
|
80 |
|
|
81 |
// Correct the date format. |
|
82 |
if ($date_format == 'today time ago custom') { |
|
83 |
$date_format = 'today time ago'; |
|
84 |
} |
|
70 | 85 |
$view->field['created']->options['date_format'] = $date_format; |
71 | 86 |
$t_args = array( |
72 | 87 |
'%value' => $expected_result, |
... | ... | |
80 | 95 |
else { |
81 | 96 |
$message = t('Value %value in %format format matches.', $t_args); |
82 | 97 |
} |
83 |
$actual_result = $view->field['created']->advanced_render($view->result[0]);
|
|
98 |
$actual_result = $view->field['created']->advanced_render($view->result[$check_result_number]);
|
|
84 | 99 |
$this->assertEqual($expected_result, $actual_result, $message); |
85 | 100 |
} |
86 | 101 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules