예제 #1
0
 /**
  * getSummaryPageContent
  *
  * Return the text to display on the summary page
  * @return arr[title], arr[content]
  */
 function getSummaryPageContent()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $user = UserManager::instance()->getCurrentUser();
     $ret = array('title' => $GLOBALS['Language']->getText('include_project_home', 'latest_file_releases'), 'content' => '');
     $packages = $this->_getPackagesForUser($user->getId());
     if (count($packages)) {
         $ret['content'] .= '
             <table cellspacing="1" cellpadding="5" width="100%" border="0">
                 <tr class="boxitem">
                     <td>
                         ' . $GLOBALS['Language']->getText('include_project_home', 'package') . '
                     </td>
                     <td>
                         ' . $GLOBALS['Language']->getText('include_project_home', 'version') . '
                     </td>
                     <td>
                         ' . $GLOBALS['Language']->getText('include_project_home', 'download') . '
                     </td>
                 </tr>
         ';
         require_once 'FileModuleMonitorFactory.class.php';
         $fmmf = new FileModuleMonitorFactory();
         foreach ($packages as $package) {
             // the icon is different whether the package is monitored or not
             if ($fmmf->isMonitoring($package['package_id'], $user, false)) {
                 $monitor_img = $GLOBALS['HTML']->getImage("ic/notification_stop.png", array('alt' => $GLOBALS['Language']->getText('include_project_home', 'stop_monitoring'), 'title' => $GLOBALS['Language']->getText('include_project_home', 'stop_monitoring')));
             } else {
                 $monitor_img = $GLOBALS['HTML']->getImage("ic/notification_start.png", array('alt' => $GLOBALS['Language']->getText('include_project_home', 'start_monitoring'), 'title' => $GLOBALS['Language']->getText('include_project_home', 'start_monitoring')));
             }
             $ret['content'] .= '
               <TR class="boxitem">
               <TD>
                 <B>' . $hp->purify(util_unconvert_htmlspecialchars($package['package_name']), CODENDI_PURIFIER_CONVERT_HTML) . '</B>&nbsp;
                 <a HREF="/file/filemodule_monitor.php?filemodule_id=' . $package['package_id'] . '&group_id=' . $this->getGroupId() . '">' . $monitor_img . '     
                 </a>
               </TD>';
             // Releases to display
             $ret['content'] .= '<TD>' . $hp->purify($package['release_name'], CODENDI_PURIFIER_CONVERT_HTML) . '&nbsp;<A href="/file/shownotes.php?group_id=' . $this->getGroupId() . '&release_id=' . $package['release_id'] . '">' . $GLOBALS['HTML']->getImage("ic/text.png", array('alt' => $GLOBALS['Language']->getText('include_project_home', 'release_notes'), 'title' => $GLOBALS['Language']->getText('include_project_home', 'release_notes'))) . ' 
               </TD>
               <TD><A HREF="/file/showfiles.php?group_id=' . $this->getGroupId() . '&release_id=' . $package['release_id'] . '">' . $GLOBALS['Language']->getText('include_project_home', 'download') . '</A></TD></TR>';
         }
         $ret['content'] .= '</table>';
     } else {
         $ret['content'] .= '<b>' . $GLOBALS['Language']->getText('include_project_home', 'no_files_released') . '</b>';
     }
     $ret['content'] .= '
         <div align="center">
             <a href="/file/showfiles.php?group_id=' . $this->getGroupId() . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_all_files') . ']</A>
         </div>
     ';
     return $ret;
 }
예제 #2
0
 print '<fieldset class="package">';
 print '<legend>';
 if (!$pv) {
     print '<a href="#" onclick="javascript:toggle_package(\'p_' . $package_id . '\'); return false;" /><img src="' . FRS_EXPANDED_ICON . '" id="img_p_' . $package_id . '" /></a>&nbsp;';
 }
 print " <{$emphasis}>" . $hp->purify(util_unconvert_htmlspecialchars($package->getName())) . "</{$emphasis}>";
 if (!$pv) {
     if ($frspf->userCanAdmin($user, $group_id)) {
         print '     <a href="admin/package.php?func=edit&amp;group_id=' . $group_id . '&amp;id=' . $package_id . '" title="' . $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML) . '">';
         print '       ' . $GLOBALS['HTML']->getImage('ic/edit.png', array('alt' => $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML), 'title' => $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML)));
         print '</a>';
         //print '     &nbsp;&nbsp;&nbsp;&nbsp;<a href="admin/package.php?func=delete&amp;group_id='. $group_id .'&amp;id=' . $package_id .'" title="'. htmlentities($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), ENT_QUOTES, 'UTF-8') .'" onclick="return confirm(\''. htmlentities($GLOBALS['Language']->getText('file_admin_editpackages', 'warn'), ENT_QUOTES, 'UTF-8') .'\');">'. $GLOBALS['HTML']->getImage('ic/trash.png') .'</a>';
     }
     print ' &nbsp; ';
     print '  <a href="filemodule_monitor.php?filemodule_id=' . $package_id . '&group_id=' . $group_id . '">';
     if ($fmmf->isMonitoring($package_id, $user, false)) {
         print '<img src="' . util_get_image_theme("ic/notification_stop.png") . '" alt="' . $Language->getText('file_showfiles', 'stop_monitoring') . '" title="' . $Language->getText('file_showfiles', 'stop_monitoring') . '" />';
     } else {
         print '<img src="' . util_get_image_theme("ic/notification_start.png") . '" alt="' . $Language->getText('file_showfiles', 'start_monitoring') . '" title="' . $Language->getText('file_showfiles', 'start_monitoring') . '" />';
     }
     print '</a>';
     if ($frspf->userCanAdmin($user, $group_id)) {
         print '     &nbsp;&nbsp;<a href="admin/package.php?func=delete&amp;group_id=' . $group_id . '&amp;id=' . $package_id . '" title="' . $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML) . '" onclick="return confirm(\'' . $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'warn'), CODENDI_PURIFIER_CONVERT_HTML) . '\');">' . $GLOBALS['HTML']->getImage('ic/trash.png', array('alt' => $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML), 'title' => $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML))) . '</a>';
     }
 }
 print '</legend>';
 if ($package->isHidden()) {
     //TODO i18n
     print '<div style="text-align:center"><em>' . $Language->getText('file_showfiles', 'hidden_package') . '</em></div>';
 }
 // get the releases of the package
예제 #3
0
if (user_isloggedin()) {
    /*
    	User obviously has to be logged in to monitor
    	a file module
    */
    $vFilemodule_id = new Valid_UInt('filemodule_id');
    $vFilemodule_id->required();
    if ($request->valid($vFilemodule_id)) {
        $filemodule_id = $request->get('filemodule_id');
        /*
        	First check to see if they are already monitoring
        	this thread. If they are, say so and quit.
        	If they are NOT, then insert a row into the db
        */
        $frsfmf = new FileModuleMonitorFactory();
        if (!$frsfmf->isMonitoring($filemodule_id)) {
            /*
            	User is not already monitoring this filemodule, so 
            	insert a row so monitoring can begin
            */
            $result = $frsfmf->setMonitor($filemodule_id);
            if (!$result) {
                $GLOBALS['Response']->addFeedback('error', $Language->getText('file_filemodule_monitor', 'insert_err'));
            } else {
                $GLOBALS['Response']->addFeedback('info', $Language->getText('file_filemodule_monitor', 'p_monitored'));
                $GLOBALS['Response']->addFeedback('info', $Language->getText('file_filemodule_monitor', 'now_emails'));
                $GLOBALS['Response']->addFeedback('info', $Language->getText('file_filemodule_monitor', 'turn_monitor_off'), CODENDI_PURIFIER_LIGHT);
            }
        } else {
            $result = $frsfmf->stopMonitor($filemodule_id);
            $GLOBALS['Response']->addFeedback('info', $Language->getText('file_filemodule_monitor', 'monitor_turned_off'));