From: <ja...@us...> - 2006-07-22 04:07:28
|
Revision: 14029 Author: jablko Date: 2006-07-21 21:04:26 -0700 (Fri, 21 Jul 2006) ViewCVS: http://svn.sourceforge.net/gallery/?rev=14029&view=rev Log Message: ----------- Merge -r14016:14028 from trunk Modified Paths: -------------- branches/DEV_2_2_ajax/MANIFEST branches/DEV_2_2_ajax/lib/javascript/BlockToggle.js branches/DEV_2_2_ajax/modules/core/MANIFEST branches/DEV_2_2_ajax/modules/core/classes/GalleryCoreApi.class branches/DEV_2_2_ajax/modules/core/classes/GalleryDataCache.class branches/DEV_2_2_ajax/modules/core/classes/GalleryEmbed.class branches/DEV_2_2_ajax/modules/core/classes/GalleryRepository.class branches/DEV_2_2_ajax/modules/core/classes/GalleryRepositoryUtilities.class branches/DEV_2_2_ajax/modules/core/classes/GallerySession.class branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage/GalleryStorageExtras.class branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage.class branches/DEV_2_2_ajax/modules/core/classes/GalleryTemplateAdapter.class branches/DEV_2_2_ajax/modules/core/classes/GalleryTheme.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryEntityHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryFactoryHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_medium.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_advanced.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryPermissionHelper_advanced.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryPermissionHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryToolkitHelper_medium.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryToolkitHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryUserGroupHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryUserHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/MaintenanceHelper_simple.class branches/DEV_2_2_ajax/modules/core/classes/helpers/UserRecoverPasswordHelper_simple.class branches/DEV_2_2_ajax/modules/core/templates/blocks/Pager.tpl branches/DEV_2_2_ajax/modules/core/test/phpunit/RepositoryTest.class branches/DEV_2_2_ajax/modules/core/test/phpunit/RepositoryTestStorage.class branches/DEV_2_2_ajax/modules/core/test/phpunit/SimpleCallbackTest.class branches/DEV_2_2_ajax/modules/core/test/phpunit/StorageTest.class branches/DEV_2_2_ajax/modules/core/test/phpunit/TemplateAdapterTest.class branches/DEV_2_2_ajax/modules/core/test/phpunit/UtilitiesTest.class branches/DEV_2_2_ajax/modules/customfield/MANIFEST branches/DEV_2_2_ajax/modules/customfield/classes/CustomFieldHelper.class branches/DEV_2_2_ajax/modules/customfield/module.inc branches/DEV_2_2_ajax/modules/exif/MANIFEST branches/DEV_2_2_ajax/modules/exif/classes/ExifHelper.class branches/DEV_2_2_ajax/modules/exif/module.inc branches/DEV_2_2_ajax/modules/getid3/MANIFEST branches/DEV_2_2_ajax/modules/getid3/classes/Getid3Helper.class branches/DEV_2_2_ajax/modules/getid3/module.inc branches/DEV_2_2_ajax/modules/imageblock/MANIFEST branches/DEV_2_2_ajax/modules/imageblock/classes/ImageBlockHelper.class branches/DEV_2_2_ajax/modules/imageblock/module.inc branches/DEV_2_2_ajax/modules/mime/MANIFEST branches/DEV_2_2_ajax/modules/mime/classes/MimeHelper.class branches/DEV_2_2_ajax/modules/mime/module.inc branches/DEV_2_2_ajax/modules/multilang/MANIFEST branches/DEV_2_2_ajax/modules/multilang/classes/MultiLangHelper.class branches/DEV_2_2_ajax/modules/multilang/module.inc branches/DEV_2_2_ajax/modules/permalinks/MANIFEST branches/DEV_2_2_ajax/modules/permalinks/classes/PermalinksMapHelper.class branches/DEV_2_2_ajax/modules/permalinks/module.inc branches/DEV_2_2_ajax/modules/rating/MANIFEST branches/DEV_2_2_ajax/modules/rating/classes/RatingHelper.class branches/DEV_2_2_ajax/modules/rating/module.inc branches/DEV_2_2_ajax/modules/rewrite/MANIFEST branches/DEV_2_2_ajax/modules/rewrite/classes/RewriteHelper.class branches/DEV_2_2_ajax/modules/rewrite/classes/RewriteUrlGenerator.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/AdminRewriteControllerTest.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/IsapiRewriteParserTest.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/IsapiRewriteUrlGeneratorTest.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/RewriteHelperTest.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/RewriteParserTestCase.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/RewriteUrlGeneratorTest.class branches/DEV_2_2_ajax/modules/rewrite/test/phpunit/RewriteUrlGeneratorTestCase.class branches/DEV_2_2_ajax/modules/rss/MANIFEST branches/DEV_2_2_ajax/modules/rss/classes/RssMapHelper.class branches/DEV_2_2_ajax/modules/rss/module.inc branches/DEV_2_2_ajax/themes/classic/MANIFEST branches/DEV_2_2_ajax/themes/classic/theme.inc branches/DEV_2_2_ajax/themes/hybrid/MANIFEST branches/DEV_2_2_ajax/themes/hybrid/theme.inc Modified: branches/DEV_2_2_ajax/MANIFEST =================================================================== --- branches/DEV_2_2_ajax/MANIFEST 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/MANIFEST 2006-07-22 04:04:26 UTC (rev 14029) @@ -31,7 +31,7 @@ install/images/btnTRbl.gif 3306389985 3306389985 169 169 install/images/btnTRgrn.gif 1466176462 1466176462 169 169 install/images/btnTRor.gif 3506895090 3506895090 170 170 -install/images/g2Logo_install_head.png 2360733490 2360733490 13674 13674 +install/images/g2Logo_install_head.png 3872611492 3872611492 13832 13832 install/images/ico_error.gif 3087634832 3087634832 1608 1608 install/images/ico_success.gif 1603034537 1603034537 1629 1629 install/images/ico_warning.gif 3081259453 3081259453 1589 1589 @@ -154,7 +154,7 @@ lib/bbcode/bbcode.class 3568792804 380747630 18202 18787 lib/javascript/AutoComplete.js 1405337216 2511757452 3030 3101 lib/javascript/BlockSelectWidget.js 3901767422 1981293677 19533 20147 -lib/javascript/BlockToggle.js 1801426907 2402495765 1345 1378 +lib/javascript/BlockToggle.js 1042267268 4015637326 1359 1392 lib/javascript/Cropper.js 1858421450 1028646815 10757 11091 lib/pear/HTMLSax3.php 197931904 3433986085 42830 44168 lib/pear/Safe.php 947362477 4162690614 18278 18952 @@ -365,7 +365,7 @@ upgrade/images/btnTRbl.gif 3306389985 3306389985 169 169 upgrade/images/btnTRgrn.gif 1466176462 1466176462 169 169 upgrade/images/btnTRor.gif 3506895090 3506895090 170 170 -upgrade/images/g2Logo_upgrade_head.png 2325312367 2325312367 16522 16522 +upgrade/images/g2Logo_upgrade_head.png 405041770 405041770 16688 16688 upgrade/images/ico_error.gif 3087634832 3087634832 1608 1608 upgrade/images/ico_success.gif 1603034537 1603034537 1629 1629 upgrade/images/ico_warning.gif 3081259453 3081259453 1589 1589 Modified: branches/DEV_2_2_ajax/lib/javascript/BlockToggle.js =================================================================== --- branches/DEV_2_2_ajax/lib/javascript/BlockToggle.js 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/lib/javascript/BlockToggle.js 2006-07-22 04:04:26 UTC (rev 14029) @@ -25,9 +25,9 @@ if (agent.indexOf('msie') >= 0 && agent.indexOf('opera') < 0) display = 'block'; } o.style.display = display; - t.innerHTML = '-'; + if (t) t.innerHTML = '-'; } else { o.style.display = 'none'; - t.innerHTML = '+'; + if (t) t.innerHTML = '+'; } } Modified: branches/DEV_2_2_ajax/modules/core/MANIFEST =================================================================== --- branches/DEV_2_2_ajax/modules/core/MANIFEST 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/MANIFEST 2006-07-22 04:04:26 UTC (rev 14029) @@ -50,7 +50,7 @@ modules/core/MaintenanceMode.inc 3499849854 887776201 1856 1916 modules/core/PluginCallback.inc 2944007067 2566051001 10009 10400 modules/core/ProgressBar.inc 1394847808 2791821934 1368 1411 -modules/core/ShowItem.inc 2182889771 2737972449 4017 4157 +modules/core/ShowItem.inc 354759131 4028182594 4112 4255 modules/core/ShowItemError.inc 35772627 1999834892 2869 2976 modules/core/SimpleCallback.inc 1852647424 1360097004 5001 5181 modules/core/SiteAdmin.inc 3188416673 2522492932 8829 9124 @@ -79,13 +79,13 @@ modules/core/classes/GalleryChildEntity.class 2633248359 346111558 4147 4327 modules/core/classes/GalleryConstants.class 2506213887 509038178 7834 8213 modules/core/classes/GalleryController.class 847098076 3324277295 7661 7865 -modules/core/classes/GalleryCoreApi.class 1844149804 1038315803 116110 119249 +modules/core/classes/GalleryCoreApi.class 2975115426 204790238 117103 120269 modules/core/classes/GalleryCoreSearch.class 2053651870 1538575475 6612 6819 -modules/core/classes/GalleryDataCache.class 332723237 240704344 22658 23480 +modules/core/classes/GalleryDataCache.class 117049847 329902724 22524 23337 modules/core/classes/GalleryDataItem.class 503873762 2851830176 12085 12559 modules/core/classes/GalleryDerivative.class 1126846095 1704617569 22478 23272 modules/core/classes/GalleryDerivativeImage.class 3138482894 1565770746 7122 7392 -modules/core/classes/GalleryEmbed.class 4176530000 3043007022 29407 30353 +modules/core/classes/GalleryEmbed.class 2610793364 596422824 29241 30176 modules/core/classes/GalleryEntity.class 1398621485 2177190085 19047 19731 modules/core/classes/GalleryEvent.class 3358483527 368989024 2910 3045 modules/core/classes/GalleryEventListener.class 75828399 601387451 1439 1484 @@ -103,19 +103,19 @@ modules/core/classes/GalleryPlatform/WinNtPlatform.class 490207023 2415770648 5581 5795 modules/core/classes/GalleryPlugin.class 2121539171 1324550880 17301 17884 modules/core/classes/GalleryRenderer.class 3001433785 1639652285 2357 2422 -modules/core/classes/GalleryRepository.class 1804348328 1288039101 23172 23884 +modules/core/classes/GalleryRepository.class 477462082 2390894911 22930 23628 modules/core/classes/GalleryRepositoryIndex.class 43415497 2317930658 15268 15759 -modules/core/classes/GalleryRepositoryUtilities.class 1191449369 705099429 14417 14846 -modules/core/classes/GallerySession.class 428170471 3895860187 47062 48560 +modules/core/classes/GalleryRepositoryUtilities.class 2736757734 1392904879 14186 14601 +modules/core/classes/GallerySession.class 81398144 3617494210 46824 48319 modules/core/classes/GallerySmarty.class 1105568729 2729167843 3204 3317 modules/core/classes/GallerySortInterface_1_1.class 3994095942 3192561663 4623 4752 modules/core/classes/GalleryStatus.class 112403458 2372517400 7053 7315 -modules/core/classes/GalleryStorage.class 1871539526 3453654603 38043 39410 +modules/core/classes/GalleryStorage.class 1239889586 1357312246 39181 40578 modules/core/classes/GalleryStorage/Db2CreateUdfs.sql 4053757771 1342803176 10487 10729 modules/core/classes/GalleryStorage/Db2Storage.class 2178172541 2056196459 8481 8784 modules/core/classes/GalleryStorage/GNUmakefile 1465776782 2009162633 61 62 modules/core/classes/GalleryStorage/GallerySqlFragment.class 1894754956 1463146868 2134 2214 -modules/core/classes/GalleryStorage/GalleryStorageExtras.class 1089698907 2891457533 58001 59978 +modules/core/classes/GalleryStorage/GalleryStorageExtras.class 3619397592 1744044834 60713 62776 modules/core/classes/GalleryStorage/MSSqlStorage.class 2705220802 2933581293 4453 4623 modules/core/classes/GalleryStorage/MySqlStorage.class 2937087289 318305992 6088 6324 modules/core/classes/GalleryStorage/OracleCreateBitOr.sql 2845920750 4263422247 1649 1695 @@ -148,16 +148,16 @@ modules/core/classes/GalleryStorage/xml-src/T_InstallerTest_3.xml 508896771 814400991 473 492 modules/core/classes/GalleryStorage/xml-src/T_InstallerTest_4.xml 3727832861 3705143938 276 287 modules/core/classes/GalleryTemplate.class 3317478949 2719720149 12656 13088 -modules/core/classes/GalleryTemplateAdapter.class 1213573474 579104055 30758 31730 -modules/core/classes/GalleryTheme.class 1023096491 223322014 60430 62344 +modules/core/classes/GalleryTemplateAdapter.class 878920719 164822538 30738 31708 +modules/core/classes/GalleryTheme.class 979899464 3883193128 61283 63228 modules/core/classes/GalleryToolkit.class 1586474384 1188858298 9452 9724 modules/core/classes/GalleryTranslator.class 3673152446 3196480510 17643 18206 modules/core/classes/GalleryUnknownItem.class 2040330740 596799030 3759 3875 modules/core/classes/GalleryUrlGenerator.class 4288238471 652864369 34922 35898 modules/core/classes/GalleryUser.class 1178003503 3909000791 9987 10374 -modules/core/classes/GalleryUtilities.class 580847041 2753720358 51373 53051 +modules/core/classes/GalleryUtilities.class 2737039161 3071932766 51214 52875 modules/core/classes/GalleryValidationPlugin.class 1183184987 2179866846 2605 2673 -modules/core/classes/GalleryView.class 3702327509 56019594 13170 13609 +modules/core/classes/GalleryView.class 2816914778 3796713128 13108 13546 modules/core/classes/Maps.inc 2987869947 117194758 8767 8792 modules/core/classes/Maps.xml 3925633210 512631202 18453 19143 modules/core/classes/OptimizeDatabaseTask.class 1630551619 2857254448 2294 2371 @@ -172,35 +172,35 @@ modules/core/classes/helpers/GalleryDerivativeHelper_medium.class 3986638639 3398478753 2947 3044 modules/core/classes/helpers/GalleryDerivativeHelper_simple.class 3762547509 248558874 6351 6557 modules/core/classes/helpers/GalleryEntityHelper_medium.class 4157729006 224991327 10017 10378 -modules/core/classes/helpers/GalleryEntityHelper_simple.class 1026732129 419288149 4344 4495 +modules/core/classes/helpers/GalleryEntityHelper_simple.class 1016515205 1397221721 4271 4421 modules/core/classes/helpers/GalleryEventHelper_simple.class 2075833207 1913397442 4138 4280 modules/core/classes/helpers/GalleryFactoryHelper_medium.class 3126341825 17742179 5203 5374 -modules/core/classes/helpers/GalleryFactoryHelper_simple.class 1764778335 2405433288 7325 7575 +modules/core/classes/helpers/GalleryFactoryHelper_simple.class 2972020080 1201004375 7023 7262 modules/core/classes/helpers/GalleryFileSystemEntityHelper_medium.class 3763074480 2589174623 4534 4685 modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class 575541327 1879248956 3649 3780 modules/core/classes/helpers/GalleryGroupHelper_simple.class 2282340914 699459125 4398 4570 modules/core/classes/helpers/GalleryItemAttributesHelper_advanced.class 1515209367 2968540633 8502 8812 -modules/core/classes/helpers/GalleryItemAttributesHelper_medium.class 2615050259 958364890 2650 2738 -modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class 138228281 1361308797 6067 6271 -modules/core/classes/helpers/GalleryItemHelper_advanced.class 3166879137 244107460 22775 23620 +modules/core/classes/helpers/GalleryItemAttributesHelper_medium.class 4041017504 3527482953 2438 2518 +modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class 902947179 2904278640 5713 5901 +modules/core/classes/helpers/GalleryItemHelper_advanced.class 4131765269 896923273 22228 23037 modules/core/classes/helpers/GalleryItemHelper_medium.class 1460148186 2949437757 31633 32691 -modules/core/classes/helpers/GalleryItemHelper_simple.class 561496997 2368194810 10898 11284 +modules/core/classes/helpers/GalleryItemHelper_simple.class 915234113 1330493983 10543 10916 modules/core/classes/helpers/GalleryLockHelper_simple.class 2113550104 2650813270 6648 6916 modules/core/classes/helpers/GalleryMimeTypeHelper_advanced.class 801832725 188590978 9509 9803 modules/core/classes/helpers/GalleryMimeTypeHelper_simple.class 2876156186 16286218 6097 6291 -modules/core/classes/helpers/GalleryPermissionHelper_advanced.class 2025867412 536084474 38416 39719 -modules/core/classes/helpers/GalleryPermissionHelper_simple.class 1550275230 4021942393 14938 15425 +modules/core/classes/helpers/GalleryPermissionHelper_advanced.class 2631181420 2058665645 37932 39198 +modules/core/classes/helpers/GalleryPermissionHelper_simple.class 196775585 1007467532 14737 15213 modules/core/classes/helpers/GalleryPluginHelper_medium.class 1471499686 734302645 13804 14282 modules/core/classes/helpers/GalleryPluginHelper_simple.class 1241617201 3505444898 20515 21152 -modules/core/classes/helpers/GalleryToolkitHelper_medium.class 3050555784 167638945 23389 24151 -modules/core/classes/helpers/GalleryToolkitHelper_simple.class 1403590736 2890102580 7702 7957 +modules/core/classes/helpers/GalleryToolkitHelper_medium.class 730593844 1469477224 22833 23563 +modules/core/classes/helpers/GalleryToolkitHelper_simple.class 319188862 222171507 7586 7833 modules/core/classes/helpers/GalleryUserGroupHelper_medium.class 3956470414 2335745896 6621 6861 -modules/core/classes/helpers/GalleryUserGroupHelper_simple.class 349452637 4132145413 4400 4558 +modules/core/classes/helpers/GalleryUserGroupHelper_simple.class 744151792 1115446474 4260 4404 modules/core/classes/helpers/GalleryUserHelper_medium.class 4251804065 739594077 9459 9812 -modules/core/classes/helpers/GalleryUserHelper_simple.class 498621911 40775087 3673 3797 +modules/core/classes/helpers/GalleryUserHelper_simple.class 1410746149 3263934039 3476 3587 modules/core/classes/helpers/MailHelper_simple.class 2886116714 3429181858 3539 3651 -modules/core/classes/helpers/MaintenanceHelper_simple.class 19194660 2515431532 3914 4053 -modules/core/classes/helpers/UserRecoverPasswordHelper_simple.class 3547787317 4031398483 3005 3116 +modules/core/classes/helpers/MaintenanceHelper_simple.class 1647492101 2460834508 3659 3783 +modules/core/classes/helpers/UserRecoverPasswordHelper_simple.class 555601139 2172020614 2674 2762 modules/core/classes/helpers/WebHelper_simple.class 810732910 887291306 13563 14013 modules/core/data/broken-image.gif 888290220 888290220 1589 1589 modules/core/data/donate.png 3710449820 3710449820 299 299 @@ -247,7 +247,7 @@ modules/core/locale/vi/LC_MESSAGES/modules_core.mo 616949295 616949295 94126 94126 modules/core/locale/zh_CN/LC_MESSAGES/modules_core.mo 228543503 228543503 95811 95811 modules/core/locale/zh_TW/LC_MESSAGES/modules_core.mo 1518742016 1518742016 93535 93535 -modules/core/module.inc 1235556553 716043488 16754 17282 +modules/core/module.inc 377952398 2643934519 16741 17268 modules/core/po/GNUmakefile 1866879166 2808215985 98 103 modules/core/po/af.po 861882226 3223685674 95620 99136 modules/core/po/ar.po 1587688565 4256783868 101820 105226 @@ -360,7 +360,7 @@ modules/core/templates/blocks/LoginBlock.tpl 3219402172 2716668688 1567 1601 modules/core/templates/blocks/NavigationLinks.tpl 996853069 3517311236 552 572 modules/core/templates/blocks/Navigator.tpl 2795187975 3500827250 3044 3129 -modules/core/templates/blocks/Pager.tpl 162081749 2186293478 918 948 +modules/core/templates/blocks/Pager.tpl 1366252265 2737282296 848 878 modules/core/templates/blocks/PeerList.tpl 2728069922 3886235338 1269 1302 modules/core/templates/blocks/PhotoSizes.tpl 2066736466 2113440878 1812 1863 modules/core/templates/blocks/SystemLink.tpl 2781535503 577407101 464 476 @@ -462,17 +462,17 @@ modules/core/test/phpunit/PluginParameterTest.class 3574144315 2122622553 8838 9136 modules/core/test/phpunit/PluginTest.class 3399522754 658349164 6016 6194 modules/core/test/phpunit/RepositoryIndexTest.class 2261835991 4090855962 14876 15350 -modules/core/test/phpunit/RepositoryTest.class 2872195796 1732853035 30827 31619 -modules/core/test/phpunit/RepositoryTestStorage.class 2995305253 1815684260 3246 3366 +modules/core/test/phpunit/RepositoryTest.class 2803168508 1735773059 30665 31446 +modules/core/test/phpunit/RepositoryTestStorage.class 974986442 3419230820 3520 3648 modules/core/test/phpunit/RepositoryUtilitiesTest.class 2808075785 1068068767 14871 15271 modules/core/test/phpunit/SessionAuthPluginTest.class 288805422 81531165 2780 2882 modules/core/test/phpunit/SessionTest.class 1008796172 3886646488 103005 105934 modules/core/test/phpunit/ShowItemControllerTest.class 1453378142 2833450669 2960 3062 modules/core/test/phpunit/ShowItemTest.class 779025554 3670205915 8383 8643 -modules/core/test/phpunit/SimpleCallbackTest.class 1581650442 3998906633 12850 13224 +modules/core/test/phpunit/SimpleCallbackTest.class 583957366 2499759797 14170 14595 modules/core/test/phpunit/StatusTest.class 1266192108 3229408464 1760 1813 -modules/core/test/phpunit/StorageTest.class 1279118566 3345261911 21653 22313 -modules/core/test/phpunit/TemplateAdapterTest.class 2141382676 108083059 7216 7435 +modules/core/test/phpunit/StorageTest.class 297578337 1944619191 25676 26483 +modules/core/test/phpunit/TemplateAdapterTest.class 3687336009 2160148136 7551 7779 modules/core/test/phpunit/TemplateAuditTest.class 3787628058 3701713222 4288 4419 modules/core/test/phpunit/TemplateTest.class 4112245927 1500866136 4906 5038 modules/core/test/phpunit/ThemeTest.class 1452892367 1421891607 10988 11369 @@ -487,7 +487,7 @@ modules/core/test/phpunit/UserRecoverPasswordAdminControllerTest.class 2285784153 3114110040 11583 11927 modules/core/test/phpunit/UserRecoverPasswordConfirmControllerTest.class 2285729219 758621060 7140 7367 modules/core/test/phpunit/UserRecoverPasswordControllerTest.class 1259724376 945298252 18135 18715 -modules/core/test/phpunit/UtilitiesTest.class 3925455675 995897349 60913 62509 +modules/core/test/phpunit/UtilitiesTest.class 4222328996 1022537609 60889 62488 modules/core/test/phpunit/ViewTest.class 3827418822 2165131867 4246 4389 modules/core/test/phpunit/WebTest.class 2459841269 3367040148 25483 26185 R modules/core/AdminLayouts.inc Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryCoreApi.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryCoreApi.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryCoreApi.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -61,7 +61,7 @@ * - remove 'link' entry in Gallery.class constructor */ function getApiVersion() { - return array(7, 9); + return array(7, 10); } /** @@ -2928,6 +2928,33 @@ } /** + * Get entries in a map that match a criteria and return selected fields + * + * @param string the map we're working on + * @param array the columns to return + * @param array the entries to match + * @param array optional arguments (eg, limit, orderBy) + * array('limit' => array('count' => #, 'offset' => #), + * 'orderBy' => array(columnName => ORDER_ASCENDING|ORDER_DESCENDING, ...)) + * @return object GalleryStatus a status code + */ + function getMapEntry($mapName, $select, $match=array(), $optional=array()) { + global $gallery; + + if (empty($mapName) || empty($select) || !is_array($match) || !is_array($optional)) { + return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER), null); + } + + $storage =& $gallery->getStorage(); + list ($ret, $searchResults) = $storage->getMapEntry($mapName, $select, $match, $optional); + if ($ret) { + return array($ret, null); + } + + return array(null, $searchResults); + } + + /** * Remove entries from a map * * @param string the map we're working on Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryDataCache.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryDataCache.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryDataCache.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -646,22 +646,13 @@ $key = md5(serialize($keyData) . '|' . $extraKey . '|' . implode(",", $aclIds)); $userId = $gallery->getActiveUserId(); - $storage =& $gallery->getStorage(); - $query = ' - SELECT - [GalleryCacheMap::value] - FROM - [GalleryCacheMap] - WHERE - [GalleryCacheMap::key] = ? - AND - [GalleryCacheMap::type] = ? - AND - [GalleryCacheMap::userId] = ? - AND - [GalleryCacheMap::timestamp] > ? - '; - list ($ret, $results) = $storage->search($query, array($key, $type, $userId, $cutoff)); + GalleryCoreApi::requireOnce( + 'modules/core/classes/GalleryStorage/GallerySqlFragment.class'); + + list ($ret, $results) = GalleryCoreApi::getMapEntry('GalleryCacheMap', + array('value'), + array('key' => $key, 'type' => $type, 'userId' => $userId, + 'timestamp' => new GallerySqlFragment('>?', $cutoff))); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryEmbed.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryEmbed.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryEmbed.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -884,17 +884,12 @@ * @static */ function getExternalIdMap($key) { - global $gallery; /* Input validation */ if ($key != 'externalId' && $key != 'entityId') { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER), null); } - - $query = ' - SELECT [ExternalIdMap::entityId], [ExternalIdMap::externalId], [ExternalIdMap::entityType] - FROM [ExternalIdMap] - '; - list ($ret, $results) = $gallery->search($query); + list ($ret, $results) = GalleryCoreApi::getMapEntry('ExternalIdMap', + array('entityId', 'externalId', 'entityType')); if ($ret) { return array($ret, null); } @@ -925,13 +920,8 @@ * @static */ function isExternalIdMapped($externalId, $entityType) { - global $gallery; - - $query = ' - SELECT [ExternalIdMap::entityId] FROM [ExternalIdMap] - WHERE [ExternalIdMap::externalId] = ? AND [ExternalIdMap::entityType] = ? - '; - list ($ret, $results) = $gallery->search($query, array($externalId, $entityType)); + list ($ret, $results) = GalleryCoreApi::getMapEntry('ExternalIdMap', + array('entityId'), array('externalId' => $externalId, 'entityType' => $entityType)); if ($ret) { return $ret; } @@ -939,7 +929,6 @@ return GalleryCoreApi::error(ERROR_MISSING_OBJECT, __FILE__, __LINE__, "$externalId $entityType"); } - return null; } } Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryRepository.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryRepository.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryRepository.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -377,25 +377,11 @@ */ function updatePackageMetaData($pluginType, $pluginId, $packageName, $packageVersion, $packageBuild) { - global $gallery; - /* Check if specified package exists in the database. */ - $query = ' - SELECT - [GalleryPluginPackageMap::packageVersion], - [GalleryPluginPackageMap::packageBuild] - FROM - [GalleryPluginPackageMap] - WHERE - [GalleryPluginPackageMap::pluginType] = ? - AND - [GalleryPluginPackageMap::pluginId] = ? - AND - [GalleryPluginPackageMap::packageName] = ? - '; - - list ($ret, $searchResults) = - $gallery->search($query, array($pluginType, $pluginId, $packageName)); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryPluginPackageMap', + array('packageVersion', 'packageBuild'), + array('pluginType' => $pluginType, 'pluginId' => $pluginId, + 'packageName' => $packageName)); if ($ret) { return $ret; } Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryRepositoryUtilities.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryRepositoryUtilities.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryRepositoryUtilities.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -323,28 +323,14 @@ * array[$packageName] => array('version' => $version, 'build' => $build) */ function getPluginPackages($pluginType, $pluginId) { - global $gallery; - if (empty($pluginType) || empty($pluginId)) { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__, "Missing plugin type [$pluginType] and/or ID [$pluginId]"), null); } - - $query = ' - SELECT - [GalleryPluginPackageMap::packageName], - [GalleryPluginPackageMap::packageVersion], - [GalleryPluginPackageMap::packageBuild] - FROM - [GalleryPluginPackageMap] - WHERE - [GalleryPluginPackageMap::pluginType] = ? - AND - [GalleryPluginPackageMap::pluginId] = ? - '; - - list ($ret, $searchResults) = $gallery->search($query, array($pluginType, $pluginId)); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryPluginPackageMap', + array('packageName', 'packageVersion', 'packageBuild'), + array('pluginType' => $pluginType, 'pluginId' => $pluginId)); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/GallerySession.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GallerySession.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GallerySession.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -898,13 +898,10 @@ $lifetimeCutoff = $phpVm->time() - $lifetime; $inactiveCutoff = $phpVm->time() - $inactivityTimeout; - $query = ' - SELECT [GallerySessionMap::id], [GallerySessionMap::userId], - [GallerySessionMap::remoteIdentifier],[GallerySessionMap::creationTimestamp], - [GallerySessionMap::modificationTimestamp], [GallerySessionMap::data] - FROM [GallerySessionMap] - WHERE [GallerySessionMap::id] = ?'; - list ($ret, $results) = $gallery->search($query, array($this->_sessionId)); + list ($ret, $results) = GalleryCoreApi::getMapEntry('GallerySessionMap', + array('userId', 'remoteIdentifier', 'creationTimestamp', + 'modificationTimestamp', 'data'), + array('id' => $this->_sessionId)); if ($ret) { /* When upgrading from versions before 1.0.22, there's no DB table yet */ list ($ret2, $module) = GalleryCoreApi::loadPlugin('module', 'core'); @@ -922,13 +919,13 @@ if ($results->resultCount()) { $pSession = $results->nextResult(); - if ($pSession[4] > $inactiveCutoff && $pSession[3] > $lifetimeCutoff) { + if ($pSession[3] > $inactiveCutoff && $pSession[2] > $lifetimeCutoff) { /* A session exists and it's valid */ - $this->_userId = (int)$pSession[1]; - $this->_remoteIdentifier = unserialize($pSession[2]); - $this->_creationTime = (int)$pSession[3]; - $this->_modificationTime = (int)$pSession[4]; - $this->_sessionData = unserialize($pSession[5]); + $this->_userId = (int)$pSession[0]; + $this->_remoteIdentifier = unserialize($pSession[1]); + $this->_creationTime = (int)$pSession[2]; + $this->_modificationTime = (int)$pSession[3]; + $this->_sessionData = unserialize($pSession[4]); $this->_loadedSessionData = $this->_getSerializedSession(); $this->_isPersistent = true; Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage/GalleryStorageExtras.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage/GalleryStorageExtras.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage/GalleryStorageExtras.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -1047,6 +1047,92 @@ } /** + * @see GalleryStorage::getMapEntry + */ + function getMapEntry($mapName, $select, $match=array(), $optional=array()) { + $ret = $this->_dbInit(true); + if ($ret) { + return array($ret, null); + } + + /* Get Map information to check against */ + list ($ret, $mapInfo) = $this->_gs->describeMap($mapName); + if ($ret) { + return array($ret, null); + } + list ($tableName, $unused) = $this->_gs->_translateTableName($mapName); + $data = $selectColumns = $where = $wheredata = $orderBy = array(); + + /* SELECT */ + foreach ($select as $columnName) { + if (!array_key_exists($columnName, $mapInfo)) { + break; + } + $selectColumns[] = $this->_gs->_translateColumnName($columnName); + } + + /* WHERE */ + foreach ($match as $columnName => $matchValue) { + if (!array_key_exists($columnName, $mapInfo)) { + break; + } + $this->_gs->_getWhereSql($columnName, $mapInfo[$columnName], $matchValue, + $where, $wheredata); + } + + /* ORDER BY */ + if (!empty($optional['orderBy'])) { + foreach ($optional['orderBy'] as $columnName => $orderDirection) { + if (!array_key_exists($columnName, $mapInfo)) { + break; + } + $orderDirection = ($orderDirection == ORDER_DESCENDING) ? 'DESC' : 'ASC'; + $orderBy[] = $this->_gs->_translateColumnName($columnName) . ' ' . $orderDirection; + } + } + + /* Check if all parameters are correct */ + if (empty($selectColumns) || count($selectColumns) != count($select) + || count($where) != count($match) + || (!empty($optional['orderBy']) + && count($optional['orderBy']) != count($orderBy))) { + return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER), null); + } + + /* Generate SQL query */ + $query = 'SELECT ' . implode(', ', $selectColumns) . ' FROM ' . $tableName; + if (!empty($where)) { + $query .= ' WHERE ' . implode(' AND ', $where); + $data = array_merge($data, $wheredata); + } + if (!empty($orderBy)) { + $query .= ' ORDER BY ' . implode(', ', $orderBy); + } + + /* Run it with the right limits and return the results */ + $GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_NUM; + + if (!empty($optional['limit'])) { + $count = empty($optional['limit']['count']) ? -1 : $optional['limit']['count']; + $offset = empty($optional['limit']['offset']) ? -1 : $optional['limit']['offset']; + + $this->_gs->_traceStart(); + $recordSet = $this->_gs->_db->SelectLimit($query, $count, $offset, $data); + $this->_gs->_traceStop(); + } else { + $this->_gs->_traceStart(); + $recordSet = $this->_gs->_db->Execute($query, $data); + $this->_gs->_traceStop(); + } + + if ($recordSet) { + return array(null, new GallerySearchResults($recordSet)); + } else { + return array(GalleryCoreApi::error(ERROR_STORAGE_FAILURE), null); + } + } + + /** * @see GalleryStorage::removeMapEntry */ function removeMapEntry($mapName, $match) { Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryStorage.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -541,6 +541,22 @@ } /** + * Get entries in a map that match a criteria and return selected fields + * + * @param string the map we're working on + * @param array the columns to return + * @param array the entries to match + * @param array optional arguments (eg, limit, orderBy) + * array('limit' => array('count' => #, 'offset' => #), + * 'orderBy' => array(columnName => ORDER_ASCENDING|ORDER_DESCENDING, ...)) + * @return object GalleryStatus a status code + */ + function getMapEntry($mapName, $select, $match=array(), $optional=array()) { + $extras =& $this->_getExtras(); + return $extras->getMapEntry($mapName, $select, $match, $optional); + } + + /** * Update entries in a map * * @param string the map we're working on @@ -570,29 +586,8 @@ foreach ($mapInfo as $memberName => $memberData) { if (array_key_exists($memberName, $match)) { - if (GalleryUtilities::isA($match[$memberName], 'GallerySqlFragment')) { - $where[] = $this->_translateColumnName($memberName) . ' ' . - $this->_translateQuery($match[$memberName]->getFragment()); - foreach ($match[$memberName]->getValues() as $value) { - $wheredata[] = $value; - } - } else if (is_array($match[$memberName])) { - $qs = array(); - foreach ($match[$memberName] as $value) { - $qs[] = '?'; - $wheredata[] = $this->_normalizeValue($value, $memberData); - } - $where[] = $this->_translateColumnName($memberName) . ' IN (' - . implode(',', $qs) . ')'; - } else { - $value = $this->_normalizeValue($match[$memberName], $memberData); - if (is_null($value)) { - $where[] = $this->_translateColumnName($memberName) . ' IS NULL'; - } else { - $where[] = $this->_translateColumnName($memberName) . '=?'; - $wheredata[] = $value; - } - } + $this->_getWhereSql($memberName, $memberData, $match[$memberName], + $where, $wheredata); } if (array_key_exists($memberName, $change)) { @@ -630,6 +625,41 @@ } /** + * Accepts a $mapInfo pair and $match value to add match information to supplied array. + * + * @param string Name of map field + * @param array Data about map field + * @param mixed Values that the map should match on + * @param array All match keys + * @param array All match values + */ + function _getWhereSql($memberName, $memberData, $matchValue, &$where, &$wheredata) { + if (GalleryUtilities::isA($matchValue, 'GallerySqlFragment')) { + $where[] = $this->_translateColumnName($memberName) . ' ' . + $this->_translateQuery($matchValue->getFragment()); + foreach ($matchValue->getValues() as $value) { + $wheredata[] = $value; + } + } else if (is_array($matchValue)) { + $qs = array(); + foreach ($matchValue as $value) { + $qs[] = '?'; + $wheredata[] = $this->_normalizeValue($value, $memberData); + } + $where[] = $this->_translateColumnName($memberName) . ' IN (' + . implode(',', $qs) . ')'; + } else { + $value = $this->_normalizeValue($matchValue, $memberData); + if (is_null($value)) { + $where[] = $this->_translateColumnName($memberName) . ' IS NULL'; + } else { + $where[] = $this->_translateColumnName($memberName) . '=?'; + $wheredata[] = $value; + } + } + } + + /** * Configure the persistent store for this strategy, for the given module. * * @param string module id Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryTemplateAdapter.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryTemplateAdapter.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryTemplateAdapter.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -107,17 +107,15 @@ function url($params, &$smarty) { global $gallery; - if (isset($params['params'])) { - /* Allow the user to pass in bulk params */ - $hrefParams = $params['params']; - } else { - /* Search for args and add them to the params */ - $hrefParams = array(); - for ($i = 1; ($arg = "arg$i") && isset($params[$arg]); $i++) { - list ($key, $value) = explode('=', $params[$arg], 2); - $hrefParams[$key] = $value; - unset($params[$arg]); - } + /* Allow the user to pass in bulk params */ + $hrefParams = isset($params['params']) ? $params['params'] : array(); + unset($params['params']); + + /* Search for args and add them to the params */ + for ($i = 1; ($arg = "arg$i") && isset($params[$arg]); $i++) { + list ($key, $value) = explode('=', $params[$arg], 2); + $hrefParams[$key] = $value; + unset($params[$arg]); } if (isset($params['href'])) { $hrefParams['href'] = $params['href']; Modified: branches/DEV_2_2_ajax/modules/core/classes/GalleryTheme.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/GalleryTheme.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/GalleryTheme.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -825,13 +825,16 @@ } } - /* Albums have their own settings. Photos use their parent album's settings */ + /* Albums page or Photo page */ if ($item->getCanContainChildren()) { $theme['pageType'] = 'album'; + if (!isset($theme['pageUrl'])) { + $theme['pageUrl'] = + array('view' => 'core.ShowItem', 'itemId' => $item->getId()); + } /* If we care about pagination, then figure out the current page and total pages */ $perPage = $this->getPageSize($params); - $page = GalleryUtilities::getRequestVariables('page'); if ($perPage == 0) { $page = 1; @@ -842,13 +845,17 @@ */ $highlightId = GalleryUtilities::getRequestVariables('highlightId'); if (!empty($highlightId)) { - list ($ret, $childIds) = GalleryCoreApi::fetchChildItemIds($item); - if ($ret) { - return array($ret, null); + if (isset($theme['allChildIds'])) { + $childIds = $theme['allChildIds']; + } else { + list ($ret, $childIds) = GalleryCoreApi::fetchChildItemIds($item); + if ($ret) { + return array($ret, null); + } } $page = 1; - for ($i = 0; $i < sizeof($childIds); $i++) { + for ($i = 0; $i < count($childIds); $i++) { if ($childIds[$i] == $highlightId) { /* Found it */ $page = ceil(($i+1) / $perPage); @@ -857,7 +864,7 @@ } /* Redirect to the new page */ - $redirect = array('view' => 'core.ShowItem', 'itemId' => $item->getId()); + $redirect = $theme['pageUrl']; if ($page != 1) { $redirect['page'] = $page; } @@ -867,37 +874,45 @@ } } + if (isset($theme['item']) && isset($theme['allChildIds'])) { + /* Dynamic album has already loaded child ids */ + $isDynamicAlbum = true; + $this->_cacheablePage = false; + $item = $theme['item']; + } + if (!empty($perPage)) { - if (empty($page)) { - $page = 1; - } - /* Use the pagination to calculate the child item ids to load */ $start = $perPage * ($page - 1); - list ($ret, $childIds) = GalleryCoreApi::fetchChildItemIds( - $item, $start, $perPage, $theme['actingUserId']); - if ($ret) { - return array($ret, null); - } + if (isset($isDynamicAlbum)) { + $childIds = array_slice($theme['allChildIds'], $start, $perPage); + $theme['totalPages'] = ceil(count($theme['allChildIds']) / $perPage); + } else { + list ($ret, $childIds) = GalleryCoreApi::fetchChildItemIds( + $item, $start, $perPage, $theme['actingUserId']); + if ($ret) { + return array($ret, null); + } - /* - * Load up our child count so that we can figure out the max pages. We do this - * after we get the child ids because the 'childCount' common template data also - * gets the child counts for the child albums. - */ - $ret = $this->loadCommonTemplateData( - $template, $item, $params, array('childCount'), $childIds, false); - if ($ret) { - return array($ret, null); + /* + * Load up our child count so that we can figure out the max pages. We do + * this after we get the child ids because the 'childCount' common template + * data also gets the child counts for the child albums. + */ + $ret = $this->loadCommonTemplateData( + $template, $item, $params, array('childCount'), $childIds, false); + if ($ret) { + return array($ret, null); + } + + /* Store the total pages in the theme */ + $theme['totalPages'] = ceil($theme['childCount'] / $perPage); } - - /* Store the total pages in the theme */ - $theme['totalPages'] = ceil($theme['childCount'] / $perPage); $theme['currentPage'] = $page; /* If our page is over the max, redirect the user to the max page */ - if ($page > $theme['totalPages'] && $theme['childCount'] > 0) { - $redirect = array('view' => 'core.ShowItem', 'itemId' => $item->getId()); + if ($page > $theme['totalPages'] && $theme['totalPages'] > 0) { + $redirect = $theme['pageUrl']; if ($theme['totalPages'] != 1) { $redirect['page'] = $theme['totalPages']; } @@ -905,18 +920,21 @@ } } else { /* - * No pagination; load all children (this isn't going to scale, but the theme is - * the boss... for now). + * No pagination; load all children (this isn't going to scale, but the theme + * is the boss... for now). */ - list ($ret, $childIds) = GalleryCoreApi::fetchChildItemIds( - $item, null, null, $theme['actingUserId']); - if ($ret) { - return array($ret, null); + if (isset($isDynamicAlbum)) { + $childIds = $theme['allChildIds']; + } else { + list ($ret, $childIds) = GalleryCoreApi::fetchChildItemIds( + $item, null, null, $theme['actingUserId']); + if ($ret) { + return array($ret, null); + } } } - list ($ret, $result) = - $this->showAlbumPage($template, $item, $params, $childIds); + list ($ret, $result) = $this->showAlbumPage($template, $item, $params, $childIds); if ($ret) { return array($ret, null); } @@ -1158,8 +1176,8 @@ } } $itemId = $item->getId(); - $allItems = array_merge(array($item), $childItems); - $allItemIds = array_merge(array($itemId), $childIds); + $allItems = array_merge($itemId ? array($item) : array(), $childItems); + $allItemIds = array_merge($itemId ? array($itemId) : array(), $childIds); $allAlbumIds = array(); foreach ($allItems as $it) { if ($it->getCanContainChildren()) { @@ -1198,9 +1216,17 @@ * TODO: Should we have this obey the acting user permission? It may make navigation * strange for the active user. */ - list ($ret, $parentSequence) = GalleryCoreApi::fetchParentSequence($itemId); - if ($ret) { - return $ret; + if ($itemId) { + list ($ret, $parentSequence) = GalleryCoreApi::fetchParentSequence($itemId); + if ($ret) { + return $ret; + } + } else { + list ($ret, $rootId) = GalleryCoreApi::getDefaultAlbumId(); + if ($ret) { + return $ret; + } + $parentSequence = array($rootId); } if (!empty($parentSequence)) { $ret = GalleryCoreApi::studyPermissions($parentSequence, $theme['actingUserId']); @@ -1215,7 +1241,7 @@ if (isset($load['itemNavigator'])) { $navigator = array(); $canViewParent = false; - if ($item->getParentId() != null) { + if ($item->getParentId()) { list ($ret, $canViewParent) = GalleryCoreApi::hasItemPermission( $item->getParentId(), 'core.view', $theme['actingUserId']); if ($ret) { @@ -1301,7 +1327,7 @@ if ($ret) { return $ret; } - $theme['item']['viewCount'] = $viewCount[$itemId]; + $theme['item']['viewCount'] = isset($viewCount[$itemId]) ? $viewCount[$itemId] : 0; $childData[] = 'viewCount'; } @@ -1310,17 +1336,20 @@ * 'childCount' */ if (isset($load['childCount']) && !isset($theme['childCount'])) { - list ($ret, $childCount) = - GalleryCoreApi::fetchChildCounts($allAlbumIds, $theme['actingUserId']); - if ($ret) { - return $ret; + if (!empty($allAlbumIds)) { + list ($ret, $childCount) = + GalleryCoreApi::fetchChildCounts($allAlbumIds, $theme['actingUserId']); + if ($ret) { + return $ret; + } } foreach ($allAlbumIds as $id) { if (!isset($childCount[$id])) { $childCount[$id] = 0; } } - $theme['childCount'] = isset($childCount[$itemId]) ? $childCount[$itemId] : 0; + $theme['childCount'] = isset($childCount[$itemId]) ? $childCount[$itemId] + : (isset($theme['allChildIds']) ? count($theme['allChildIds']) : 0); $childData[] = 'childCount'; } if (isset($theme['childCount'])) { @@ -1332,10 +1361,12 @@ * 'descendentCount' */ if (isset($load['descendentCount'])) { - list ($ret, $descendentCount) = - GalleryCoreApi::fetchDescendentCounts($allAlbumIds, $theme['actingUserId']); - if ($ret) { - return $ret; + if (!empty($allAlbumIds)) { + list ($ret, $descendentCount) = + GalleryCoreApi::fetchDescendentCounts($allAlbumIds, $theme['actingUserId']); + if ($ret) { + return $ret; + } } foreach ($allAlbumIds as $id) { if (!isset($descendentCount[$id])) { @@ -1541,16 +1572,16 @@ $navigator = array(); if ($page > 1) { $navigator['first']['urlParams'] = $navigator['back']['urlParams'] = - array('view' => 'core.ShowItem', 'itemId' => $itemId); + $theme['pageUrl']; if ($page - 1 != 1) { $navigator['back']['urlParams']['page'] = $page - 1; } } if ($page < $theme['totalPages']) { - $navigator['next']['urlParams'] = array( - 'view' => 'core.ShowItem', 'itemId' => $itemId, 'page' => $page + 1); - $navigator['last']['urlParams'] = array( - 'view' => 'core.ShowItem', 'itemId' => $itemId, 'page' => $theme['totalPages']); + $navigator['next']['urlParams'] = $navigator['last']['urlParams'] = + $theme['pageUrl']; + $navigator['next']['urlParams']['page'] = $page + 1; + $navigator['last']['urlParams']['page'] = $theme['totalPages']; } $theme['navigator'] = $navigator; } @@ -1718,7 +1749,7 @@ } /* -------------------------------------------------------------------------------------- */ - if (isset($load['permissions']) && !isset($theme['permissions'])) { + if (isset($load['permissions']) && !isset($theme['permissions']) && $itemId) { list ($ret, $permissions) = GalleryCoreApi::getPermissions($itemId, $theme['actingUserId']); if ($ret) { Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryEntityHelper_simple.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryEntityHelper_simple.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryEntityHelper_simple.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -129,9 +129,8 @@ function loadEntityByExternalId($externalId, $entityType) { global $gallery; - $query = 'SELECT [ExternalIdMap::entityId] FROM [ExternalIdMap] ' . - 'WHERE [ExternalIdMap::externalId] = ? AND [ExternalIdMap::entityType] = ?'; - list ($ret, $results) = $gallery->search($query, array($externalId, $entityType)); + list ($ret, $results) = GalleryCoreApi::getMapEntry('ExternalIdMap', + array('entityId'), array('externalId' => $externalId, 'entityType' => $entityType)); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryFactoryHelper_simple.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryFactoryHelper_simple.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryFactoryHelper_simple.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -81,20 +81,9 @@ /* Don't get by reference here, it'll detach $registry from the singleton */ $registry = GalleryDataCache::getFromDisk($cacheParams); if (!isset($registry)) { - $query = ' - SELECT - [GalleryFactoryMap::classType], - [GalleryFactoryMap::className], - [GalleryFactoryMap::implId], - [GalleryFactoryMap::implPath], - [GalleryFactoryMap::hints], - [GalleryFactoryMap::implModuleId] - FROM - [GalleryFactoryMap] - ORDER BY - [GalleryFactoryMap::orderWeight] ASC - '; - list ($ret, $searchResults) = $gallery->search($query); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryFactoryMap', + array('classType', 'className', 'implId', 'implPath', 'hints', 'implModuleId'), + array(), array('orderBy' => array('orderWeight' => ORDER_ASCENDING))); if ($ret) { $ret = array($ret, null); return $ret; Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_medium.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_medium.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_medium.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -64,16 +64,8 @@ foreach ($itemIds as $idx => $id) { $itemIds[$idx] = (int)$id; } - $query = ' - SELECT - [GalleryItemAttributesMap::itemId], [GalleryItemAttributesMap::orderWeight] - FROM - [GalleryItemAttributesMap] - WHERE - [GalleryItemAttributesMap::itemId] IN (' . - GalleryUtilities::makeMarkers(sizeof($itemIds)) . ') - '; - list ($ret, $searchResults) = $gallery->search($query, $itemIds); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryItemAttributesMap', + array('itemId', 'orderWeight'), array('itemId' => $itemIds)); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -122,20 +122,11 @@ * @static */ function fetchViewCounts($itemIds) { - global $gallery; - foreach ($itemIds as $idx => $id) { $itemIds[$idx] = (int)$id; } - $query = sprintf(' - SELECT - [GalleryItemAttributesMap::itemId], [GalleryItemAttributesMap::viewCount] - FROM - [GalleryItemAttributesMap] - WHERE - [GalleryItemAttributesMap::itemId] IN (%s) - ', GalleryUtilities::makeMarkers($itemIds)); - list ($ret, $searchResults) = $gallery->search($query, $itemIds); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryItemAttributesMap', + array('itemId', 'viewCount'), array('itemId' => $itemIds)); if ($ret) { return array($ret, null); } @@ -162,15 +153,8 @@ function fetchParentSequence($itemId) { global $gallery; - $query = ' - SELECT - [GalleryItemAttributesMap::parentSequence] - FROM - [GalleryItemAttributesMap] - WHERE - [GalleryItemAttributesMap::itemId] = ? - '; - list ($ret, $searchResults) = $gallery->search($query, array((int)$itemId)); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryItemAttributesMap', + array('parentSequence'), array('itemId' => (int)$itemId)); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_advanced.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_advanced.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_advanced.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -121,22 +121,12 @@ * @static */ function fetchPropertyKeys($itemId) { - global $gallery; - if (empty($itemId)) { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER), null); } - $query = ' - SELECT - [GalleryItemPropertiesMap::key] - FROM - [GalleryItemPropertiesMap] - WHERE - [GalleryItemPropertiesMap::itemId] = ? - '; - - list ($ret, $searchResults) = $gallery->search($query, array((int)$itemId)); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryItemPropertiesMap', + array('key'), array('itemId' => (int)$itemId)); if ($ret) { return array($ret, null); } @@ -158,25 +148,11 @@ * @static */ function fetchProperty($itemId, $key) { - global $gallery; - if (empty($itemId) || empty($key)) { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER), null); } - - $query = ' - SELECT - [GalleryItemPropertiesMap::value] - FROM - [GalleryItemPropertiesMap] - WHERE - [GalleryItemPropertiesMap::itemId] = ? - AND - [GalleryItemPropertiesMap::key] = ? - '; - - list ($ret, $searchResults) = - $gallery->search($query, array((int)$itemId, $key)); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryItemPropertiesMap', + array('value'), array('itemId' => (int)$itemId, 'key' => $key)); if ($ret) { return array($ret, null); } @@ -200,23 +176,11 @@ * @static */ function fetchAllProperties($itemId) { - global $gallery; - if (empty($itemId)) { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER), null); } - - $query = ' - SELECT - [GalleryItemPropertiesMap::key], - [GalleryItemPropertiesMap::value] - FROM - [GalleryItemPropertiesMap] - WHERE - [GalleryItemPropertiesMap::itemId] = ? - '; - - list ($ret, $searchResults) = $gallery->search($query, array((int)$itemId)); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryItemPropertiesMap', + array('key', 'value'), array('itemId' => (int)$itemId)); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_simple.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_simple.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryItemHelper_simple.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -167,22 +167,9 @@ foreach ($itemIds as $idx => $id) { $itemIds[$idx] = (int)$id; } - $query = sprintf(' - SELECT - [GalleryDescendentCountsMap::itemId], [GalleryDescendentCountsMap::descendentCount] - FROM - [GalleryDescendentCountsMap] - WHERE - [GalleryDescendentCountsMap::userId] = ? - AND - [GalleryDescendentCountsMap::itemId] IN (%s) - ', GalleryUtilities::makeMarkers(sizeof($itemIds))); - - $data = array(); - $data[] = (int)$userId; - array_splice($data, sizeof($data), 0, $itemIds); - - list ($ret, $searchResults) = $gallery->search($query, $data); + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryDescendentCountsMap', + array('itemId', 'descendentCount'), + array('userId' => $userId, 'itemId' => $itemIds)); if ($ret) { return array($ret, null); } Modified: branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryPermissionHelper_advanced.class =================================================================== --- branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryPermissionHelper_advanced.class 2006-07-22 03:11:34 UTC (rev 14028) +++ branches/DEV_2_2_ajax/modules/core/classes/helpers/GalleryPermissionHelper_advanced.class 2006-07-22 04:04:26 UTC (rev 14029) @@ -292,24 +292,18 @@ $data[] = $itemId; $data[] = "$parentSequence/%"; $data = array_merge($data, $aclIds); + list ($ret, $searchResults) = $gallery->search($query, $data); + if ($ret) { + return $ret; + } } else { - $query = ' - SELECT - [GalleryAccessSubscriberMap::accessListId], - [GalleryAccessSubscriberMap::itemId] - FROM - [GalleryAccessSubscriberMap] - WHERE - [GalleryAccessSubscriberMap::itemId] = ? - '; - $data[] = $itemId; + list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('GalleryAccessSubscriberMap', + array('accessListId', 'itemId'), array('itemId' => $itemId)); + if ($ret) { + return $ret; + } } - list ($ret, $searchResults) = $gallery->search($query, $data); - if ($ret) { - return $ret; ... [truncated message content] |