PageSourceSearch

https://cs.okiu.ac.jp/campusweb/static/pub/campus/6.0/js/old50_portal_main.js

js okiu.ac.jp collected 2026-10-01 12:11:24 UTC 14,595 bytes, 460 lines download raw bytes

1/* util */
2function cutUrl(url, base){
3  if (url == null || typeof url == 'undefined'){
4    return "";
5  }
6  if (url.indexOf(base, 0) == 0){
7    return url.substring(base.length);
8  }
9  return url;
10}
11
12function reloadPortal(tabId, page, locale, switchDevice, mainFrameWfId, action, target, customQuery){
13  if (tabId == null || typeof tabId == 'undefined'){
14    tabId = currentTabId;
15  }
16  if (page == null || typeof page == 'undefined'){
17    page = portalConf.page;
18  }
19  var query = "";
20  var mainWfSetFlg = true;
21  
22  if (customQuery != null && typeof customQuery != 'undefined' && customQuery != ''){
23    query = customQuery;
24    var idx = query.indexOf('?', 0);
25    if (idx > -1){
26      query = "&" + query.substring(idx+1);
27    }
28    if (action == 'rfw' && (mainFrameWfId == null || typeof mainFrameWfId == 'undefined' || mainFrameWfId == '')){
29      idx = query.indexOf('_flowId=', 0);
30      if (idx > -1){
31        mainWfSetFlg = false;
32        var last = query.indexOf('&', idx+1);
33        if (last > -1){
34          mainFrameWfId = query.substring(idx + 8, last);
35        } else {
36          mainFrameWfId = query.substring(idx + 8);
37        }
38      }
39    }
40  }
41  if (action != null && typeof action != 'undefined' && action != ''){
42    query += "&action=" + action;
43    if (mainWfSetFlg && action == 'rfw' && mainFrameWfId != null && typeof mainFrameWfId != 'undefined' && mainFrameWfId != ''){
44      query += "&_flowId=" + mainFrameWfId;
45    }
46  }
47  if (page != null && typeof page != 'undefined' && page != ''){
48    query += "&page=" + page;
49  }
50  if (tabId != null && typeof tabId != 'undefined' && tabId != '' && tabId != 'TABMENU'){
51    query += "&tabId=" + tabId;
52  }
53  if (locale != null && typeof locale != 'undefined' && locale != ''){
54    query += "&locale=" + locale;
55  }
56  if (mainFrameWfId != null && typeof mainFrameWfId != 'undefined' && mainFrameWfId != ''){
57    query += "&wfId=" + mainFrameWfId;
58  }
59  if (query != ""){
60    query = "?" + query.substring(1);
61  }
62  
63  var url = "";
64  if (switchDevice != null && typeof switchDevice != 'undefined' && switchDevice){
65    url = portalConf.switchDeviceUrl + query;
66  } else {
67    url = portalConf.portalUrl + query;
68  }
69  
70  if (target != null && typeof target != 'undefined'){
71    window.open(url, target);
72  } else {
73    location.href = url;
74  }
75  
76}
77
78/* ajax */
79function getAjaxGetUrl(wfId, param){
80  var url = portalConf.portalUrl + "?page=" + portalConf.page + "&action=rwf&tabId=" + currentTabId + "&wfId=" + wfId + "&rwfHash=" + portalConf.rwfHash;
81  if (param != null && typeof param != 'undefined' && param != ''){
82    url += "&" + param;
83  }
84  return url;
85}
86
87function loadWebMain(flowId, opt){
88  if (opt == null || typeof opt == 'undefined'){
89    opt = {};
90  }
91  var url = opt.url;
92  if (opt.url == null || typeof opt.url == 'undefined'){
93    url = portalConf.webUrl + "?_flowId=" + flowId;
94  }
95  
96  return loadPortletMenu("main", url, opt);
97}
98
99function loadPortletMain(menuId, opt){
100  if (opt == null || typeof opt == 'undefined'){
101    opt = {};
102  }
103  var url = opt.url;
104  if (opt.url == null || typeof opt.url == 'undefined'){
105    url = getAjaxGetUrl('main_' + menuId + '_menu');
106  }
107  
108  opt.portletFlg = '1';
109  opt.mainWfId = 'main_' + menuId + '_menu';
110  
111  return loadPortletMenu("main", url, opt);
112}
113
114function loadPortletMenu(target, url, opt){
115  if (opt == null || typeof opt == 'undefined'){
116    opt = {};
117  }
118  if (target == "main"){
119    if (portalConf.runMode == 'design' && opt.disableCheckDesign != true){
120      alert("設定中はメニュー機能を表示できません。");
121      return false;
122    }
123    
124    opt.url = url;
125    if (opt.portletFlg == '1'){
126      loadPortletImpl("main-frame-div", "GET", null, opt);
127    } else {
128        //if (portalConf.isDeviceLocaleSmartphone){
129    	//    reloadPortal(null, null, null, false, null, 'rfw', null, url);
130    	//} else {
131            loadPortletImpl("main-frame-if", "GET", null, opt);
132        //}
133    }
134  } else {
135    window.open(url, null);
136  }
137  return false;
138}
139function loadPortletGet(wfId, opt){
140  loadPortletImpl(wfId, "GET", null, opt); 
141  return false;
142}
143function loadPortletPost(wfId, formId, opt){
144  loadPortletImpl(wfId, "POST", formId, opt); 
145  return false;
146}
147function loadPortletImpl(wfId, method, formId, opt){
148  if (opt == null || typeof opt == 'undefined'){
149    opt = {};
150  }
151  if (opt.outEffect == null || typeof opt.outEffect == 'undefined'){
152    opt.outEffect = "fade";
153  }
154  if (opt.outOptions == null || typeof opt.outOptions == 'undefined'){
155    opt.outOptions = {};
156  }
157  if (opt.outSpeed == null || typeof opt.outSpeed == 'undefined'){
158    opt.outSpeed = "slow";
159  }
160  if (opt.inEffect == null || typeof opt.inEffect == 'undefined'){
161    opt.inEffect = "fade";
162  }
163  if (opt.inOptions == null || typeof opt.inOptions == 'undefined'){
164    opt.inOptions = {};
165  }
166  if (opt.inSpeed == null || typeof opt.inSpeed == 'undefined'){
167    opt.inSpeed = "slow";
168  }
169
170  if (wfId == "main-frame-if" || wfId == "main-frame-div"){
171    document.location.href = opt.url;
172    return;
173  }
174  
175  var portlet = $('#'+wfId, document);
176  if (portlet.length <= 0){
177    return false;
178  }
179  var box = portlet.parent();
180  
181  var scrollTop = $('html,body').scrollTop();
182  if (scrollTop <= 0){
183    scrollTop = $(window).scrollTop();
184  }
185  
186  portlet.css("z-index", "0");
187  
188  var title = $('#'+wfId+"-title", document);
189  if (title.is(':visible') && typeof title.attr("ptEffectFlg") != 'undefined'){
190    title.attr("ptEffectLock", "lock").hide();
191    $('#'+wfId+" .portlet-title-linker").attr("ptEffectLock", "lock").hide();
192  }
193  
194  // loading
195//  var loading = $('#'+wfId + "-loading", document);
196//  if (loading.length > 0){
197//    //loading.width(pw);
198//    loading.height(100);
199//    loading.css("z-index", "9999");
200//    loading.css("opacity", "1");
201//    var ptop = loading.parent().offset().top;
202//    if (ptop > 0){
203//      //loading.css("top", loading.parent().position().top);
204//    }
205//    loading.show();
206//  }
207  startLoading();
208  
209  if (true) {
210    var postData = {};
211    if (method == 'GET'){
212      if (opt.url == null || typeof opt.url == 'undefined'){
213        opt.url = getAjaxGetUrl(wfId, null);
214      }
215    } else {
216      if (opt.url == null || typeof opt.url == 'undefined'){
217        opt.url = $('#'+formId).attr("action");
218        if (opt.url == null || typeof opt.url == 'undefined'){
219          opt.url = portalConf.portalUrl;
220        }
221      }
222      
223      if (opt.customHidden != null && typeof opt.customHidden != 'undefined'){
224        postData = opt.customHidden;
225      }
226      
227      $('#'+formId).find(':input').each(function(){
228        if (!$(this).is(':disabled')) {
229          var name = $(this).attr('name');
230          if ($(this).attr('type') == "checkbox") {
231            if ($(this).is(':checked')) {
232              //if (typeof name != 'undefined' && name != '' && name.match(/\[\]$/)){
233                var arr = [];
234                $('#'+formId).find("input[name='"+name+"']:checked").each(function(){
235                  arr.push($(this).val());
236                });
237                if (arr.length > 1){
238                  postData[name] = arr;
239                } else {
240                  postData[name] = arr[0];
241                }
242              //} else {
243              //  postData[name] = $(this).val();
244              //}
245            }
246          } else if ($(this).attr('type') == "radio") {
247            if ($(this).is(':checked')) {
248              postData[name] = $(this).val();
249            }
250          } else if ($(this).get(0).tagName == "SELECT") {
251            postData[name] = $(this).val();
252          } else {
253            postData[name] = $(this).val();
254          }
255        }
256      });
257      if (postData.action == null && typeof postData.action == 'undefined'){
258        postData.action = "rwf";
259      }
260      if (postData.tabId == null && typeof postData.tabId == 'undefined'){
261        postData.tabId = currentTabId;
262      }
263      if (postData.page == null && typeof postData.page == 'undefined'){
264        postData.page = portalConf.page;
265      }
266      postData.rwfHash = portalConf.rwfHash;
267    }
268    $.ajax({
269      type: (method),
270      url: (opt.url),
271      cache: false,
272      data: (postData),
273      traditional: true,  // $.param option for jQuery 1.3 mode
274      timeout: 300000,  // 300sec
275      complete: function(xhr, status){
276        var result = xhr.responseText;
277        
278        if (xhr.status != 200 &&
279            (result == null || typeof result == '' || result.length <= 0)){
280          //TODO: エラー表示
281          portlet.html(xhr.statusText);
282          portlet.show();
283//          if (loading.length > 0){
284//            loading.hide();
285//          }
286          stopLoading();
287          
288        } else {
289          //200:OK
290          portlet.hide(opt.outEffect, opt.outOptions, opt.outSpeed, function() {
291            if (opt.outCallback != null && typeof opt.outCallback != 'undefined'){
292              opt.outCallback();
293            }
294            portlet.empty();
295            portlet.html(result);
296            portlet.show(opt.inEffect, opt.inOptions, opt.inSpeed, function() {
297              if (opt.inCallback != null && typeof opt.inCallback != 'undefined'){
298                opt.inCallback();
299              }
300              try{
301                if (portlet.find("#system-err-flg").length == 0){
302                  initTimeout();
303                }
304              } catch (e) {
305              }
306//              if (loading.length > 0){
307//                loading.fadeOut('fast', function() {
308//                  loading.hide();
309//                  portlet.show();
310//                  portlet.fadeTo("fast", 1.0);
311//                });
312//                loading.hide();
313//              } else {
314//                portlet.show();
315                portlet.fadeTo("fast", 1.0);
316//              }
317              portlet.show();
318              if (portlet.find(".no-title").length > 0){
319                setTimeout(function(){
320                  var title = getPortletTitle(wfId, portalConf.lang);
321                  $('#'+wfId).attr("title", title);
322                }, 1000);
323              }
324              if (opt.complete != null && typeof opt.complete != 'undefined'){
325                opt.complete();
326              }
327              
328//              if (loading.length > 0){
329//                loading.hide().css("display", "none");
330//              }
331              stopLoading();
332            });
333          });
334        }
335      }
336    });
337  }
338  
339  $('html,body').scrollTop(scrollTop);
340  
341  return false;
342}
343
344function showLoading(wfId){
345  var portlet = $('#'+wfId, document);
346  if (portlet.length <= 0){
347    return false;
348  }
349  var box = portlet.parent();
350  
351  var pw = box.width();
352  if (pw < 100){ pw = 100; }
353  
354  // loading
355  var loading = $('#'+wfId + "-loading", document);
356  loading.width(pw);
357  loading.height(100);
358  loading.css("z-index", "9999");
359  loading.css("opacity", "1");
360  var ptop = loading.parent().offset().top;
361  if (ptop > 0){
362    loading.css("top", loading.parent().position().top + 30);
363  }
364  loading.show();
365  return false;
366}
367
368function portletParamDialog(wfId){
369    if (portalConf.runMode == 'design'){
370      alert("ポータル設定中は機能設定を行えません。");
371      return false;
372    }
373    
374    var wh = Math.ceil($(window).height() / 3 * 2);
375    
376    var title = getPortletTitle(wfId, portalConf.lang);
377    
378    var mw = 600;
379    var mh = 300;
380    if (portalConf.isDeviceLocaleSmartphone){
381      mw = Math.floor(defWindowWidth * 0.75);
382    }
383
384    $("#portal-setting-param-dlg-box").empty();
385    $("#portlet-setting-param-dlg").dialog({
386      autoOpen: true,
387      modal: true,
388      resizable: true,
389      minWidth: (mw),
390      minHeight: (mh),
391      height: (wh),
392      title: (title + 'の機能設定'),
393      buttons: {
394        "OK": function(event) {
395          var id = $("#portal-setting-param-dlg-box").find("form:first").attr("id");
396          $('#portlet-setting-param-dlg').parent().find(".ui-dialog-buttonpane").hide();
397          
398          loadPortletPost('portal-setting-param-dlg-box', id, {
399            'inCallback': function(){
400              if ($('#portlet-setting-param-dlg').find("#RESULT-OK").length == 0){
401                $('#portlet-setting-param-dlg').parent().find(".ui-dialog-buttonpane").show();
402              }
403            }
404          });
405          
406        },
407        "キャンセル": function(event) {
408          $(this).dialog("close");
409        }
410      },
411      open: function() {
412        $(this).parent().parent().find(".ui-dialog").next(".ui-widget-overlay").css("background", "");
413        $(this).parent().find(".ui-dialog-titlebar-close").hide();
414        
415        var cf = {};
416        cf.wfId = "nwf_PTW0060001_99999999999999";
417        cf.event = "doParamSetting";
418        cf.wf = wfId;
419        
420        loadPortletPost('portal-setting-param-dlg-box', null, {
421          'customHidden': (cf),
422          'complete': function(){
423            $("#portal-setting-param-dlg-box .portal-setting-dlg-acc").find(".title").unbind().click(function(){
424              $(this).toggleClass("open");
425              $(this).parent().find(".portal-setting-box").toggle("blind", "", "fast");
426              if ($(this).hasClass("open")){
427                $(this).find("img").attr("src", portalConf.staticImageDir + "icon/allow_s_b.gif");
428              } else {
429                $(this).find("img").attr("src", portalConf.staticImageDir + "icon/allow_s_r.gif");
430              }
431            });
432          }
433        });
434      }
435    });
436    return false;
437}
438
439function portletSettingSaveEnd(){
440  $('#portlet-setting-param-dlg').dialog('close');
441  // OK to reload
442  reloadPortal();
443}
444
445function getPortletTitle(id, mode){
446  var title = "";
447  if (id == 'main-frame' || id == 'main-frame-if'){
448    title = $("#main-frame-if").contents().find(".portlet-title > span").text();
449  } else {
450    //title = $('#' + id).find(".portlet-title > span").text();
451    if (mode == 'ja'){
452      title = $('#' + id).find("#wfNm").val();
453    } else if (mode == 'en'){
454      title = $('#' + id).find("#wfNmEng").val();
455    } else if (mode == 'icon'){
456      title = $('#' + id).find("#wfIcon").val();
457    }
458  }
459  return title;
460}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.