Changeset 22756
- Timestamp:
- 07/01/09 12:18:09 (9 months ago)
- Files:
-
- branches/ragnaroek/midcom/org.maemo.packages/config/mgdschema.xml (modified) (1 diff)
- branches/ragnaroek/midcom/org.maemo.packages/config/schemadb_repository_default.inc (modified) (1 diff)
- branches/ragnaroek/midcom/org.maemo.packages/handler/repository/queue.php (modified) (2 diffs)
- branches/ragnaroek/midcom/org.maemo.packages/style/package_instance_view.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ragnaroek/midcom/org.maemo.packages/config/mgdschema.xml
r22692 r22756 46 46 <description>The repository where packages get promoted to.</description> 47 47 </property> 48 <property name="promotiondirect" type="bool"> 49 <description>Does this repository have a direct promotion?</description> 50 </property> 51 <property name="qascore" type="integer"> 52 <description>Required QA score before promotion will be unlocked.</description> 53 </property> 48 54 </type> 49 55 branches/ragnaroek/midcom/org.maemo.packages/config/schemadb_repository_default.inc
r22692 r22756 210 210 ), 211 211 ), 212 ), ), 212 ), 213 'promotiondirect' => Array 214 ( 215 'title' => 'Does this repository have a direct promotion?', 216 'storage' => 'promotiondirect', 217 'required' => false, 218 'type' => 'boolean', 219 'widget' => 'checkbox', 220 ), 221 'qascore' => Array 222 ( 223 'title' => 'Required QA score before promotion will be unlocked.(0 = disable)', 224 'storage' => 'qascore', 225 'required' => false, 226 'type' => 'text', 227 'widget' => 'text', 228 ), 229 230 ), 213 231 ), 214 232 branches/ragnaroek/midcom/org.maemo.packages/handler/repository/queue.php
r22733 r22756 159 159 160 160 //TODO: Check if the package meets the promotion criteria 161 161 if ($repository[0]->qascore > 0) 162 { 163 $qb = net_nemein_favourites_favourite_dba::new_query_builder(); 164 $qb->add_constraint('objectGuid', '=', $package_instance[0]->guid); 165 $favourites = $qb->execute(); 166 if ($favourites) 167 { 168 $favourites_count = count($favourites); 169 $count_bury = 0; 170 foreach ($favourites as $favourite) 171 { 172 if ($favourite->bury == 1) 173 { 174 ++$count_bury; 175 } 176 } 177 } 178 else 179 { 180 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 181 'No karma found for package, while '.$repository[0]->qascore.' is required.'); 182 } 183 184 $score = $favourites_count - $count_bury; 185 186 if ($score < $repository[0]->qascore) 187 { 188 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 189 'Package has only ' . $score . ' karma, while '.$repository[0]->qascore.' is required.'); 190 } 191 } 162 192 // Check if all dependencies are available in the repository 163 193 … … 210 240 } 211 241 212 if (!$version_compatible 242 /* 243 if (!$version_compatible 213 244 && $found) 214 245 { 215 246 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 216 247 'Package ' . $temp_package[0]->name . ' ' . $return_packageinstance[0]->version . ' is not ' . $temp_depends[1] . ' ' . $temp_depends[2] . '.'); 217 } 248 } */ 218 249 219 250 if (!$found) branches/ragnaroek/midcom/org.maemo.packages/style/package_instance_view.php
r22733 r22756 4 4 $package_instance_object = $data['package_instance']; 5 5 $package = $data['view_package']; 6 $package_object = $data['package']; 6 7 $repository = $data['view_repository']; 7 8 $repository_object = $data['repository_object']; … … 108 109 $loc = split("/",$package_instance["location"]); 109 110 111 if ( $repository_object->promotionallowed 112 && isset($repository_object->promotiontarget)) 113 { 114 $qb = org_maemo_packages_repository_dba::new_query_builder(); 115 $qb->add_constraint('guid', '=', str_replace("|","",trim($repository_object->promotiontarget))); 116 $qb->set_limit(1); 117 $target_repository = $qb->execute(); 118 119 $qb = org_maemo_packages_packageinstance_dba::new_query_builder(); 120 $qb->add_constraint('repository', '=', $target_repository[0]->id); 121 $qb->add_constraint('package', '=', $package_object->id); 122 $qb->add_constraint('version', '=', $package_instance_object->version); 123 $qb->set_limit(1); 124 $target_package_count = $qb->count_unchecked(); 125 } 126 127 $package_score = 0; 128 110 129 ?> 111 130 <h1><?php echo $package["title"] . ' ' . $package_instance["version"]; ?></h1> … … 126 145 <div class="authors"><div class="at">Maintainters:</div><div class="att"><?php echo $author_string; ?></div></div> 127 146 128 <div class="depends"><div class="dt">Depends:</div><div class="dtt"><?php echo $depends_string; ?></div></div> 147 <div class="depends"><div class="dt">Depends:</div><div class="dtt"><?php echo $depends_string; ?></div> 148 <?php 149 if ($depends_missing) 150 { 151 echo '<div class="warning">Warning: This package has missing dependencies!</div>'; 152 } 153 ?> 154 </div> 155 129 156 130 157 <div class="size"><div class="st">Size:</div><div class="stt"><?php echo $package_instance["size"]; ?></div></div> … … 133 160 <div class="status"><div class="st">Status:</div><div class="stt"><?php echo $package_instance["status"]; ?></div></div> 134 161 135 <?php162 <?php 136 163 if ( $data['favourites_url'] != '' 137 && $repository_object->promotionallowed == true) 164 && $repository_object->promotionallowed == true 165 && $repository_object->qascore > 0) 138 166 { 139 ?> 167 //FIXME: Add own gif 168 $empty_gif_url = MIDCOM_STATIC_URL . '/org.maemo.brainstorm/empty.gif'; 169 170 $slider_max_with = 90; 171 $slider_fav = $slider_max_with; 172 $slider_bury = 0; 173 174 $qb = net_nemein_favourites_favourite_dba::new_query_builder(); 175 $qb->add_constraint('objectGuid', '=', $package_instance_object->guid); 176 $favourites = $qb->execute(); 177 178 if (count($favourites) > 0) 179 { 180 $count_bury = 0; 181 $count_fav = 0; 182 $favourites_count = count($favourites); 183 foreach ($favourites as $favourite) 184 { 185 if ($favourite->bury == 1) 186 { 187 ++$count_bury; 188 } 189 } 190 191 $count_fav = $favourites_count - $count_bury; 192 193 $slider_tmp = $slider_max_with / ($count_fav + $count_bury); 194 $slider_bury = $slider_tmp * $count_bury; 195 $slider_bury = (int) $slider_bury; 196 $slider_fav = $slider_max_with - $slider_bury; 197 198 $package_score = $count_fav - $count_bury; 199 } 200 201 ?> 140 202 <div class="package_karma"> 141 203 <h3>Package karma</h3> 204 <div class="package_score"><?php echo $package_score. ' (needed for promotion: '.$repository_object->qascore.')'?></div> 205 206 <div class="package_score_slider"> 207 <div class="package_score_slider_fav"><img src="&(empty_gif_url);" height="4" width="&(slider_fav);" alt="*" /></div> 208 <div class="package_score_slider_bury"><img src="&(empty_gif_url);" height="4" width="&(slider_bury);" alt="-" /></div> 209 </div> 142 210 <div id="net_nemein_favourites_for_<?php echo $data["package_instance"]->guid; ?>" class='net_nemein_favourites <?php echo net_nemein_favourites_admin::get_json_data($data["package_instance"]->__mgdschema_class_name__, $data["package_instance"]->guid, '/' . $data['favourites_url']);?>'> 143 211 <div class="fav_btn"><span class="favs_count">0</span></div> … … 155 223 && !$depends_missing 156 224 && $package_instance_object->status != ORG_MAEMO_PACKAGES_PACKAGE_STATUS_PROMOTED 225 // package is not in target repository already 226 && $target_package_count == 0 227 //Direct promotion or if package meets QA based limit. 228 && ( $package_score >= $repository_object->qascore 229 || $repository_object->promotiondirect ) 157 230 // AND application is in testing 158 231 // AND (user is maintainer or repository admin)
