From 72bd5d5f16aa7e2eeb6811a9a0be3e6bd9f5e653 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 26 Oct 2009 13:38:16 -0700 Subject: [PATCH 01/29] Clarify the POD for addChild. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetLineage.pm | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d1f00c8a3..fbcc3aa2b 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -10,6 +10,7 @@ - fixed #11047: required field on dataform - fixed #11162: Can't delete calendar Related Material Link - fixed #11154: vendor payouts screen borked ( Martin Kamerbeek / Oqapi ) + - fixed #11166: Documentation bug - addChild 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 26f4a17e7..0ecb6d70d 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -56,11 +56,9 @@ An epoch representing the time this asset was created. =head3 options -A hash reference that allows passed in options to change how this method behaves. - -=head4 skipAutoCommitWorkflows - -If this is set to 1 assets that normally autocommit their workflows (like CS Posts) won't do that. +A hash reference that allows passed in options to change how this method behaves. Currently, +these options are passed down to L, and are not actually used by C. +Please see the POD for L for a list of options. =cut From 8c3414dca05d3c77cc351e78ac7f33abc28d9817 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 26 Oct 2009 17:52:08 -0500 Subject: [PATCH 02/29] fixed #11116: Deleted user's version tags and revisions --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Operation/VersionTag.pm | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index fbcc3aa2b..6cf97b0e8 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,7 @@ - fixed #11162: Can't delete calendar Related Material Link - fixed #11154: vendor payouts screen borked ( Martin Kamerbeek / Oqapi ) - fixed #11166: Documentation bug - addChild + - fixed #11116: Deleted user's version tags and revisions 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index dfe5638fb..4f2caedc2 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -373,10 +373,9 @@ sub www_commitVersionTag { $session->url->page("op=commitVersionTag;tagId=".$tag->getId), ); $p->setDataByQuery(q{ - SELECT assetData.revisionDate, users.username, asset.assetId, asset.className + SELECT assetData.revisionDate, assetData.revisedBy, asset.assetId, asset.className FROM assetData LEFT JOIN asset ON assetData.assetId = asset.assetId - LEFT JOIN users ON assetData.revisedBy = users.userId WHERE assetData.tagId=? }, undef, undef, @@ -384,8 +383,9 @@ sub www_commitVersionTag { ); foreach my $row ( @{$p->getPageData} ) { - my ( $date, $by, $id, $class) = @{ $row }{ qw( revisionDate username assetId className ) }; + my ( $date, $byUserId, $id, $class) = @{ $row }{ qw( revisionDate revisedBy assetId className ) }; my $asset = WebGUI::Asset->new($session, $id, $class, $date); + my $byUser = WebGUI::User->new( $session, $byUserId ); $output .= '' .$session->icon->view("func=view;revision=".$date, $asset->get("url")) @@ -393,7 +393,7 @@ sub www_commitVersionTag { '.$asset->getTitle.' '.$asset->getName.''.$asset->getName.' '.$session->datetime->epochToHuman($date).' - '.$by.''; + '.$byUser->get('username').''; } $output .= ''.$p->getBarSimple; @@ -809,11 +809,12 @@ sub www_manageRevisionsInTag { . ' ' ; my $p = WebGUI::Paginator->new($session,$session->url->page("op=manageRevisionsInTag;tagId=".$tag->getId)); - $p->setDataByQuery("select assetData.revisionDate, users.username, asset.assetId, asset.className from assetData - left join asset on assetData.assetId=asset.assetId left join users on assetData.revisedBy=users.userId + $p->setDataByQuery("select assetData.revisionDate, assetData.revisedBy, asset.assetId, asset.className from assetData + left join asset on assetData.assetId=asset.assetId where assetData.tagId=?",undef, undef, [$tag->getId]); foreach my $row (@{$p->getPageData}) { - my ($date,$by,$id, $class) = ($row->{revisionDate}, $row->{username}, $row->{assetId}, $row->{className}); + my ($date,$byUserId,$id, $class) = ($row->{revisionDate}, $row->{revisedBy}, $row->{assetId}, $row->{className}); + my $byUser = WebGUI::User->new( $session, $byUserId ); my $asset = WebGUI::Asset->new($session,$id,$class,$date); # A checkbox for delete and move actions my $checkbox = WebGUI::Form::checkbox( $session, { @@ -827,7 +828,7 @@ sub www_manageRevisionsInTag { '.$asset->getTitle.' '.$asset->getName.''.$asset->getName.' '.$session->datetime->epochToHuman($date).' - '.$by.''; + '.$byUser->username.''; } $output .= ''.$p->getBarSimple.WebGUI::Form::formFooter( $session ); $tag = $session->db->getRow("assetVersionTag","tagId",$tag->getId); From b24a3f4eb5787e4551c96f8509548304433836dd Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 26 Oct 2009 22:17:58 -0500 Subject: [PATCH 03/29] fixed #11168 (autocommit map points) and #10888 (editing map points) --- docs/changelog/7.x.x.txt | 2 + lib/WebGUI/Asset/Wobject/Map.pm | 15 ++++++- www/extras/yui-webgui/build/map/map.js | 57 ++++++++++++++++++-------- 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6cf97b0e8..ab0400404 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -12,6 +12,8 @@ - fixed #11154: vendor payouts screen borked ( Martin Kamerbeek / Oqapi ) - fixed #11166: Documentation bug - addChild - fixed #11116: Deleted user's version tags and revisions + - fixed #11168: Points do not work with uncommitted Map + - fixed #10888: Add Point... how do I enter details? 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Asset/Wobject/Map.pm b/lib/WebGUI/Asset/Wobject/Map.pm index c924269b0..3af388789 100644 --- a/lib/WebGUI/Asset/Wobject/Map.pm +++ b/lib/WebGUI/Asset/Wobject/Map.pm @@ -556,8 +556,19 @@ sub www_ajaxEditPointSave { my $errors = $asset->processAjaxEditForm; # Commit! - if ($asset->getAutoCommitWorkflowId && $self->hasBeenCommitted) { - $asset->requestAutoCommit; + if ( $asset->getAutoCommitWorkflowId ) { + if ( $self->hasBeenCommitted) { + $asset->requestAutoCommit; + } + else { + # Add mappoint to map's version tag + my $oldTagId = $asset->get('tagId'); + $asset->setVersionTag( $self->get('tagId') ); + my $oldTag = WebGUI::VersionTag->new( $session, $oldTagId ); + if ( $oldTag->getAssetCount <= 0 ) { + $oldTag->rollback; + } + } } # Encode entities because we're returning as HTML diff --git a/www/extras/yui-webgui/build/map/map.js b/www/extras/yui-webgui/build/map/map.js index 4a326950f..b2165cf5a 100644 --- a/www/extras/yui-webgui/build/map/map.js +++ b/www/extras/yui-webgui/build/map/map.js @@ -9,6 +9,9 @@ if (typeof WebGUI.Map == "undefined") { // Keep track of all points on all maps and how to focus on them WebGUI.Map.markers = {}; +// Keep a loading dialog +WebGUI.Map.loadingDialog = undefined; + /** * WebGUI.Map.deletePoint( map, mgr, mapUrl, marker ) * Delete a point from the map. @@ -17,12 +20,14 @@ WebGUI.Map.markers = {}; WebGUI.Map.deletePoint = function ( map, mgr, mapUrl, marker ) { var callback = function ( text, code ) { + WebGUI.Map.hideLoading(); var response = YAHOO.lang.JSON.parse( text ); // remove the marker from the map if ( !response.error ) { mgr.removeMarker( marker ); } }; + WebGUI.Map.showLoading(); GDownloadUrl( mapUrl + '?func=ajaxDeletePoint;assetId=' + marker.assetId, callback); }; @@ -51,21 +56,6 @@ WebGUI.Map.editPoint assetId = marker.assetId; } - // Create a loading dialog - var loadingDialog = new YAHOO.widget.Panel("loading", { width:"240px", - fixedcenter:true, - close:false, - draggable:false, - zindex:4, - modal:true, - visible:false - } - ); - - loadingDialog.setHeader("Loading, please wait..."); - loadingDialog.setBody(''); - loadingDialog.render(document.body); - // Callback should open the window with the form var callback = function (text, code) { YAHOO.util.Dom.addClass( document.body, "yui-skin-sam" ); @@ -84,7 +74,7 @@ WebGUI.Map.editPoint var lng = marker.getLatLng().lng(); this.form.elements['latitude'].value = lat; this.form.elements['longitude'].value = lng; - + WebGUI.Map.showLoading(); this.submit(); } @@ -143,15 +133,16 @@ WebGUI.Map.editPoint GEvent.addListener( marker, "dragend", function (latlng) { WebGUI.Map.setPointLocation( marker, latlng, mapUrl ); } ); + WebGUI.Map.hideLoading(); } }; // Hide the loading dialog - loadingDialog.hide(); + WebGUI.Map.hideLoading(); }; // Show the loading dialog - loadingDialog.show(); + WebGUI.Map.showLoading(); // Get the form GDownloadUrl( mapUrl + '?func=ajaxEditPoint;assetId=' + assetId, callback ); @@ -174,6 +165,11 @@ WebGUI.Map.focusOn marker.openInfoWindow( marker.infoWin ); }; +WebGUI.Map.hideLoading += function () { + WebGUI.Map.loadingDialog.hide(); +}; + /** * WebGUI.Map.preparePoints ( map, mgr, mapUrl, points ) * Prepare the points from WebGUI into Google Map GMarkers @@ -251,7 +247,9 @@ WebGUI.Map.setCenter ; var callback = function ( text, code ) { // TODO: Notify the poor user + WebGUI.Map.hideLoading(); }; + WebGUI.Map.showLoading(); GDownloadUrl(url,callback); }; @@ -268,8 +266,31 @@ WebGUI.Map.setPointLocation ; var callback = function ( text, code ) { // TODO: Notify the poor user + WebGUI.Map.hideLoading(); }; + WebGUI.Map.showLoading(); GDownloadUrl(url, callback); }; +WebGUI.Map.showLoading += function () { + // Create a loading dialog + if ( !WebGUI.Map.loadingDialog ) { + var loadingDialog = new YAHOO.widget.Panel("loading", { width:"240px", + fixedcenter:true, + close:false, + draggable:false, + zindex:4, + modal:true, + visible:false + } + ); + loadingDialog.setHeader("Loading, please wait..."); + loadingDialog.setBody(''); + loadingDialog.render(document.body); + WebGUI.Map.loadingDialog = loadingDialog; + } + + WebGUI.Map.loadingDialog.show(); +}; From b577b950e9bd01eba771ad12a939505f7a02626e Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 27 Oct 2009 01:01:57 -0500 Subject: [PATCH 04/29] fixed: #10887: Map Point dropdown doesn't update --- docs/changelog/7.x.x.txt | 1 + ...e_map_map-templates_default-map-view.wgpkg | Bin 0 -> 1121 bytes lib/WebGUI/Asset/Wobject/Map.pm | 20 +++- www/extras/yui-webgui/build/map/map.js | 100 +++++++++++++----- 4 files changed, 93 insertions(+), 28 deletions(-) create mode 100644 docs/upgrades/packages-7.7.23/home_map_map-templates_default-map-view.wgpkg diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ab0400404..0982410e2 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -14,6 +14,7 @@ - fixed #11116: Deleted user's version tags and revisions - fixed #11168: Points do not work with uncommitted Map - fixed #10888: Add Point... how do I enter details? + - fixed #10887: Map Point dropdown doesn't update 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/docs/upgrades/packages-7.7.23/home_map_map-templates_default-map-view.wgpkg b/docs/upgrades/packages-7.7.23/home_map_map-templates_default-map-view.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..f3597a0954aae007639398599f53f812a704b641 GIT binary patch literal 1121 zcmV-n1fKgJiwFP!00000|Ls<7Z`(Ey_UHZz!Na~Kwj{@Ptz-exrd_f%soN$?*JUs$ ziME)?Bu7$q9K-*;M^dun*vZzS0Wu&0YzaKx!@K9+*r+}Jh&Q}9#eb*kckaZ0$KQeYyFcjs2Vov7{*4DueKNxN3n;?6 z!egEyg$GC}6eVL!m8?5~^Vi>7MlKZ-XoRavTriG>BG_y+Fd8XEQoXt1Oeh>57!l3V z)Szf_BrqHkznW>NdaJ$^KzS*HU*}nv5}Dw*6jD6BAT(xEqve(Ye4_+9!YDpNBiTpM zHE3zzJ*j3XcGQgHUoOGB8`X@YysYmxrlSFli8?{N&j?jcib9;uVl$G^PcRuJDrmbdzuC3> z?6<=vSPWA(-JS)Gj08*5#a`2RzF$%#XOwYC)RB$GHN1k0t#y%Q^E=KeFiTZSAWRrwdTFEnSY_RrJ2~%8PIj(%FZGV`cAbAV zrC6LxERJnzR&qWQso_0gW854gu7BG_DavMyhbT+cwqBhOJS}62q{J%6>s`5nFWyz_ zx7hvgD*V$&*J0; zF**SEUqg?=Vk4&2JcwfpSss*Yqow2?gMe{kNJ$By2^K`1i}bBv<31EUwcJ#iQ3SnD zo}#hk`2vT(o*xInfsR!WoaG(1giHy=c~7mIp}S!Um%B}We4QXV+SEOD*F9k|8IrsK zdVagp@mrqnmk@ba|In$Vn`E~XDWXzq_MuHW=LB)b>|AzeB6TcKm~X7)i@YZMlqonp zLJIQ0pjU{2agv?=hZD4qnQ2sY#9_Wnsx!dk{3mj2&Gh`2z0!P+1QeJ#_8!`U;OOk+ z-Fgs+d8f9bQ*v8+*Ti1i?`iT nYgC%I%#_?deOp_+SUj2Q<+CBr3_LUNgc96EE?01^NImq9E% literal 0 HcmV?d00001 diff --git a/lib/WebGUI/Asset/Wobject/Map.pm b/lib/WebGUI/Asset/Wobject/Map.pm index 3af388789..6db5861f0 100644 --- a/lib/WebGUI/Asset/Wobject/Map.pm +++ b/lib/WebGUI/Asset/Wobject/Map.pm @@ -388,6 +388,8 @@ sub view { var mapId = "%s"; var mapUrl = "%s"; var map = new GMap2( document.getElementById("map_" + mapId) ); + map.url = mapUrl; + map.assetId = mapId; map.setCenter(new GLatLng(%s, %s), %s); map.setUIToDefault(); map.extrasUrl = "%s"; @@ -414,7 +416,7 @@ ENDHTML } $mapHtml .= <<'ENDHTML'; - markermanager.addMarkers( WebGUI.Map.preparePoints(map, markermanager, mapUrl, points), 0 ); + markermanager.addMarkers( WebGUI.Map.preparePoints(map, markermanager, points), 0 ); ENDHTML } @@ -434,13 +436,13 @@ ENDHTML if ( document.getElementById( "setCenter_" + mapId ) ) { var button = document.getElementById( "setCenter_" + mapId ); GEvent.addDomListener( button, "click", function () { - WebGUI.Map.setCenter( map, mapUrl ); + WebGUI.Map.setCenter( map ); } ); } if ( document.getElementById( "addPoint_" + mapId ) ) { var button = document.getElementById( "addPoint_" + mapId ); GEvent.addDomListener( button, "click", function () { - WebGUI.Map.editPoint( map, markermanager, mapUrl ); + WebGUI.Map.editPoint( map, markermanager ); } ); } }); @@ -463,6 +465,18 @@ ENDHTML id => sprintf( 'setCenter_%s', $self->getId ), } ); + # Select box to choose a map point + tie my %selectPointOptions, 'Tie::IxHash', ( + "" => '-- ' . $i18n->get('select a point'), + map { $_->{assetId} => $_->{title} } sort { $a->{title} cmp $b->{title} } @{$var->{mapPoints}}, + ); + $var->{ selectPoint } + = WebGUI::Form::selectBox( $session, { + extras => q{onchange="WebGUI.Map.focusOn(this.options[this.selectedIndex].value);"}, + id => sprintf( q{selectPoint_%s}, $self->getId ), + options => \%selectPointOptions, + } ); + return $self->processTemplate( $var, undef, $self->{_viewTemplate} ); } diff --git a/www/extras/yui-webgui/build/map/map.js b/www/extras/yui-webgui/build/map/map.js index b2165cf5a..2e2f9ee15 100644 --- a/www/extras/yui-webgui/build/map/map.js +++ b/www/extras/yui-webgui/build/map/map.js @@ -7,38 +7,40 @@ if (typeof WebGUI.Map == "undefined") { } // Keep track of all points on all maps and how to focus on them +// A hash (map) of hashes (markers) WebGUI.Map.markers = {}; // Keep a loading dialog WebGUI.Map.loadingDialog = undefined; /** - * WebGUI.Map.deletePoint( map, mgr, mapUrl, marker ) + * WebGUI.Map.deletePoint( map, mgr, marker ) * Delete a point from the map. * NOTE: We assume the user has already confirmed this action */ WebGUI.Map.deletePoint -= function ( map, mgr, mapUrl, marker ) { += function ( map, mgr, marker ) { var callback = function ( text, code ) { WebGUI.Map.hideLoading(); var response = YAHOO.lang.JSON.parse( text ); // remove the marker from the map if ( !response.error ) { mgr.removeMarker( marker ); + delete WebGUI.Map.markers[ map.assetId ][ marker.assetId ]; } }; WebGUI.Map.showLoading(); - GDownloadUrl( mapUrl + '?func=ajaxDeletePoint;assetId=' + marker.assetId, callback); + GDownloadUrl( map.url + '?func=ajaxDeletePoint;assetId=' + marker.assetId, callback); }; /** - * WebGUI.Map.editPoint( map, mgr, mapUrl, marker ) + * WebGUI.Map.editPoint( map, mgr, marker ) * Edit a point on the map. * up the edit box. mgr is the Marker Manager to add the marker - * to. mapUrl is the URL of the map asset + * to. */ WebGUI.Map.editPoint -= function ( map, mgr, mapUrl, marker ) { += function ( map, mgr, marker ) { var assetId = ''; if ( !marker ) { marker = new GMarker( map.getCenter(), { draggable: true } ); @@ -49,7 +51,7 @@ WebGUI.Map.editPoint assetId = "new"; marker.assetId = "new"; GEvent.addListener( marker, "dragend", function (latlng) { - WebGUI.Map.setPointLocation( marker, latlng, mapUrl ); + WebGUI.Map.setPointLocation( marker, latlng ); } ); } else { @@ -94,6 +96,7 @@ WebGUI.Map.editPoint // Update marker info var point = YAHOO.lang.JSON.parse( o.responseText ); marker.assetId = point.assetId; + marker.title = point.title; GEvent.clearListeners( marker, "click" ); GEvent.clearListeners( marker, "infowindowbeforeclose" ); @@ -115,7 +118,7 @@ WebGUI.Map.editPoint editButton.type = "button"; editButton.value = "Edit"; GEvent.addDomListener( editButton, "click", function () { - WebGUI.Map.editPoint( map, mgr, mapUrl, marker ); + WebGUI.Map.editPoint( map, mgr, marker ); } ); divButton.appendChild( editButton ); @@ -124,16 +127,19 @@ WebGUI.Map.editPoint deleteButton.value = "Delete"; // Replace with i18n GEvent.addDomListener( deleteButton, "click", function () { if ( confirm("Are you sure you want to delete this point?") ) { - WebGUI.Map.deletePoint( map, mgr, mapUrl, marker ); + WebGUI.Map.deletePoint( map, mgr, marker ); } } ); divButton.appendChild( deleteButton ); } marker.bindInfoWindow( infoWin ); GEvent.addListener( marker, "dragend", function (latlng) { - WebGUI.Map.setPointLocation( marker, latlng, mapUrl ); + WebGUI.Map.setPointLocation( marker, latlng ); } ); WebGUI.Map.hideLoading(); + + WebGUI.Map.markers[map.assetId][marker.assetId] = marker; + WebGUI.Map.updateSelectPoint( map ); } }; @@ -145,21 +151,27 @@ WebGUI.Map.editPoint WebGUI.Map.showLoading(); // Get the form - GDownloadUrl( mapUrl + '?func=ajaxEditPoint;assetId=' + assetId, callback ); + GDownloadUrl( map.url + '?func=ajaxEditPoint;assetId=' + assetId, callback ); }; /** - * WebGUI.Map.focusOn( assetId ) + * WebGUI.Map.focusOn( pointId ) * Pan the appropriate map to view the appropriate map point */ WebGUI.Map.focusOn -= function ( assetId ) { - var marker = WebGUI.Map.markers[assetId]; += function ( pointId ) { + var marker; + for ( var mapId in WebGUI.Map.markers ) { + if ( WebGUI.Map.markers[mapId][pointId] ) { + marker = WebGUI.Map.markers[mapId][pointId]; + break; + } + } if ( !marker ) return; var map = marker.map; var infoWin = marker.infoWin; - if ( map.getZoom() < 5 ) { - map.setZoom(6); + if ( map.getZoom() <= 4 ) { + map.setZoom(5); } map.panTo( marker.getLatLng() ); marker.openInfoWindow( marker.infoWin ); @@ -171,11 +183,13 @@ WebGUI.Map.hideLoading }; /** - * WebGUI.Map.preparePoints ( map, mgr, mapUrl, points ) + * WebGUI.Map.preparePoints ( map, mgr, points ) * Prepare the points from WebGUI into Google Map GMarkers */ WebGUI.Map.preparePoints -= function ( map, mgr, mapUrl, points ) { += function ( map, mgr, points ) { + WebGUI.Map.markers[map.assetId] = {}; + // Transform points into markers var markers = []; for ( var i = 0; i < points.length; i++ ) (function(i){ // Create closure for callbacks @@ -186,6 +200,7 @@ WebGUI.Map.preparePoints draggable: point.canEdit } ); marker.assetId = point.assetId; + marker.title = point.title; marker.map = map; // Create info window @@ -201,7 +216,7 @@ WebGUI.Map.preparePoints editButton.type = "button"; editButton.value = "Edit"; // Replace with i18n GEvent.addDomListener( editButton, "click", function () { - WebGUI.Map.editPoint( map, mgr, mapUrl, marker ); + WebGUI.Map.editPoint( map, mgr, marker ); } ); divButton.appendChild( editButton ); @@ -210,19 +225,19 @@ WebGUI.Map.preparePoints deleteButton.value = "Delete"; // Replace with i18n GEvent.addDomListener( deleteButton, "click", function () { if ( confirm("Are you sure you want to delete this point?") ) { - WebGUI.Map.deletePoint( map, mgr, mapUrl, marker ); + WebGUI.Map.deletePoint( map, mgr, marker ); } } ); divButton.appendChild( deleteButton ); infoWin.appendChild( divButton ); GEvent.addListener( marker, "dragend", function (latlng) { - WebGUI.Map.setPointLocation( marker, latlng, mapUrl ); + WebGUI.Map.setPointLocation( marker, latlng ); } ); } // Keep info - WebGUI.Map.markers[point.assetId] = marker; + WebGUI.Map.markers[map.assetId][point.assetId] = marker; marker.bindInfoWindow( infoWin ); @@ -254,12 +269,12 @@ WebGUI.Map.setCenter }; /** - * WebGUI.Map.setPointLocation( marker, latlng, mapUrl, assetId ) + * WebGUI.Map.setPointLocation( marker, latlng ) * Update the point's location in the database. */ WebGUI.Map.setPointLocation -= function ( marker, latlng, mapUrl, assetId ) { - var url = mapUrl + '?func=ajaxSetPointLocation' += function ( marker, latlng ) { + var url = marker.map.url + '?func=ajaxSetPointLocation' + ';assetId=' + marker.assetId + ';latitude=' + latlng.lat() + ';longitude=' + latlng.lng() @@ -294,3 +309,38 @@ WebGUI.Map.showLoading WebGUI.Map.loadingDialog.show(); }; + + +WebGUI.Map.updateSelectPoint += function (map) { + var select = document.getElementById( 'selectPoint_' + map.assetId ); + if ( !select) { + return; + } + + // Clear old points + while ( select.options.length > 1 ) { + select.length = 1; + } + + var markers = WebGUI.Map.markers[map.assetId]; + var sorted = []; + for ( var pointId in markers ) { + sorted.push( pointId ); + } + + sorted.sort( function (a,b) { + var ma = WebGUI.Map.markers[map.assetId][a]; + var mb = WebGUI.Map.markers[map.assetId][b]; + + if ( ma.title > mb.title ) { return 1; } + else if ( ma.title < mb.title ) { return -1; } + else { return 0; } + } ); + + // Add new points + for ( var i = 0; i < sorted.length; i++ ) { + select.options[ select.options.length ] + = new Option( markers[sorted[i]].title, sorted[i] ); + } +}; From 9f9c1ab2772797d16ed89fcb7ffad3c4c5a0183c Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 27 Oct 2009 01:04:08 -0500 Subject: [PATCH 05/29] moved package to correct place --- .../home_map_map-templates_default-map-view.wgpkg | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/upgrades/{packages-7.7.23 => packages-7.8.3}/home_map_map-templates_default-map-view.wgpkg (100%) diff --git a/docs/upgrades/packages-7.7.23/home_map_map-templates_default-map-view.wgpkg b/docs/upgrades/packages-7.8.3/home_map_map-templates_default-map-view.wgpkg similarity index 100% rename from docs/upgrades/packages-7.7.23/home_map_map-templates_default-map-view.wgpkg rename to docs/upgrades/packages-7.8.3/home_map_map-templates_default-map-view.wgpkg From 9a17cfe0cd113ba6bf935cbac8bea22a460d82d5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 10:12:35 -0700 Subject: [PATCH 06/29] Fix bad index variables in the CS. Fixes bug #11172. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Collaboration.pm | 8 +-- .../Wobject/Collaboration/templateVariables.t | 53 +++++++++++++++++-- 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 0982410e2..6166b33c0 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -15,6 +15,7 @@ - fixed #11168: Points do not work with uncommitted Map - fixed #10888: Add Point... how do I enter details? - fixed #10887: Map Point dropdown doesn't update + - fixed #11172: Collaboration broken vars: isSecond, isThird etc. 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 795307fb3..9dc044d6a 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -166,10 +166,10 @@ sub appendPostListTemplateVars { "user.isVisitor" => $post->get("ownerUserId") eq "1", "edit.url" => $post->getEditUrl, 'controls' => $controls, - "isSecond" => (($i+1)%2==0), - "isThird" => (($i+1)%3==0), - "isFourth" => (($i+1)%4==0), - "isFifth" => (($i+1)%5==0), + "isSecond" => (($i+1) == 2), + "isThird" => (($i+1) == 3), + "isFourth" => (($i+1) == 4), + "isFifth" => (($i+1) == 5), "user.hasRead" => $hasRead, "user.isPoster" => $post->isPoster, "avatar.url" => $post->getAvatarUrl, diff --git a/t/Asset/Wobject/Collaboration/templateVariables.t b/t/Asset/Wobject/Collaboration/templateVariables.t index c71790d45..a1065306a 100644 --- a/t/Asset/Wobject/Collaboration/templateVariables.t +++ b/t/Asset/Wobject/Collaboration/templateVariables.t @@ -24,12 +24,12 @@ use WebGUI::Session; #---------------------------------------------------------------------------- # Tests -plan tests => 20; # Increment this number for each test you create +plan tests => 21; # Increment this number for each test you create #---------------------------------------------------------------------------- # Init my $session = WebGUI::Test->session; -my @addChildArgs = ( {skipAutoCommitWorkflows=>1} ); +my @addChildArgs = ( {skipAutoCommitWorkflows=>1, skipNotification => 1, } ); my $collab = WebGUI::Asset->getImportNode( $session )->addChild({ className => 'WebGUI::Asset::Wobject::Collaboration', threadsPerPage => 20, @@ -54,7 +54,7 @@ my @threads = ( $_->setSkipNotification for @threads; # 100+ messages later... my $versionTag = WebGUI::VersionTag->getWorking( $session ); $versionTag->commit; -WebGUI::Test->tagsToRollback($versionTag); +addToCleanup($versionTag); my $templateVars; my $posts; @@ -89,4 +89,51 @@ ok( !$posts->[0]->{'user.isVisitor'}, 'first post made by visitor'); ok( $posts->[0]->{'hideProfileUrl'}, 'hide profile url, and user is visitor'); ok( !$posts->[0]->{'lastReply.user.isVisitor'}, 'lastReply not made by visitor'); ok( $posts->[0]->{'lastReply.hideProfileUrl'}, 'lastReply hide profile url, since user is visitor'); + + +################################################################### +# +#isSecond, isThird, etc. +# +################################################################### + +my @newThreads = (); +foreach my $index (1 .. 5) { + $newThreads[$index] = $collab->addChild( { + className => 'WebGUI::Asset::Post::Thread', + title => "X - Bar", + isSticky => 0, + ownerUserId => 3, + }, undef, 2+$index, @addChildArgs); + $newThreads[$index]->setSkipNotification; +} +my $vt2 = WebGUI::VersionTag->getWorking($session); +$vt2->commit; +addToCleanup($versionTag); + +$session->user({userId => 3}); +$templateVars = $collab->getViewTemplateVars(); +my $indexVars; +foreach my $post (@{ $templateVars->{post_loop }}) { + push @{$indexVars}, { + isSecond => $post->{isSecond} ? 1 : 0, + isThird => $post->{isThird} ? 1 : 0, + isFourth => $post->{isFourth} ? 1 : 0, + isFifth => $post->{isFifth} ? 1 : 0, + }; +} + +cmp_deeply( + $indexVars, + [ + { isSecond => 0, isThird => 0, isFourth => 0, isFifth => 0, }, + { isSecond => 1, isThird => 0, isFourth => 0, isFifth => 0, }, + { isSecond => 0, isThird => 1, isFourth => 0, isFifth => 0, }, + { isSecond => 0, isThird => 0, isFourth => 1, isFifth => 0, }, + { isSecond => 0, isThird => 0, isFourth => 0, isFifth => 1, }, + { isSecond => 0, isThird => 0, isFourth => 0, isFifth => 0, }, ##No modulo + { isSecond => 0, isThird => 0, isFourth => 0, isFifth => 0, }, ##No modulo + ], + 'checking isSecond, isThird, isFourth, isFifth' +); #vim:ft=perl From ed7babf69e88aeb53d61b1900fa8916ceee41817 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 12:10:26 -0700 Subject: [PATCH 07/29] Add missing i18n for Map Asset. --- lib/WebGUI/i18n/English/Asset_Map.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/WebGUI/i18n/English/Asset_Map.pm b/lib/WebGUI/i18n/English/Asset_Map.pm index cf16d29f9..4704ffaea 100644 --- a/lib/WebGUI/i18n/English/Asset_Map.pm +++ b/lib/WebGUI/i18n/English/Asset_Map.pm @@ -163,6 +163,11 @@ our $I18N = { lastUpdated => 0, context => 'Success message', }, + 'select a point' => { + message => "Select a point", + lastUpdated => 0, + context => "Choose from the list of points that existon the map", + }, 'assetName' => { message => "Map", lastUpdated => 0, From 8d45d94e869327eb2b47d387f5ec2a122d5697c1 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 13:36:06 -0700 Subject: [PATCH 08/29] Use the API for adding settings. --- docs/upgrades/upgrade_7.8.2-7.8.3.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/upgrades/upgrade_7.8.2-7.8.3.pl b/docs/upgrades/upgrade_7.8.2-7.8.3.pl index 333f05564..b8a07d6b4 100644 --- a/docs/upgrades/upgrade_7.8.2-7.8.3.pl +++ b/docs/upgrades/upgrade_7.8.2-7.8.3.pl @@ -60,7 +60,7 @@ sub reKeyTemplateAttachments { sub addSelectPaymentGatewayTemplateToSettings { my $session = shift; print "\tAdding select payment gateway template to settings... " unless $quiet; - $session->db->write("insert into settings values ('selectGatewayTemplateId', '2GxjjkRuRkdUg_PccRPjpA');"); + $session->setting->add('selectGatewayTemplateId', '2GxjjkRuRkdUg_PccRPjpA') unless $session->setting->has('selectGatewayTemplateId'); print "Done.\n" unless $quiet; } From edcbd95250a6107f640512c611cde0bd14cc8314 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 13:49:13 -0700 Subject: [PATCH 09/29] Have getIsa throw exceptions, instead of croaking. --- lib/WebGUI/Asset.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index f687aba1e..4ab569fda 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1263,7 +1263,11 @@ sub getIsa { $sth->finish; return undef; } - return WebGUI::Asset->newPending($session, $assetId); + my $asset = WebGUI::Asset->newByDynamicClass($session, $assetId); + if (!$asset) { + WebGUI::Error::ObjectNotFound->throw(id => $assetId); + } + return $asset; }; } From 697353558c117ae3f93d758f9ac019b86ad3450c Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 15:11:42 -0700 Subject: [PATCH 10/29] Fix JS i18n issues with IE7 and the datepicker. Fixes bug #11165 --- docs/changelog/7.x.x.txt | 1 + www/extras/yui-webgui/build/datepicker/datepicker.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6166b33c0..90ea11aa8 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -16,6 +16,7 @@ - fixed #10888: Add Point... how do I enter details? - fixed #10887: Map Point dropdown doesn't update - fixed #11172: Collaboration broken vars: isSecond, isThird etc. + - fixed #11165: DatePicker broken in IE7 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/www/extras/yui-webgui/build/datepicker/datepicker.js b/www/extras/yui-webgui/build/datepicker/datepicker.js index b9d03578f..4059244ec 100644 --- a/www/extras/yui-webgui/build/datepicker/datepicker.js +++ b/www/extras/yui-webgui/build/datepicker/datepicker.js @@ -130,11 +130,11 @@ YAHOO.WebGUI.Form.DatePicker = { ], NAVIGATOR: { strings : { - 'submit' : YAHOO.WebGUI.Form.DatePicker.i18n.get('WebGUI', 'submit'), - 'cancel' : YAHOO.WebGUI.Form.DatePicker.i18n.get('WebGUI', 'cancel'), - 'month' : YAHOO.WebGUI.Form.DatePicker.i18n.get('DateTime', 'Month'), - 'year' : YAHOO.WebGUI.Form.DatePicker.i18n.get('DateTime', 'Year'), - 'invalid year' : YAHOO.WebGUI.Form.DatePicker.i18n.get('Form_Date', 'Invalid year') + 'submit' : YAHOO.WebGUI.Form.DatePicker.i18n.get('WebGUI', 'submit'), + 'cancel' : YAHOO.WebGUI.Form.DatePicker.i18n.get('WebGUI', 'cancel'), + 'month' : YAHOO.WebGUI.Form.DatePicker.i18n.get('DateTime', 'Month'), + 'year' : YAHOO.WebGUI.Form.DatePicker.i18n.get('DateTime', 'Year'), + 'invalidYear' : YAHOO.WebGUI.Form.DatePicker.i18n.get('Form_Date', 'Invalid year') } } }; From 16e482f1d2915b093779fe89d4861b4e2279ec81 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 19:15:26 -0700 Subject: [PATCH 11/29] Remove diags, and fix counts for mail tests. --- t/Mail/Send.t | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/t/Mail/Send.t b/t/Mail/Send.t index 1c3a5773d..3e91f7444 100644 --- a/t/Mail/Send.t +++ b/t/Mail/Send.t @@ -122,9 +122,7 @@ $mail = WebGUI::Mail::Send->create( $session, { }); $mail->addHeaderField('List-ID', "H\x{00C4}ufige Fragen"); my $messageId = $mail->queue; -diag $messageId; my $dbMail = WebGUI::Mail::Send->retrieve($session, $messageId); -diag ref $dbMail; is($dbMail->getMimeEntity->head->get('List-ID'), "=?UTF-8?Q?H=C3=84ufige=20Fragen?=\n", 'addHeaderField: handles utf-8 correctly'); # TODO: Test that addHtml creates a body with the right content type @@ -337,7 +335,7 @@ $mail->send; is(scalar @mailIds, $startingMessages+2, 'sending a message with a group added two messages'); @mailIds = $session->db->buildArray("select messageId from mailQueue where message like ?",['%Mail::Send test message%']); -is(scalar @mailIds, $startingMessages+2, 'sending a message with a group added the right two messages'); +is(scalar @mailIds, 2, 'sending a message with a group added the right two messages'); my @emailAddresses = (); foreach my $mailId (@mailIds) { From 2c3904a800bfeb7fc41b5043ab51f6f3945a9976 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 19:29:47 -0700 Subject: [PATCH 12/29] Fix incorrect POD. --- lib/WebGUI/Macro/DeactivateAccount.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/WebGUI/Macro/DeactivateAccount.pm b/lib/WebGUI/Macro/DeactivateAccount.pm index 16fd7e00f..4f57b463f 100644 --- a/lib/WebGUI/Macro/DeactivateAccount.pm +++ b/lib/WebGUI/Macro/DeactivateAccount.pm @@ -34,7 +34,7 @@ The text displayed to the user for this link. If this is blank an international =head3 linkonly -The url for a template from the Macro/DeactivateAccount namespace to use for formatting the link. +If true, it will return only the URL for deactivating a user account. =cut From c22c5ef3f762adc46e830aa11baad58538af8ec5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Oct 2009 19:30:09 -0700 Subject: [PATCH 13/29] Test maintenance on Macro tests. --- t/Macro/AdminBar.t | 22 ++-------------------- t/Macro/AdminText.t | 14 ++------------ t/Macro/AdminToggle.t | 23 +++++------------------ t/Macro/At_username.t | 11 ++--------- t/Macro/CanEditText.t | 17 +++-------------- t/Macro/a_account.t | 23 ++++------------------- 6 files changed, 18 insertions(+), 92 deletions(-) diff --git a/t/Macro/AdminBar.t b/t/Macro/AdminBar.t index 2e844e210..9f82f421f 100644 --- a/t/Macro/AdminBar.t +++ b/t/Macro/AdminBar.t @@ -14,26 +14,14 @@ use lib "$FindBin::Bin/../lib"; use WebGUI::Test; use WebGUI::Session; +use WebGUI::Macro::AdminBar; use HTML::TokeParser; use Test::More; # increment this value for each test you create my $session = WebGUI::Test->session; -my $numTests = 2; - -$numTests += 1; #For the use_ok - -plan tests => $numTests; - -my $macro = 'WebGUI::Macro::AdminBar'; -my $loaded = use_ok($macro); - -my $originalAssets = $session->config->get('assets'); - -SKIP: { - -skip "Unable to load $macro", $numTests-1 unless $loaded; +plan tests => 2; my $output; $output = WebGUI::Macro::AdminBar::process($session); @@ -42,9 +30,3 @@ $session->var->switchAdminOn; $output = WebGUI::Macro::AdminBar::process($session); ok($output, 'AdminBar returns something when admin is on'); - -} - -END: { - $session->config->set('assets', $originalAssets); -} diff --git a/t/Macro/AdminText.t b/t/Macro/AdminText.t index 2b4c6ee74..e3616ccdb 100644 --- a/t/Macro/AdminText.t +++ b/t/Macro/AdminText.t @@ -14,22 +14,14 @@ use lib "$FindBin::Bin/../lib"; use WebGUI::Test; use WebGUI::Session; +use WebGUI::Macro::AdminText; use Data::Dumper; my $session = WebGUI::Test->session; use Test::More; # increment this value for each test you create -my $numTests = 6 + 1; - -plan tests => $numTests; - -my $macro = 'WebGUI::Macro::AdminText'; -my $loaded = use_ok($macro); - -SKIP: { - -skip "Unable to load $macro", $numTests-1 unless $loaded; +plan tests => 6; my $output; @@ -54,5 +46,3 @@ is($output, undef, 'undef text'); $session->var->switchAdminOff; $output = WebGUI::Macro::AdminText::process($session, 'admin'); is($output, '', 'user is admin, not in admin mode'); - -} diff --git a/t/Macro/AdminToggle.t b/t/Macro/AdminToggle.t index 80435a523..3fa875a03 100644 --- a/t/Macro/AdminToggle.t +++ b/t/Macro/AdminToggle.t @@ -16,12 +16,13 @@ use WebGUI::Test; use WebGUI::Session; use HTML::TokeParser; use Data::Dumper; +use WebGUI::Macro::AdminToggle; use Test::More; # increment this value for each test you create my $session = WebGUI::Test->session; -my ($versionTag, $template) = addTemplate(); +my $template = addTemplate(); my $homeAsset = WebGUI::Asset->getDefault($session); $session->asset($homeAsset); @@ -105,14 +106,7 @@ foreach my $testSet (@testSets) { $numTests += 1 + (ref $testSet->{output} eq 'CODE'); } -plan tests => $numTests + 2; ##conditional module load and TODO at end - -my $macro = 'WebGUI::Macro::AdminToggle'; -my $loaded = use_ok($macro); - -SKIP: { - -skip "Unable to load $macro", $numTests-1 unless $loaded; +plan tests => $numTests + 1; ##conditional module load and TODO at end foreach my $testSet (@testSets) { $session->user({userId=>$testSet->{userId}}); @@ -136,8 +130,6 @@ foreach my $testSet (@testSets) { } } -} - TODO: { local $TODO = 'Tests to make later'; ok(0, 'Run tests with a user other than Admin'); @@ -159,7 +151,8 @@ sub addTemplate { }; my $template = $importNode->addChild($properties, $properties->{id}); $versionTag->commit; - return ($versionTag, $template); + addToCleanup($versionTag); + return $template; } sub simpleHTMLParser { @@ -181,9 +174,3 @@ sub simpleTextParser { return ($url, $label); } - -END { - if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') { - $versionTag->rollback; - } -} diff --git a/t/Macro/At_username.t b/t/Macro/At_username.t index 9e7135a7f..cb81b9cad 100644 --- a/t/Macro/At_username.t +++ b/t/Macro/At_username.t @@ -14,23 +14,17 @@ use lib "$FindBin::Bin/../lib"; use WebGUI::Test; use WebGUI::Session; +use WebGUI::Macro::At_username; use Data::Dumper; my $session = WebGUI::Test->session; use Test::More; # increment this value for each test you create -my $numTests = 2 + 1; # For conditional load and skip +my $numTests = 2; # For conditional load and skip plan tests => $numTests; -my $macro = 'WebGUI::Macro::At_username'; -my $loaded = use_ok($macro); - -SKIP: { - -skip "Unable to load $macro", $numTests-1 unless $loaded; - my $output; $session->user({userId => 1}); @@ -41,4 +35,3 @@ $session->user({userId => 3}); $output = WebGUI::Macro::At_username::process($session); is($output, 'Admin', 'username = Admin'); -} diff --git a/t/Macro/CanEditText.t b/t/Macro/CanEditText.t index c6007a2b6..a0af7a479 100644 --- a/t/Macro/CanEditText.t +++ b/t/Macro/CanEditText.t @@ -21,7 +21,7 @@ my $session = WebGUI::Test->session; use Test::More; # increment this value for each test you create my $homeAsset = WebGUI::Asset->getDefault($session); -my ($versionTag, $asset, $group, @users) = setupTest($session, $homeAsset); +my ($asset, $group, @users) = setupTest($session, $homeAsset); my @testSets = ( { @@ -111,17 +111,6 @@ sub setupTest { $users[1]->addToGroups([$cm->getId]); ##User 2 is a member of a content manager sub-group $users[2]->addToGroups([$editGroup->getId]); - return ($versionTag, $asset, $editGroup, @users); -} - -END { ##Clean-up after yourself, always - if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') { - $versionTag->rollback; - } - foreach my $testGroup ($group) { - $testGroup->delete if (defined $testGroup and ref $testGroup eq 'WebGUI::Group'); - } - foreach my $dude (@users) { - $dude->delete if (defined $dude and ref $dude eq 'WebGUI::User'); - } + addToCleanup($versionTag, $editGroup, @users); + return ($asset, $editGroup, @users); } diff --git a/t/Macro/a_account.t b/t/Macro/a_account.t index f46bc8f68..772948e6f 100644 --- a/t/Macro/a_account.t +++ b/t/Macro/a_account.t @@ -16,13 +16,14 @@ use WebGUI::Test; use WebGUI::Session; use HTML::TokeParser; use Data::Dumper; +use WebGUI::Macro::a_account; use Test::More; # increment this value for each test you create my $session = WebGUI::Test->session; # -my ($versionTag, $template) = addTemplate(); +my $template = addTemplate(); my $homeAsset = WebGUI::Asset->getDefault($session); @@ -65,17 +66,8 @@ foreach my $testSet (@testSets) { $numTests += 1 + (ref $testSet->{output} eq 'CODE'); } -$numTests += 1; #For the use_ok - plan tests => $numTests; -my $macro = 'WebGUI::Macro::a_account'; -my $loaded = use_ok($macro); - -SKIP: { - -skip "Unable to load $macro", $numTests-1 unless $loaded; - foreach my $testSet (@testSets) { my $output = WebGUI::Macro::a_account::process( $session, $testSet->{label}, $testSet->{template} ); @@ -90,8 +82,6 @@ foreach my $testSet (@testSets) { } } -} - sub addTemplate { $session->user({userId=>3}); my $importNode = WebGUI::Asset->getImportNode($session); @@ -108,7 +98,8 @@ sub addTemplate { }; my $template = $importNode->addChild($properties, $properties->{id}); $versionTag->commit; - return ($versionTag, $template); + addToCleanup($versionTag); + return $template; } sub simpleHTMLParser { @@ -130,9 +121,3 @@ sub simpleTextParser { return ($url, $label); } - -END { - if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') { - $versionTag->rollback; - } -} From c472e0c4b8aa90c67ef688ec5c8d5dfdaf314af1 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 28 Oct 2009 10:22:43 -0500 Subject: [PATCH 14/29] add clipboard admin setting --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.8.2-7.8.3.pl | 10 +++++++ lib/WebGUI/AssetClipboard.pm | 39 +++++++++++++++++----------- lib/WebGUI/Operation/Settings.pm | 1 + lib/WebGUI/i18n/English/WebGUI.pm | 9 +++++++ 5 files changed, 45 insertions(+), 15 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 90ea11aa8..d70cf6d32 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -17,6 +17,7 @@ - fixed #10887: Map Point dropdown doesn't update - fixed #11172: Collaboration broken vars: isSecond, isThird etc. - fixed #11165: DatePicker broken in IE7 + - added: Manage System Clipboard group setting 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/docs/upgrades/upgrade_7.8.2-7.8.3.pl b/docs/upgrades/upgrade_7.8.2-7.8.3.pl index b8a07d6b4..7f958dc3a 100644 --- a/docs/upgrades/upgrade_7.8.2-7.8.3.pl +++ b/docs/upgrades/upgrade_7.8.2-7.8.3.pl @@ -33,8 +33,18 @@ my $session = start(); # this line required # upgrade functions go here reKeyTemplateAttachments($session); addSelectPaymentGatewayTemplateToSettings($session); +addClipboardAdminSetting($session); + finish($session); # this line required +#---------------------------------------------------------------------------- +sub addClipboardAdminSetting { + my $session = shift; + print "\tAdding clipboard admin setting... " unless $quiet; + $session->setting->add('groupIdAdminClipboard', 3); + print "Done.\n" unless $quiet; +} + #---------------------------------------------------------------------------- # Describe what our function does diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm index 5ff01f5ca..35943f19c 100644 --- a/lib/WebGUI/AssetClipboard.pm +++ b/lib/WebGUI/AssetClipboard.pm @@ -444,7 +444,7 @@ sub www_emptyClipboard { my $self = shift; my $ac = WebGUI::AdminConsole->new($self->session,"clipboard"); return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(4)); - foreach my $asset (@{$self->getAssetsInClipboard(!($self->session->form->process("systemClipboard") && $self->session->user->isAdmin))}) { + foreach my $asset (@{$self->getAssetsInClipboard(!($self->session->form->process("systemClipboard") && $self->session->user->isInGroup($self->session->setting->get('groupIdAdminClipboard'))))}) { $asset->trash; } return $self->www_manageClipboard(); @@ -464,20 +464,29 @@ sub www_manageClipboard { my $ac = WebGUI::AdminConsole->new($self->session,"clipboard"); return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(12)); my $i18n = WebGUI::International->new($self->session, "Asset"); - my ($header,$limit); - if ($self->session->form->process("systemClipboard") && $self->session->user->isAdmin) { - $header = $i18n->get(966); - $ac->addSubmenuItem($self->getUrl('func=manageClipboard'), $i18n->get(949)); - $ac->addSubmenuItem($self->getUrl('func=emptyClipboard;systemClipboard=1'), $i18n->get(959), - 'onclick="return window.confirm(\''.$i18n->get(951,"WebGUI").'\')"',"Asset"); - } else { - $ac->addSubmenuItem($self->getUrl('func=manageClipboard;systemClipboard=1'), $i18n->get(954)); - $ac->addSubmenuItem($self->getUrl('func=emptyClipboard'), $i18n->get(950), - 'onclick="return window.confirm(\''.$i18n->get(951,"WebGUI").'\')"',"Asset"); - $limit = 1; - } -$self->session->style->setLink($self->session->url->extras('assetManager/assetManager.css'), {rel=>"stylesheet",type=>"text/css"}); - $self->session->style->setScript($self->session->url->extras('assetManager/assetManager.js'), {type=>"text/javascript"}); + + my $header; + my $limit = 1; + + my $canAdmin = $self->session->user->isInGroup($self->session->setting->get('groupIdAdminClipboard')); + if ($self->session->form->process("systemClipboard") && $canAdmin) { + $header = $i18n->get(966); + $ac->addSubmenuItem($self->getUrl('func=manageClipboard'), $i18n->get(949)); + $ac->addSubmenuItem($self->getUrl('func=emptyClipboard;systemClipboard=1'), $i18n->get(959), + 'onclick="return window.confirm(\''.$i18n->get(951,"WebGUI").'\')"',"Asset"); + $limit = undef; + } + elsif ( $canAdmin ) { + $ac->addSubmenuItem($self->getUrl('func=manageClipboard;systemClipboard=1'), $i18n->get(954)); + $ac->addSubmenuItem($self->getUrl('func=emptyClipboard'), $i18n->get(950), + 'onclick="return window.confirm(\''.$i18n->get(951,"WebGUI").'\')"',"Asset"); + } + else { + $ac->addSubmenuItem($self->getUrl('func=emptyClipboard'), $i18n->get(950), + 'onclick="return window.confirm(\''.$i18n->get(951,"WebGUI").'\')"',"Asset"); + } + $self->session->style->setLink($self->session->url->extras('assetManager/assetManager.css'), {rel=>"stylesheet",type=>"text/css"}); + $self->session->style->setScript($self->session->url->extras('assetManager/assetManager.js'), {type=>"text/javascript"}); my $output = "