| 1 | /** |
|---|
| 2 | * |
|---|
| 3 | * TCho[ÒW JavaScript |
|---|
| 4 | * |
|---|
| 5 | * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved. |
|---|
| 6 | * |
|---|
| 7 | * [email protected] |
|---|
| 8 | * http://www.drecom.co.jp/ |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | //--------------------------------------------------------------------------------- |
|---|
| 13 | // Ýè |
|---|
| 14 | //--------------------------------------------------------------------------------- |
|---|
| 15 | |
|---|
| 16 | // *** úÝèÏ *** // |
|---|
| 17 | |
|---|
| 18 | var gSidefuncOrderForm = null; |
|---|
| 19 | var SIDEFUNC_ORDER_FORM_NAME = "SidefuncOrderForm"; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | // 2004-04-13 Takanori Ishikawa |
|---|
| 23 | // ------------------------------------------------------------------------ |
|---|
| 24 | // |
|---|
| 25 | // Mac Ì IE5 ÍÀWÖAÌ@\i¾¯¶áÈ¢¯Çj̽ª¶ÁÄ¢é |
|---|
| 26 | // ÌÅKÉÎ |
|---|
| 27 | // |
|---|
| 28 | // QlF |
|---|
| 29 | // Mac ÌH¦È¢ìYÇà |
|---|
| 30 | // http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm |
|---|
| 31 | // Microsoft |
|---|
| 32 | // http://www.microsoft.com/ |
|---|
| 33 | // |
|---|
| 34 | var MAC_IE5_PITCH_X; |
|---|
| 35 | var MAC_IE5_PITCH_Y; |
|---|
| 36 | |
|---|
| 37 | MAC_IE5_PITCH_X = MAC_IE5_PITCH_Y = 0; /* BITCH */ |
|---|
| 38 | if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) { |
|---|
| 39 | MAC_IE5_PITCH_X = -10; |
|---|
| 40 | MAC_IE5_PITCH_Y = 0; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | // *** CheckLine *** // |
|---|
| 45 | var CHECKLINE_ID = 'checkline'; |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | // --- Panel --- |
|---|
| 49 | // ¯Êq |
|---|
| 50 | var PANEL_NAME_DISABLE = 'DISABLE'; // O@\BOXÌID |
|---|
| 51 | var PANEL_NAME_LEFT = 'LEFT'; // àE¶@\BOXÌID |
|---|
| 52 | var PANEL_NAME_RIGHT = 'RIGHT'; // àEE@\BOXÌID |
|---|
| 53 | |
|---|
| 54 | //·×ÄÌ Panel ðvpeBÉàÂIuWFNg |
|---|
| 55 | // key Í name |
|---|
| 56 | var gAllPanels = new Object(); |
|---|
| 57 | |
|---|
| 58 | // ¶©çÌÔ |
|---|
| 59 | var gPanelNames = [PANEL_NAME_DISABLE, PANEL_NAME_LEFT, PANEL_NAME_RIGHT]; |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | // --- Box --- |
|---|
| 63 | var BOX_ID_PREFIX = 'f'; // Box Ì ID vtBbNX |
|---|
| 64 | var BoxConfig = { |
|---|
| 65 | width: 120, // Box |
|---|
| 66 | height: 20, // Box ³ |
|---|
| 67 | padding: 10, // Box ÔÌXy[X |
|---|
| 68 | marginTop: 5, // êÔãÌBoxÆeplÆÌXy[X |
|---|
| 69 | marginLeft: 5 // Box Æepl̶¤ÌXy[X |
|---|
| 70 | }; |
|---|
| 71 | |
|---|
| 72 | // Box zuÌæÌŬ³ |
|---|
| 73 | var MIN_BOXIES_HEIGHT = 200; |
|---|
| 74 | |
|---|
| 75 | // ·×ÄÌ Box ðvpeBÉàÂIuWFNg |
|---|
| 76 | var gAllBoxes = new Object(); |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * plÉi[Å«éÅå Box ðL^µ½IuWFNg |
|---|
| 80 | * |
|---|
| 81 | * key: pl¼ value: plÉi[Å«éÅå Box |
|---|
| 82 | * |
|---|
| 83 | */ |
|---|
| 84 | |
|---|
| 85 | BoxConfig.maxNBoxes = new Object(); |
|---|
| 86 | BoxConfig.maxNBoxes[PANEL_NAME_DISABLE] = OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES; // ugpµÈ¢@\v |
|---|
| 87 | BoxConfig.maxNBoxes[PANEL_NAME_LEFT] = OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES; // ugp·é@\v¶ |
|---|
| 88 | BoxConfig.maxNBoxes[PANEL_NAME_RIGHT] = OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES; // ugp·é@\vE |
|---|
| 89 | |
|---|
| 90 | /** |
|---|
| 91 | * y[WÇÝÝÌzuf[^ |
|---|
| 92 | */ |
|---|
| 93 | gInitialBoxPositionsData = null; |
|---|
| 94 | |
|---|
| 95 | //--------------------------------------------------------- |
|---|
| 96 | // zuÈÇ |
|---|
| 97 | //--------------------------------------------------------- |
|---|
| 98 | /** |
|---|
| 99 | * HTML Ì hidden input vf©çÚÌzuÈÇÌîñðÇÝæéIuWFNg |
|---|
| 100 | * |
|---|
| 101 | * @author Takanori Ishikawa |
|---|
| 102 | * @version 2004/04/23 |
|---|
| 103 | */ |
|---|
| 104 | SFSettings = new Object(); |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | * HTML Ì hidden input vf©çÝèlðÇÝæé |
|---|
| 108 | */ |
|---|
| 109 | SFSettings.loadBoxPositions = function() |
|---|
| 110 | { |
|---|
| 111 | var positions = new Object(); |
|---|
| 112 | var orders = new Array(); |
|---|
| 113 | var panelNames = new Array(); |
|---|
| 114 | |
|---|
| 115 | // hidden©çbox_positionðæ¾ |
|---|
| 116 | positions[PANEL_NAME_DISABLE] = new Array(); |
|---|
| 117 | positions[PANEL_NAME_LEFT] = new Array(); |
|---|
| 118 | positions[PANEL_NAME_RIGHT] = new Array(); |
|---|
| 119 | for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) { |
|---|
| 120 | var elem = gSidefuncOrderForm.elements[i]; |
|---|
| 121 | |
|---|
| 122 | if(Box.ORDER_PROPERTY_NAME == elem.name) { |
|---|
| 123 | orders[orders.length] = elem.value; |
|---|
| 124 | } else if(Box.POSITION_PROPERTY_NAME == elem.name) { |
|---|
| 125 | var idx = XBSUtil.parseIntNoError(elem.value); |
|---|
| 126 | panelNames[panelNames.length] = gPanelNames[idx]; |
|---|
| 127 | } else if (Box.ID_PROPERTY_NAME == elem.name) { |
|---|
| 128 | ; |
|---|
| 129 | } |
|---|
| 130 | } |
|---|
| 131 | for (var i = 0; i < orders.length; i++) { |
|---|
| 132 | var pnm = panelNames[i]; |
|---|
| 133 | var bid = i; |
|---|
| 134 | var ord = orders[i]; |
|---|
| 135 | |
|---|
| 136 | positions[pnm][bid] = ord; |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | orders = null; |
|---|
| 140 | panelNames = null; |
|---|
| 141 | return positions; |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | /** |
|---|
| 145 | * »ÝÌóÔðPêÌIuWFNgÉGR[hµÄÔ·B |
|---|
| 146 | */ |
|---|
| 147 | SFSettings.getObjectForPersistent = function() |
|---|
| 148 | { |
|---|
| 149 | var orders = new Array(); |
|---|
| 150 | var pidxes = new Array(); |
|---|
| 151 | var result = ''; |
|---|
| 152 | |
|---|
| 153 | if (gSidefuncOrderForm == null) { |
|---|
| 154 | return result; |
|---|
| 155 | } |
|---|
| 156 | for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) { |
|---|
| 157 | var elem = gSidefuncOrderForm.elements[i]; |
|---|
| 158 | |
|---|
| 159 | if(Box.ORDER_PROPERTY_NAME == elem.name) { |
|---|
| 160 | orders[orders.length] = elem.value; |
|---|
| 161 | } else if(Box.POSITION_PROPERTY_NAME == elem.name) { |
|---|
| 162 | pidxes[pidxes.length] = XBSUtil.parseIntNoError(elem.value); |
|---|
| 163 | } |
|---|
| 164 | } |
|---|
| 165 | result += pidxes.join(''); |
|---|
| 166 | result += orders.join(''); |
|---|
| 167 | pidxes = null; |
|---|
| 168 | orders = null; |
|---|
| 169 | |
|---|
| 170 | return result; |
|---|
| 171 | } |
|---|
| 172 | |
|---|
| 173 | //--------------------------------------------------------- |
|---|
| 174 | // ContentsChangedListener |
|---|
| 175 | //--------------------------------------------------------- |
|---|
| 176 | /** |
|---|
| 177 | * TCho[ÌÏXðÄ·éIuWFNg |
|---|
| 178 | * ContentsChangedListener ÌTuNX |
|---|
| 179 | * |
|---|
| 180 | * @author Takanori Ishikawa |
|---|
| 181 | * @version 2004/04/23 |
|---|
| 182 | */ |
|---|
| 183 | function SFChangedListener(/* Optional */ aName) /* extends ContentsChangedListener */ |
|---|
| 184 | { |
|---|
| 185 | } |
|---|
| 186 | SFChangedListener.prototype = new ContentsChangedListener(); |
|---|
| 187 | SFChangedListener.prototype.setChanged = function(b) |
|---|
| 188 | { |
|---|
| 189 | var persistent = SFSettings.getObjectForPersistent(); |
|---|
| 190 | |
|---|
| 191 | // 2004-04-23 Takanori Ishikawa |
|---|
| 192 | // ------------------------------------------------------------------------ |
|---|
| 193 | // ±±Å prototype Ì\bhðÄÑoµÄà¤Ü¢©È¢B |
|---|
| 194 | |
|---|
| 195 | this.changed = (gInitialBoxPositionsData != persistent); |
|---|
| 196 | } |
|---|
| 197 | |
|---|
| 198 | //--------------------------------------------------------- |
|---|
| 199 | // Drag & Drop: SFDragManager (Sidebar Function DragManager) |
|---|
| 200 | //--------------------------------------------------------- |
|---|
| 201 | /** |
|---|
| 202 | * hbOÌLø»ArÌóÔðÛ·é½ßÌIuWFNg |
|---|
| 203 | * hbOÍêxÉÐÆÂµ©N±çÈ¢ÌÅA¢ÜÌÆ±ë |
|---|
| 204 | * Singleton ƵÄÀ |
|---|
| 205 | * |
|---|
| 206 | * For example: |
|---|
| 207 | * <pre> |
|---|
| 208 | * // prepare for dragging, enable event handler. |
|---|
| 209 | * SFDragManager.enableEventHandler(); |
|---|
| 210 | * </pre> |
|---|
| 211 | * |
|---|
| 212 | * @author Takanori Ishikawa |
|---|
| 213 | * @version 1.0 |
|---|
| 214 | */ |
|---|
| 215 | SFDragManager = new Object(); |
|---|
| 216 | |
|---|
| 217 | // *** Event Handler *** // |
|---|
| 218 | SFDragManager.ondrop = null; // zuªÏX³ê½ |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | // hbOÉp·é document ÌCxgnhðÝè |
|---|
| 222 | SFDragManager.enableEventHandler = function () |
|---|
| 223 | { |
|---|
| 224 | document.onmousemove = function(e) { |
|---|
| 225 | if (SFDragManager.box != null) |
|---|
| 226 | SFDragManager.moveBox(e); |
|---|
| 227 | }; |
|---|
| 228 | |
|---|
| 229 | document.onmouseup = function(e) { |
|---|
| 230 | if (SFDragManager.box != null) |
|---|
| 231 | SFDragManager.downBox(e); |
|---|
| 232 | }; |
|---|
| 233 | |
|---|
| 234 | for (var key in gAllBoxes) { |
|---|
| 235 | var box = gAllBoxes[key]; |
|---|
| 236 | var src = box ? box.getHTMLElement() : null; |
|---|
| 237 | |
|---|
| 238 | if (src != null) { |
|---|
| 239 | src.onmousedown = SFDragManager.pickUpBox; |
|---|
| 240 | } |
|---|
| 241 | } |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| 244 | // hbOÉp·é document ÌCxgnhðð |
|---|
| 245 | SFDragManager.disbleEventHandler= function() |
|---|
| 246 | { |
|---|
| 247 | document.onmousemove = ''; |
|---|
| 248 | document.onmouseup = ''; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | |
|---|
| 252 | //hbOÌIuWFNg |
|---|
| 253 | |
|---|
| 254 | SFDragManager.destination = null; /* Ú®æ Panel */ |
|---|
| 255 | SFDragManager.source = null; /* Ú®³ Panel */ |
|---|
| 256 | SFDragManager.box = null; /* hbOÌ Panel */ |
|---|
| 257 | |
|---|
| 258 | /** |
|---|
| 259 | * TCho[ÚÌÏXðÄ·éIuWFNgðÔ·B |
|---|
| 260 | */ |
|---|
| 261 | SFDragManager.getChangedListener = function() |
|---|
| 262 | { |
|---|
| 263 | if (SFDragManager.getChangedListener.$instance == null) { |
|---|
| 264 | |
|---|
| 265 | SFDragManager.getChangedListener.$instance = |
|---|
| 266 | new SFChangedListener("[Sidebar Function Order]"); |
|---|
| 267 | } |
|---|
| 268 | return SFDragManager.getChangedListener.$instance; |
|---|
| 269 | } |
|---|
| 270 | SFDragManager.setUpContentsChangedListener = function() |
|---|
| 271 | { |
|---|
| 272 | // 2004-04-23 Takanori Ishikawa |
|---|
| 273 | // ------------------------------------------------------------------------ |
|---|
| 274 | // TCho[ÌzuªÏX³ê½©Ç¤©ðL^ |
|---|
| 275 | |
|---|
| 276 | var listener = SFDragManager.getChangedListener(); |
|---|
| 277 | |
|---|
| 278 | listener.listenEvent(SFDragManager, 'ondrop'); |
|---|
| 279 | OEMBlogGlobal.watchOtherLinks(document, listener); |
|---|
| 280 | } |
|---|
| 281 | |
|---|
| 282 | /** |
|---|
| 283 | * setOnLoad() |
|---|
| 284 | * |
|---|
| 285 | * y[WÇÝÝÌú |
|---|
| 286 | */ |
|---|
| 287 | SFDragManager.loaded = false; |
|---|
| 288 | SFDragManager.onload = function() |
|---|
| 289 | { |
|---|
| 290 | // tH[ú» |
|---|
| 291 | gSidefuncOrderForm = UtilKit.getPropertyNotNull(document, SIDEFUNC_ORDER_FORM_NAME); |
|---|
| 292 | |
|---|
| 293 | // e Panel, Box IuWFNg¶¬ |
|---|
| 294 | var boxPositions = SFSettings.loadBoxPositions(); |
|---|
| 295 | gInitialBoxPositionsData = SFSettings.getObjectForPersistent(); |
|---|
| 296 | for (var i = 0; i < gPanelNames.length; i++) { |
|---|
| 297 | var nm = gPanelNames[i]; |
|---|
| 298 | var panel; |
|---|
| 299 | |
|---|
| 300 | panel = new Panel(nm, boxPositions[nm]); |
|---|
| 301 | |
|---|
| 302 | for(var key in panel.box_position) { |
|---|
| 303 | gAllBoxes[key] = new Box(key); |
|---|
| 304 | } |
|---|
| 305 | |
|---|
| 306 | // Box Ìúzu |
|---|
| 307 | panel.setBoxPosition(); |
|---|
| 308 | Panel[nm] = panel; |
|---|
| 309 | |
|---|
| 310 | gAllPanels[nm] = panel; |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | // hbOÌõ |
|---|
| 315 | SFDragManager.setUpContentsChangedListener(); |
|---|
| 316 | SFDragManager.enableEventHandler(); |
|---|
| 317 | |
|---|
| 318 | // onload àCxg |
|---|
| 319 | resetPositionsInEventHandler(); |
|---|
| 320 | window.onresize = resetPositionsInEventHandler; |
|---|
| 321 | |
|---|
| 322 | SFDragManager.loaded = true; |
|---|
| 323 | // 2004-04-20 Takanori Ishikawa |
|---|
| 324 | // ------------------------------------------------------------------------ |
|---|
| 325 | // Opera ÅÍ onload _ÅC[ÌÄ`æªÔÉíÈ¢B |
|---|
| 326 | // ±ÌÖðgÁÄA³âèÄ`æ·éB |
|---|
| 327 | if (window.opera) { |
|---|
| 328 | SFDragManager.loaded = false; |
|---|
| 329 | setTimeout("refreshDisplay()", 0.8*1000); |
|---|
| 330 | } |
|---|
| 331 | |
|---|
| 332 | } |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | //--------------------------------------------------------- |
|---|
| 336 | // Cxg |
|---|
| 337 | //--------------------------------------------------------- |
|---|
| 338 | // CheckLine |
|---|
| 339 | /** |
|---|
| 340 | * hbOÌ Box ª}ü³êéÓðwµ¦·½ßÌC |
|---|
| 341 | * |
|---|
| 342 | * @return XBSLayer |
|---|
| 343 | * @see xbs.js |
|---|
| 344 | */ |
|---|
| 345 | function getCheckLineLayer() |
|---|
| 346 | { |
|---|
| 347 | if (null == getCheckLineLayer.layer) { |
|---|
| 348 | getCheckLineLayer.layer = XBSLayer.makeLayer(CHECKLINE_ID); |
|---|
| 349 | } |
|---|
| 350 | return getCheckLineLayer.layer; |
|---|
| 351 | } |
|---|
| 352 | function getPanelAtPosition(x, y) |
|---|
| 353 | { |
|---|
| 354 | var panel = null; |
|---|
| 355 | |
|---|
| 356 | for (var key in gAllPanels) { |
|---|
| 357 | panel = gAllPanels[key]; |
|---|
| 358 | |
|---|
| 359 | if (x > panel.panel_section['left'] && |
|---|
| 360 | x < panel.panel_section['right'] && |
|---|
| 361 | y > panel.panel_section['top'] && |
|---|
| 362 | y < panel.panel_section['under']) |
|---|
| 363 | { break; } |
|---|
| 364 | } |
|---|
| 365 | return panel; |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | // 2004-04-13 Takanori Ishikawa |
|---|
| 369 | // ------------------------------------------------------------------------ |
|---|
| 370 | // Mac IE ÅÍCxgnhÌÅÀWÖWÌìðs¤Æ¤Ü¢©È¢ÌÅ |
|---|
| 371 | // ·±µxç¹ÄÀs |
|---|
| 372 | function resetPositionsInEventHandler() |
|---|
| 373 | { |
|---|
| 374 | if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) { |
|---|
| 375 | setTimeout("resetPositions()", 1*1000); |
|---|
| 376 | } else { |
|---|
| 377 | resetPositions(); |
|---|
| 378 | } |
|---|
| 379 | } |
|---|
| 380 | |
|---|
| 381 | // *** Reset *** // |
|---|
| 382 | /** |
|---|
| 383 | * ·×ÄÌ Box ðÄzu |
|---|
| 384 | */ |
|---|
| 385 | function resetPositions() |
|---|
| 386 | { |
|---|
| 387 | var panel; |
|---|
| 388 | |
|---|
| 389 | for (var key in gAllPanels) { |
|---|
| 390 | panel = gAllPanels[key]; |
|---|
| 391 | if (panel != null) { |
|---|
| 392 | panel.setSections(); |
|---|
| 393 | panel.setBoxPosition(); |
|---|
| 394 | } |
|---|
| 395 | } |
|---|
| 396 | } |
|---|
| 397 | |
|---|
| 398 | /** |
|---|
| 399 | * ·×ÄÌ Box ðêxÁµA·®É·×Ä\¦ |
|---|
| 400 | */ |
|---|
| 401 | function refreshDisplay() |
|---|
| 402 | { |
|---|
| 403 | var panel; |
|---|
| 404 | |
|---|
| 405 | for (var key in gAllPanels) { |
|---|
| 406 | panel = gAllPanels[key]; |
|---|
| 407 | if (panel != null) { |
|---|
| 408 | panel.setBoxVisible(false); |
|---|
| 409 | panel.setBoxVisible(true); |
|---|
| 410 | } |
|---|
| 411 | } |
|---|
| 412 | SFDragManager.loaded = true; |
|---|
| 413 | } |
|---|
| 414 | |
|---|
| 415 | // ----------------------------------------------------------------- |
|---|
| 416 | // {bNXÌhbOhbv |
|---|
| 417 | // ----------------------------------------------------------------- |
|---|
| 418 | |
|---|
| 419 | /** |
|---|
| 420 | * pickUpBox() |
|---|
| 421 | * theEvent: Cxg |
|---|
| 422 | * |
|---|
| 423 | * Boxð¿ã°½(NbN³ê½)Ìð·éÖ |
|---|
| 424 | */ |
|---|
| 425 | SFDragManager.pickUpBox = function(theEvent) { |
|---|
| 426 | if (null == theEvent) { |
|---|
| 427 | theEvent = window.event; |
|---|
| 428 | } |
|---|
| 429 | if (SFDragManager.box != null || SFDragManager.loaded == false) |
|---|
| 430 | return; |
|---|
| 431 | |
|---|
| 432 | // }EXÊuæ¾ |
|---|
| 433 | var mouse_x = XBSEvent.getMouseX(theEvent); |
|---|
| 434 | var mouse_y = XBSEvent.getMouseY(theEvent); |
|---|
| 435 | var pickedPanel = getPanelAtPosition(mouse_x, mouse_y); |
|---|
| 436 | |
|---|
| 437 | if (null == pickedPanel) |
|---|
| 438 | return; |
|---|
| 439 | |
|---|
| 440 | // Ið³ê½BoxÌÀÑÔÆ id ðæ¾ |
|---|
| 441 | var beforeId = pickedPanel.orderIndexOfBoxAt(mouse_x, mouse_y); |
|---|
| 442 | var funcId = UtilKit.getKeyForValue(pickedPanel.box_position, beforeId); |
|---|
| 443 | |
|---|
| 444 | if (null == funcId) |
|---|
| 445 | return; |
|---|
| 446 | |
|---|
| 447 | //BoxGgæ¾E |
|---|
| 448 | var selected = new XBSLayer(BOX_ID_PREFIX + funcId); |
|---|
| 449 | if (null == selected) |
|---|
| 450 | return; |
|---|
| 451 | |
|---|
| 452 | selected.setZIndex(selected.getZIndex() +1); |
|---|
| 453 | |
|---|
| 454 | //Ið³ê½BoxÌX,YÀWðÛ¶ |
|---|
| 455 | before_box_x = selected.getX() + MAC_IE5_PITCH_X; |
|---|
| 456 | before_box_y = selected.getY() + MAC_IE5_PITCH_Y; |
|---|
| 457 | |
|---|
| 458 | //}EXÆBox´_Ì· |
|---|
| 459 | box_to_mouse_x = mouse_x - before_box_x; |
|---|
| 460 | box_to_mouse_y = mouse_y - before_box_y; |
|---|
| 461 | |
|---|
| 462 | // hbOJn |
|---|
| 463 | SFDragManager.box = selected; |
|---|
| 464 | SFDragManager.source = pickedPanel; |
|---|
| 465 | before_order_id = beforeId; |
|---|
| 466 | function_id = funcId; |
|---|
| 467 | } |
|---|
| 468 | |
|---|
| 469 | |
|---|
| 470 | /** |
|---|
| 471 | * |
|---|
| 472 | * BoxðÚ®·éÖ |
|---|
| 473 | * |
|---|
| 474 | * @param theEvent mousemove Cxg |
|---|
| 475 | */ |
|---|
| 476 | SFDragManager.moveBox = function(theEvent) { |
|---|
| 477 | var selected = SFDragManager.box; |
|---|
| 478 | |
|---|
| 479 | if (null == selected || SFDragManager.loaded == false) |
|---|
| 480 | return; |
|---|
| 481 | if (null == theEvent) { |
|---|
| 482 | theEvent = window.event; |
|---|
| 483 | } |
|---|
| 484 | // |
|---|
| 485 | // hbOAEBhE©çoéZbgµÄIíé |
|---|
| 486 | // |
|---|
| 487 | if (false == Box.canMoveWithEvent(theEvent)) { |
|---|
| 488 | gAllBoxes[function_id].setPosition(before_box_x, before_box_y); |
|---|
| 489 | clearMove(); |
|---|
| 490 | |
|---|
| 491 | return; |
|---|
| 492 | } |
|---|
| 493 | |
|---|
| 494 | var mouse_x = XBSEvent.getMouseX(theEvent); |
|---|
| 495 | var mouse_y = XBSEvent.getMouseY(theEvent); |
|---|
| 496 | var curPanel = getPanelAtPosition(mouse_x, mouse_y); |
|---|
| 497 | if (null == curPanel) |
|---|
| 498 | return; |
|---|
| 499 | |
|---|
| 500 | if (curPanel.canDropAtPosition(SFDragManager.source, selected, mouse_x, mouse_y)) { |
|---|
| 501 | // `FbNC\¦ |
|---|
| 502 | curPanel.showCheckLineAtPosition(mouse_x, mouse_y); |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | //BoxÚ® |
|---|
| 506 | move_to_x = mouse_x - box_to_mouse_x; |
|---|
| 507 | move_to_y = mouse_y - box_to_mouse_y; |
|---|
| 508 | |
|---|
| 509 | selected.setLeftTopPosition(move_to_x, move_to_y); |
|---|
| 510 | } |
|---|
| 511 | |
|---|
| 512 | |
|---|
| 513 | |
|---|
| 514 | /** |
|---|
| 515 | * Box ðºëµ½Ì |
|---|
| 516 | * |
|---|
| 517 | * @param theEvent Cxg |
|---|
| 518 | */ |
|---|
| 519 | SFDragManager.downBox = function(theEvent) |
|---|
| 520 | { |
|---|
| 521 | if (SFDragManager.loaded == false) { |
|---|
| 522 | return; |
|---|
| 523 | } |
|---|
| 524 | if (null == theEvent) { |
|---|
| 525 | theEvent = window.event; |
|---|
| 526 | } |
|---|
| 527 | // `FbNCðÁ· |
|---|
| 528 | getCheckLineLayer().setVisible(false); |
|---|
| 529 | |
|---|
| 530 | // }EXÊuæ¾ |
|---|
| 531 | var mouse_x = XBSEvent.getMouseX(theEvent); |
|---|
| 532 | var mouse_y = XBSEvent.getMouseY(theEvent); |
|---|
| 533 | |
|---|
| 534 | // ------------------------------------- |
|---|
| 535 | // Ú®Ìæà©O©`FbN |
|---|
| 536 | // ------------------------------------- |
|---|
| 537 | // Ú®æÌplðæ¾µAhbOîñðXV |
|---|
| 538 | // hbOOãÌpl |
|---|
| 539 | var beforePanel = SFDragManager.source; |
|---|
| 540 | var afterPanel = getPanelAtPosition(mouse_x, mouse_y); |
|---|
| 541 | |
|---|
| 542 | SFDragManager.destination = afterPanel; |
|---|
| 543 | if (null == beforePanel) { |
|---|
| 544 | throw ASSERT_EXCEPTION + 'SFDragManager.source must be not null'; |
|---|
| 545 | } |
|---|
| 546 | |
|---|
| 547 | var droppedBox = gAllBoxes[function_id]; |
|---|
| 548 | var after_order_id = afterPanel.orderIndexOfMovingAt(mouse_x, mouse_y); |
|---|
| 549 | |
|---|
| 550 | // hbvūȢêABox ðßµÄAhbOðI¹·é |
|---|
| 551 | if (false == afterPanel.canDropAtPosition(beforePanel, droppedBox, mouse_x, mouse_y)) { |
|---|
| 552 | droppedBox.setPosition(before_box_x, before_box_y); |
|---|
| 553 | clearMove(); |
|---|
| 554 | return; |
|---|
| 555 | } |
|---|
| 556 | |
|---|
| 557 | // Ú®·éBoxðpl©çíµAÔð®·é |
|---|
| 558 | delete beforePanel.box_position[function_id]; |
|---|
| 559 | for (key in beforePanel.box_position) { |
|---|
| 560 | if (before_order_id < beforePanel.box_position[key]) { |
|---|
| 561 | --beforePanel.box_position[key]; |
|---|
| 562 | } |
|---|
| 563 | } |
|---|
| 564 | |
|---|
| 565 | //after_order_idÌ |
|---|
| 566 | if (!(beforePanel.equals(afterPanel) && before_order_id <= after_order_id)) { |
|---|
| 567 | ++after_order_id; |
|---|
| 568 | } |
|---|
| 569 | |
|---|
| 570 | |
|---|
| 571 | // ÅåÌCfbNXðXV |
|---|
| 572 | if (after_order_id > afterPanel.getMaxOrderIndex() + 1) { |
|---|
| 573 | after_order_id = afterPanel.getMaxOrderIndex() + 1; |
|---|
| 574 | } |
|---|
| 575 | |
|---|
| 576 | //}ü·éÔðÂèA}ü·é |
|---|
| 577 | for (key in afterPanel.box_position) { |
|---|
| 578 | if (after_order_id <= afterPanel.box_position[key]) { |
|---|
| 579 | ++afterPanel.box_position[key]; |
|---|
| 580 | } |
|---|
| 581 | } |
|---|
| 582 | afterPanel.box_position[function_id] = after_order_id; |
|---|
| 583 | |
|---|
| 584 | //BoxÄzu |
|---|
| 585 | if (false == beforePanel.equals(afterPanel)) { |
|---|
| 586 | beforePanel.setBoxPosition(); |
|---|
| 587 | } |
|---|
| 588 | afterPanel.setBoxPosition(); |
|---|
| 589 | |
|---|
| 590 | // HTMLÌhiddenlÏX |
|---|
| 591 | for (var nm in gAllPanels) { |
|---|
| 592 | var p = gAllPanels[nm]; |
|---|
| 593 | |
|---|
| 594 | for (key in p.box_position) { |
|---|
| 595 | gSidefuncOrderForm.elements['order'][key].value = p.box_position[key]; |
|---|
| 596 | gSidefuncOrderForm.elements['position'][key].value = p.getPosition(); |
|---|
| 597 | } |
|---|
| 598 | } |
|---|
| 599 | |
|---|
| 600 | // Ú®Ìð |
|---|
| 601 | clearMove(); |
|---|
| 602 | if (SFDragManager.ondrop != null && typeof SFDragManager.ondrop == 'function') { |
|---|
| 603 | SFDragManager.ondrop(); |
|---|
| 604 | } |
|---|
| 605 | } |
|---|
| 606 | |
|---|
| 607 | |
|---|
| 608 | /** |
|---|
| 609 | * clearMove() |
|---|
| 610 | * |
|---|
| 611 | * BoxÚ®ðI¹·éÖ |
|---|
| 612 | */ |
|---|
| 613 | function clearMove() { |
|---|
| 614 | var selected = SFDragManager.box; |
|---|
| 615 | |
|---|
| 616 | selected.setZIndex(selected.getZIndex() -1); |
|---|
| 617 | SFDragManager.box = null; |
|---|
| 618 | } |
|---|
| 619 | |
|---|
| 620 | |
|---|
| 621 | |
|---|
| 622 | |
|---|
| 623 | //--------------------------------------------------------------------------------- |
|---|
| 624 | // Panel |
|---|
| 625 | //--------------------------------------------------------------------------------- |
|---|
| 626 | /** |
|---|
| 627 | * ÂXÌhbOÂ\ÈÚðÛ·éÌæ |
|---|
| 628 | * |
|---|
| 629 | * ¢ÜÌÆ±ëA¶©çugpµÈ¢@\vugp·é@\E¶vugp·é@\EEv |
|---|
| 630 | * |
|---|
| 631 | * @param aPanelName pl̼O |
|---|
| 632 | * @param aPositionArray BoxÌzuîñzñ |
|---|
| 633 | * |
|---|
| 634 | * @author Yusuke Saito |
|---|
| 635 | * @version 2003/10/10 |
|---|
| 636 | * |
|---|
| 637 | * @author Takanori Ishikawa |
|---|
| 638 | * @version 2004/04/20 |
|---|
| 639 | */ |
|---|
| 640 | function Panel(aPanelName, aPositionArray) |
|---|
| 641 | { |
|---|
| 642 | this.name = aPanelName; // pl̼O(divÌid) |
|---|
| 643 | this.box_position = aPositionArray; // BoxÌzuîñzñ |
|---|
| 644 | this.box_limit_number = BoxConfig.maxNBoxes[aPanelName]; // plàÌÅåBox |
|---|
| 645 | |
|---|
| 646 | this.position = -1; |
|---|
| 647 | for (var i = 0; i < gPanelNames.length; i++) { |
|---|
| 648 | if (this.name == gPanelNames[i]) { |
|---|
| 649 | this.position = i; |
|---|
| 650 | break; |
|---|
| 651 | } |
|---|
| 652 | } |
|---|
| 653 | |
|---|
| 654 | // plE{bNXEÚ®ÌeÌæðÝè |
|---|
| 655 | this.setSections(); |
|---|
| 656 | } |
|---|
| 657 | |
|---|
| 658 | /** |
|---|
| 659 | * Box Ì Y offset |
|---|
| 660 | * |
|---|
| 661 | * @param anIndex order index |
|---|
| 662 | */ |
|---|
| 663 | Panel.getBoxSectionOffsetY = function(anIndex) |
|---|
| 664 | { |
|---|
| 665 | if (Panel.box_section_y == null) { // Box ÊuÝè |
|---|
| 666 | var nboxs = BoxConfig.maxNBoxes[PANEL_NAME_DISABLE]; |
|---|
| 667 | Panel.box_section_y = new Array(nboxs); |
|---|
| 668 | |
|---|
| 669 | for (var i = 0; i < nboxs; ++i) { |
|---|
| 670 | Panel.box_section_y[i] = (BoxConfig.height + BoxConfig.padding) * i + BoxConfig.marginTop; |
|---|
| 671 | } |
|---|
| 672 | } |
|---|
| 673 | return Panel.box_section_y[anIndex]; |
|---|
| 674 | } |
|---|
| 675 | |
|---|
| 676 | Panel.prototype.getPosition = function() { |
|---|
| 677 | return this.position; |
|---|
| 678 | } |
|---|
| 679 | |
|---|
| 680 | /** |
|---|
| 681 | * description |
|---|
| 682 | */ |
|---|
| 683 | Panel.prototype.toString = function() |
|---|
| 684 | { |
|---|
| 685 | return '[Panel] ' + this.name; |
|---|
| 686 | } |
|---|
| 687 | |
|---|
| 688 | /** |
|---|
| 689 | * är |
|---|
| 690 | * |
|---|
| 691 | * @param aPanel pl |
|---|
| 692 | */ |
|---|
| 693 | Panel.prototype.equals = function(aPanel) |
|---|
| 694 | { |
|---|
| 695 | // 2004-04-23 Takanori Ishikawa |
|---|
| 696 | // ------------------------------------------------------------------------ |
|---|
| 697 | // instanceof Í IE 6 Åà¢T|[g |
|---|
| 698 | if (aPanel == null || /*false == (aPanel instanceof Panel)*/ typeof aPanel.name == 'undefined') { |
|---|
| 699 | return false; |
|---|
| 700 | } |
|---|
| 701 | return this.name == aPanel.name; |
|---|
| 702 | } |
|---|
| 703 | |
|---|
| 704 | |
|---|
| 705 | /** |
|---|
| 706 | * setSections() |
|---|
| 707 | * |
|---|
| 708 | * EBhEð´_Ƶ½plÌSÓÌX,YÀWðÝè·éÖ |
|---|
| 709 | * left:¶ÓX right:EÓX top:ãÓY under:ºÓY |
|---|
| 710 | */ |
|---|
| 711 | Panel.prototype.setSections = function() { |
|---|
| 712 | |
|---|
| 713 | // eC[ÌÊuæ¾ |
|---|
| 714 | this.setUpPanelSections(); |
|---|
| 715 | |
|---|
| 716 | //BoxÌæÌÝè |
|---|
| 717 | this.setBoxSection(); |
|---|
| 718 | |
|---|
| 719 | //BoxÚ®æÌæÌÝè |
|---|
| 720 | this.setMoveSection(); |
|---|
| 721 | } |
|---|
| 722 | |
|---|
| 723 | |
|---|
| 724 | /** |
|---|
| 725 | * setUpPanelSections() |
|---|
| 726 | * |
|---|
| 727 | * EBhEð´_Ƶ½plÌSÓÌX,YÀWðÝè·éÖ |
|---|
| 728 | * left:¶ÓX right:EÓX top:ãÓY under:ºÓY |
|---|
| 729 | */ |
|---|
| 730 | Panel.prototype.setUpPanelSections = function() |
|---|
| 731 | { |
|---|
| 732 | var psec = new Object; |
|---|
| 733 | var lyer = XBSLayer.makeLayer(this.name); |
|---|
| 734 | |
|---|
| 735 | psec['left'] = MAC_IE5_PITCH_X; |
|---|
| 736 | psec['top'] = MAC_IE5_PITCH_Y; |
|---|
| 737 | |
|---|
| 738 | psec['right'] = lyer.getWidth(); |
|---|
| 739 | psec['under'] = lyer.getHeight(); |
|---|
| 740 | while (lyer != null && lyer.isValid() && lyer.hasID()) { |
|---|
| 741 | |
|---|
| 742 | psec['left'] += lyer.getX(); |
|---|
| 743 | psec['top'] += lyer.getY(); |
|---|
| 744 | lyer = lyer.getParent(); |
|---|
| 745 | } |
|---|
| 746 | psec['right'] += psec['left']; |
|---|
| 747 | psec['under'] += psec['top']; |
|---|
| 748 | |
|---|
| 749 | this.panel_section = psec; |
|---|
| 750 | } |
|---|
| 751 | |
|---|
| 752 | /** |
|---|
| 753 | * setBoxSection() |
|---|
| 754 | * |
|---|
| 755 | * BoxÌûÜéÌæðÝè·éÖ |
|---|
| 756 | * box_section[ÀÑÔ] => (left => ¶ÓX, right => EÓX, top => ãÓY, under => ºÓY) |
|---|
| 757 | */ |
|---|
| 758 | Panel.prototype.setBoxSection = function() { |
|---|
| 759 | |
|---|
| 760 | //BoxÌæÌÝè |
|---|
| 761 | this.box_section_left_x = this.panel_section['left'] + BoxConfig.marginLeft; |
|---|
| 762 | this.box_section_right_x = this.box_section_left_x + BoxConfig.width |
|---|
| 763 | |
|---|
| 764 | this.box_section = new Array(this.box_limit_number); |
|---|
| 765 | |
|---|
| 766 | for(i = 0; i < this.box_limit_number; ++i) { |
|---|
| 767 | this.box_section[i] = new Array(4); |
|---|
| 768 | this.box_section[i]['left'] = this.box_section_left_x; |
|---|
| 769 | this.box_section[i]['right'] = this.box_section_right_x; |
|---|
| 770 | this.box_section[i]['top'] = Panel.getBoxSectionOffsetY(i) + this.panel_section['top']; |
|---|
| 771 | this.box_section[i]['under'] = this.box_section[i]['top'] + BoxConfig.height; |
|---|
| 772 | } |
|---|
| 773 | } |
|---|
| 774 | |
|---|
| 775 | /** |
|---|
| 776 | * plÌÅêÔºÌ Box ÌCfbNXðÔ· |
|---|
| 777 | * |
|---|
| 778 | * @return êÔºÌ Box ÌCfbNXB |
|---|
| 779 | */ |
|---|
| 780 | Panel.prototype.getMaxOrderIndex = function() |
|---|
| 781 | { |
|---|
| 782 | var max = -1; |
|---|
| 783 | for(key in this.box_position) { |
|---|
| 784 | max = (max < this.box_position[key]) ? this.box_position[key] : max; |
|---|
| 785 | } |
|---|
| 786 | return Number(max); |
|---|
| 787 | } |
|---|
| 788 | |
|---|
| 789 | /** |
|---|
| 790 | * wè³ê½ÊuÉÅàߢABox ð}üÂ\ÈÓÉ`FbNCð\¦·éB |
|---|
| 791 | * |
|---|
| 792 | * @param x x ÀW |
|---|
| 793 | * @param y y ÀW |
|---|
| 794 | */ |
|---|
| 795 | Panel.prototype.showCheckLineAtPosition = function(x, y) |
|---|
| 796 | { |
|---|
| 797 | if (typeof x != typeof 0 || typeof y != typeof 0) { |
|---|
| 798 | throw ASSERT_EXCEPTION + 'x or y arg'; |
|---|
| 799 | } |
|---|
| 800 | |
|---|
| 801 | var moveOrderId = this.orderIndexOfMovingAt(x, y); |
|---|
| 802 | var maxOrderIndex = this.getMaxOrderIndex(); |
|---|
| 803 | |
|---|
| 804 | if (null == moveOrderId) |
|---|
| 805 | return; |
|---|
| 806 | |
|---|
| 807 | if (maxOrderIndex < moveOrderId) { |
|---|
| 808 | moveOrderId = maxOrderIndex; |
|---|
| 809 | } |
|---|
| 810 | if (moveOrderId < this.box_limit_number) { |
|---|
| 811 | // `FbNCÚ® |
|---|
| 812 | var check_line_left = this.panel_section['left']; |
|---|
| 813 | var check_line_top = this.move_section[moveOrderId]['top']; |
|---|
| 814 | |
|---|
| 815 | // êU`FbNCðÁ· |
|---|
| 816 | getCheckLineLayer().setVisible(false); |
|---|
| 817 | getCheckLineLayer().setLeftTopPosition(check_line_left, check_line_top); |
|---|
| 818 | getCheckLineLayer().setVisible(true); |
|---|
| 819 | } |
|---|
| 820 | } |
|---|
| 821 | |
|---|
| 822 | |
|---|
| 823 | /** |
|---|
| 824 | * setMoveSection() |
|---|
| 825 | * |
|---|
| 826 | * BoxðڮūéÌæðÝè·éÖ |
|---|
| 827 | * move_section[ÀÑÔ] => (left => ¶ÓX, right => EÓX, top => ãÓY, under => ºÓY) |
|---|
| 828 | */ |
|---|
| 829 | Panel.prototype.setMoveSection = function() { |
|---|
| 830 | |
|---|
| 831 | //Ú®ÌæÌÝè |
|---|
| 832 | this.move_section_left_x = this.panel_section['left']; |
|---|
| 833 | this.move_section_right_x = this.move_section_left_x + BoxConfig.width + (BoxConfig.marginLeft * 2); |
|---|
| 834 | this.move_section = new Array(this.box_limit_number + 1); |
|---|
| 835 | |
|---|
| 836 | this.move_section[-1] = new Array(4); |
|---|
| 837 | this.move_section[-1]['left'] = this.move_section_left_x; |
|---|
| 838 | this.move_section[-1]['right'] = this.move_section_right_x; |
|---|
| 839 | this.move_section[-1]['top'] = this.panel_section['top'] - 7; |
|---|
| 840 | this.move_section[-1]['under'] = this.panel_section['top'] + (BoxConfig.marginTop / 2) + BoxConfig.height; |
|---|
| 841 | |
|---|
| 842 | for(i = 0; i < this.box_limit_number; ++i) { |
|---|
| 843 | this.move_section[i] = new Array(4); |
|---|
| 844 | this.move_section[i]['left'] = this.move_section_left_x; |
|---|
| 845 | this.move_section[i]['right'] = this.move_section_right_x; |
|---|
| 846 | this.move_section[i]['top'] = this.move_section[i - 1]['under']; |
|---|
| 847 | this.move_section[i]['under'] = this.move_section[i]['top'] + BoxConfig.height + BoxConfig.padding; |
|---|
| 848 | } |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | |
|---|
| 852 | |
|---|
| 853 | Panel.prototype.canDropAtPosition = function(aSourcePanel, aBox, x, y) |
|---|
| 854 | { |
|---|
| 855 | var orderIndex = this.orderIndexOfMovingAt(x, y); |
|---|
| 856 | var maxIndex = this.getMaxOrderIndex() + 1; |
|---|
| 857 | |
|---|
| 858 | // pl©çOê½A |
|---|
| 859 | // plÌÅå Box ð´¦é = false |
|---|
| 860 | return (orderIndex != null && (this.equals(aSourcePanel) || this.box_limit_number > maxIndex)); |
|---|
| 861 | } |
|---|
| 862 | |
|---|
| 863 | /** |
|---|
| 864 | * Ú®A}ü³êéÓÌCfbNXðÔ·B |
|---|
| 865 | * |
|---|
| 866 | * @param x x ÀW |
|---|
| 867 | * @param y y ÀW |
|---|
| 868 | * @return }ü³êéCfbNXAȯêÎ null |
|---|
| 869 | */ |
|---|
| 870 | Panel.prototype.orderIndexOfMovingAt = function(x, y) |
|---|
| 871 | { |
|---|
| 872 | return this.findOrderIndexOf_(this.move_section, x, y); |
|---|
| 873 | } |
|---|
| 874 | Panel.prototype.orderIndexOfBoxAt = function(x, y) |
|---|
| 875 | { |
|---|
| 876 | return this.findOrderIndexOf_(this.box_section, x, y); |
|---|
| 877 | } |
|---|
| 878 | // private |
|---|
| 879 | Panel.prototype.findOrderIndexOf_ = function(sectionDataArray, x, y) |
|---|
| 880 | { |
|---|
| 881 | for (var i = -1; i < sectionDataArray.length; i++) { |
|---|
| 882 | var sec = sectionDataArray[i]; |
|---|
| 883 | if (sec == null) |
|---|
| 884 | continue; |
|---|
| 885 | |
|---|
| 886 | if (x >= sec['left'] && x <= sec['right'] && |
|---|
| 887 | y >= sec['top'] && y <= sec['under']) { |
|---|
| 888 | |
|---|
| 889 | return i |
|---|
| 890 | } |
|---|
| 891 | } |
|---|
| 892 | return null; |
|---|
| 893 | } |
|---|
| 894 | |
|---|
| 895 | /** |
|---|
| 896 | * setBoxPosition() |
|---|
| 897 | * |
|---|
| 898 | * BoxðÄzu·éÖ |
|---|
| 899 | */ |
|---|
| 900 | Panel.prototype.setBoxPosition = function() { |
|---|
| 901 | for (key in this.box_position) { |
|---|
| 902 | gAllBoxes[key].setPosition( |
|---|
| 903 | this.panel_section['left'] + BoxConfig.marginLeft, |
|---|
| 904 | this.panel_section['top'] + Panel.getBoxSectionOffsetY(this.box_position[key]) ); |
|---|
| 905 | } |
|---|
| 906 | } |
|---|
| 907 | |
|---|
| 908 | Panel.prototype.setBoxVisible = function(flag) |
|---|
| 909 | { |
|---|
| 910 | for (key in this.box_position) { |
|---|
| 911 | gAllBoxes[key].setVisible(flag); |
|---|
| 912 | } |
|---|
| 913 | } |
|---|
| 914 | |
|---|
| 915 | |
|---|
| 916 | |
|---|
| 917 | //--------------------------------------------------------------------------------- |
|---|
| 918 | // Box |
|---|
| 919 | //--------------------------------------------------------------------------------- |
|---|
| 920 | /** |
|---|
| 921 | * ÂXÌhbOÅÚ®Â\ÈÚ |
|---|
| 922 | * |
|---|
| 923 | * @param anId HTML vfÌ id ®« |
|---|
| 924 | * |
|---|
| 925 | * @author Yusuke Saito |
|---|
| 926 | * @version 2003/10/10 |
|---|
| 927 | * |
|---|
| 928 | * @author Takanori Ishikawa |
|---|
| 929 | * @version 2004/04/21 |
|---|
| 930 | */ |
|---|
| 931 | function Box(anId) |
|---|
| 932 | { |
|---|
| 933 | this.uniqID = anId; |
|---|
| 934 | this.srcElement = XBSLayer.getLayerImpById(BOX_ID_PREFIX + anId); |
|---|
| 935 | |
|---|
| 936 | this.setUpSize(); |
|---|
| 937 | this.x = this.y = 0; |
|---|
| 938 | } |
|---|
| 939 | |
|---|
| 940 | Box.prototype.getFormID = function() { return this.uniqID; } |
|---|
| 941 | Box.prototype.getHTMLElement = function() { return this.srcElement; } |
|---|
| 942 | |
|---|
| 943 | /** |
|---|
| 944 | * HTML Ì hidden input vfÅn³êévpeB̼O |
|---|
| 945 | */ |
|---|
| 946 | Box.POSITION_PROPERTY_NAME = "position"; |
|---|
| 947 | Box.ORDER_PROPERTY_NAME = "order"; |
|---|
| 948 | Box.NAME_PROPERTY_NAME = "sidefuncName"; |
|---|
| 949 | Box.AUTHOR_PROPERTY_NAME = "authorCd"; |
|---|
| 950 | Box.ID_PROPERTY_NAME = "sidefuncId"; |
|---|
| 951 | |
|---|
| 952 | |
|---|
| 953 | /** |
|---|
| 954 | * hbOÌÅÉÄÎêéB |
|---|
| 955 | * |
|---|
| 956 | * @param theEvent mousemove |
|---|
| 957 | * @return hbOðLZ·éêÍAfalse ðÔ·B |
|---|
| 958 | */ |
|---|
| 959 | Box.MOVABLE_INSET = 5; /* hL
gÌ[ - Box.MOVABLE_INSET = hbOÂ\ÈÌæ */ |
|---|
| 960 | Box.canMoveWithEvent = function(theEvent) |
|---|
| 961 | { |
|---|
| 962 | // ÎIÈÊuªÙµ¢ÌÅAXBSDocument.getPageOffsetX/Y() ðø |
|---|
| 963 | var mouse_x = XBSEvent.getMouseX(theEvent) - XBSDocument.getPageOffsetX(); |
|---|
| 964 | var mouse_y = XBSEvent.getMouseY(theEvent) - XBSDocument.getPageOffsetY(); |
|---|
| 965 | |
|---|
| 966 | if (mouse_x < Box.MOVABLE_INSET || mouse_y < Box.MOVABLE_INSET) { |
|---|
| 967 | return false; |
|---|
| 968 | } |
|---|
| 969 | |
|---|
| 970 | var maxX = XBSDocument.getWidth() - Box.MOVABLE_INSET; |
|---|
| 971 | var maxY = XBSDocument.getHeight() - Box.MOVABLE_INSET; |
|---|
| 972 | |
|---|
| 973 | if (mouse_x > maxX || mouse_y > maxY) { |
|---|
| 974 | return false; |
|---|
| 975 | } |
|---|
| 976 | |
|---|
| 977 | return true; |
|---|
| 978 | } |
|---|
| 979 | |
|---|
| 980 | /** |
|---|
| 981 | * setUpSize() |
|---|
| 982 | * |
|---|
| 983 | * BoxÌ嫳ðÝè·éÖ |
|---|
| 984 | */ |
|---|
| 985 | Box.prototype.setUpSize = function() |
|---|
| 986 | { |
|---|
| 987 | var imp = this.getHTMLElement(); |
|---|
| 988 | |
|---|
| 989 | // style.height Å颮 opera Ťܢ©È¢ |
|---|
| 990 | if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) { |
|---|
| 991 | imp.style.height = BoxConfig.height; |
|---|
| 992 | imp.style.width = BoxConfig.width; |
|---|
| 993 | } else { |
|---|
| 994 | XBSLayer.setHeightWithLayerImp(imp, BoxConfig.height); |
|---|
| 995 | XBSLayer.setWidthWithLayerImp(imp, BoxConfig.width); |
|---|
| 996 | } |
|---|
| 997 | XBSLayer.setCursorWithLayerImp(imp, 'move'); |
|---|
| 998 | } |
|---|
| 999 | |
|---|
| 1000 | /** |
|---|
| 1001 | * BoxÌÊuðÝè |
|---|
| 1002 | * |
|---|
| 1003 | * @param left x |
|---|
| 1004 | * @param top y |
|---|
| 1005 | */ |
|---|
| 1006 | Box.prototype.setPosition = function(left, top) |
|---|
| 1007 | { |
|---|
| 1008 | var imp = this.getHTMLElement(); |
|---|
| 1009 | XBSLayer.initPositionStyle(imp); |
|---|
| 1010 | XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top); |
|---|
| 1011 | this.x = left; this.y = top; |
|---|
| 1012 | } |
|---|
| 1013 | /** |
|---|
| 1014 | * Box Ì®«ðÝè |
|---|
| 1015 | */ |
|---|
| 1016 | Box.prototype.setVisible = function(flag) |
|---|
| 1017 | { |
|---|
| 1018 | var imp = this.getHTMLElement(); |
|---|
| 1019 | XBSLayer.setVisibilityWithLayerImp(imp, flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN); |
|---|
| 1020 | } |
|---|