Changeset 144


Ignore:
Timestamp:
Jan 27, 2007 9:36:42 PM (6 years ago)
Author:
dkg
Message:

JPDD: added overview by school for Phyllis, made m2medit default to "none" instead of blank, cleaned up js during new user signup.

Location:
trunk/jpdd
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/jpdd/class.dkg.row.php

    r139 r144  
    107107      if (count($nonpeers))  
    108108        $ret .= '<label>'.(count($peers) ? $add_title.'<br/>' : '' ).'<select name="add_'.$jointable.'[]"> 
    109 <option value=""></option> 
     109<option value="">None</option> 
    110110'.join("\n", array_map(create_function('$h', "return '<option value=\"'.\$h->getID().'\">'.\$h->getTitle().'</option>';"), $nonpeers)).' 
    111111</select></label> 
  • trunk/jpdd/class.jpdd.php

    r142 r144  
    4646 
    4747    function getNavLink($title,$targ) { 
    48       return '<a '.($this->_type == $targ ? 'class="current" ' : '').'href='.$this->Path($targ).'>'.$title.'</a>'; 
     48      return '<a '.(($this->_action == $targ || (in_array($this->_action, array('view', 'edit')) && $this->_type == $targ)) ? 'class="current" ' : '').'href='.$this->Path($targ).'>'.$title.'</a>'; 
    4949    } 
    5050 
     
    114114    } 
    115115 
     116    function getSchoolOverview() { 
     117      $sql = 'SELECT MAX(organization.title) AS title, organization.id, COUNT(*) AS registrations FROM audience LEFT JOIN affiliation ON (audience.person_id = affiliation.person_id) LEFT JOIN organization ON (affiliation.organization_id = organization.id) GROUP BY organization.id ORDER BY MAX(organization.title)'; 
     118      $os = $this->getSeriesFromSQL($sql); 
     119      return '<table><tr><th>school</th><th>signups</th></tr>'."\n<tbody>\n". 
     120        join('', array_map(create_function('$o', 'global $jpdd; return "<tr><td>".($jpdd->isEmpty($o["title"]) ? "unaffiliated" : "<a href=\"".$jpdd->Path("organization", $o["id"])."\">".htmlentities($o["title"])."</a>")."</td><td class=\"attendance\">".(int)$o["registrations"]."</td></tr>\n";'), $os)). 
     121        '</tbody></table>'."\n"; 
     122    } 
    116123 
    117124    function getWorkshopOverviewWithAttendence() { 
     
    193200        } 
    194201      } elseif ($this->_action = 'attendance') { 
    195         if ($this->isAuthenticated() && $this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) 
    196           return $this->getWorkshopOverviewWithAttendence(); 
    197         else 
     202        if ($this->isAuthenticated() && $this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) { 
     203          return $this->getOverview($this->_type); 
     204        } else { 
    198205          $this->permissionDenied('You are not authorized to view this overview.'); 
     206        } 
    199207      } 
    200208      return parent::getMainContentExtended(); 
    201209    } 
    202210 
     211    function getOverview($which) { 
     212      global $jpdd; 
     213      if ($jpdd->isEmpty($which)) 
     214        $which = 'workshop'; 
     215 
     216      $ret = '<div class="overviewnav">'; 
     217 
     218      // choice of administrator overviews: 
     219      $overviews = array('By Workshop' => 'workshop', 
     220                         'By School' => 'organization'); 
     221       
     222      reset($overviews); 
     223      while (list($t,$v) = each($overviews)) { 
     224        $ret .= '<a '.($which == $v ? 'class="current" ' : '').'href="'.$this->Path('attendance', $v).'">'.$t.'</a> '; 
     225      } 
     226      $ret .= '</div>'; 
     227 
     228      if ($which == 'workshop') { 
     229        $ret .= $this->getWorkshopOverviewWithAttendence(); 
     230      } elseif ($which == 'organization') { 
     231        $ret .= $this->getSchoolOverview(); 
     232      } 
     233      return $ret; 
     234    } 
    203235     
    204236 
     
    209241      $lasterr = (($_SERVER['REQUEST_METHOD'] == 'POST') && $this->isEmpty($_POST['last_name'])); 
    210242      $orgs = $this->getAll('organization'); 
    211       $this->addSourcedScript('scripts/dkg.base.js'); 
    212       $this->addScriptChunk('DKG.onLoadScripts.push(\'DKG.ShowOnValue("", "other", "org_title");\');'); 
     243      //      $this->addSourcedScript('scripts/dkg.base.js'); 
     244      //      $this->addScriptChunk('DKG.onLoadScripts.push(\'DKG.ShowOnValue("", "other", "org_title");\');'); 
    213245      $acct = $this->getItem('person', (int)$this->_identifier); 
    214246       
  • trunk/jpdd/class.jpdd.workshop.php

    r142 r144  
    143143      $x = $jpdd->getSeriesFromSQL($sql); 
    144144      // FIXME: link these schools! 
    145       return "<ul>\n".join('', array_map(create_function('$x', 'return "<li>".(int)$x["count"]." ".(is_null($x["title"]) ? "unaffiliated" : " from ".htmlentities($x["title"]));'), $x))."</ul>\n"; 
     145      return "<ul>\n".join('', array_map(create_function('$x', 'global $jpdd; return "<li>".(int)$x["count"]." ".(is_null($x["title"]) ? "unaffiliated" : " from <a href=\"".$jpdd->Path("organization", (int)$x["id"])."\">".htmlentities($x["title"])."</a>");'), $x))."</ul>\n"; 
    146146    } 
    147147 
  • trunk/jpdd/sql/basics.sql

    r117 r144  
    1313-- 
    1414 
    15 SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('category', 'id'), 14, true); 
     15SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('category', 'id'), 35, true); 
    1616 
    1717 
     
    343412      Social Studies  \N 
    353513      Technology      \N 
    36 14      Cooking  
     3615      Art      
     3716      Writing  
     3817      School Community         
     3918      Electives        
     4019      Differentiated Instruction       
     4120      Methodologies    
     4221      School Quality Reviews   
     4322      College Information      
     4423      Community Service        
     4524      Counseling, Discipline, Support  
     4625      English  
     4726      Discussion       
     4827      Consortium DYO   
     4928      Assessments      
     5029      Parents and Guardians    
     5130      Union    
     5231      Middle School    
    3753\. 
    3854 
  • trunk/jpdd/sql/db.sql

    r118 r144  
    5757 
    5858ALTER TABLE public.audience OWNER TO dkg; 
     59 
     60-- 
     61-- Name: organization; Type: TABLE; Schema: public; Owner: dkg; Tablespace:  
     62-- 
     63 
     64CREATE TABLE organization ( 
     65    id serial NOT NULL, 
     66    title character varying NOT NULL, 
     67    description text, 
     68    website character varying 
     69); 
     70 
     71 
     72ALTER TABLE public.organization OWNER TO dkg; 
     73 
     74-- 
     75-- Name: audience_by_organization; Type: VIEW; Schema: public; Owner: dkg 
     76-- 
     77 
     78CREATE VIEW audience_by_organization AS 
     79    SELECT affiliation.organization_id, count(*) AS count FROM ((audience LEFT JOIN affiliation ON ((audience.person_id = affiliation.person_id))) LEFT JOIN organization ON ((affiliation.organization_id = organization.id))) GROUP BY affiliation.organization_id; 
     80 
     81 
     82ALTER TABLE public.audience_by_organization OWNER TO dkg; 
    5983 
    6084-- 
     
    102126 
    103127ALTER TABLE public.mail_log OWNER TO dkg; 
    104  
    105 -- 
    106 -- Name: organization; Type: TABLE; Schema: public; Owner: dkg; Tablespace:  
    107 -- 
    108  
    109 CREATE TABLE organization ( 
    110     id serial NOT NULL, 
    111     title character varying NOT NULL, 
    112     description text, 
    113     website character varying 
    114 ); 
    115  
    116  
    117 ALTER TABLE public.organization OWNER TO dkg; 
    118128 
    119129-- 
     
    552562 
    553563-- 
     564-- Name: organization; Type: ACL; Schema: public; Owner: dkg 
     565-- 
     566 
     567REVOKE ALL ON TABLE organization FROM PUBLIC; 
     568REVOKE ALL ON TABLE organization FROM dkg; 
     569GRANT ALL ON TABLE organization TO dkg; 
     570GRANT INSERT,SELECT,UPDATE ON TABLE organization TO "www-data"; 
     571 
     572 
     573-- 
    554574-- Name: category; Type: ACL; Schema: public; Owner: dkg 
    555575-- 
     
    608628REVOKE ALL ON TABLE mail_log_id_seq FROM dkg; 
    609629GRANT ALL ON TABLE mail_log_id_seq TO dkg; 
    610 GRANT SELECT,UPDATE ON TABLE mail_log_id_seq TO "www-data"; 
    611  
    612  
    613 -- 
    614 -- Name: organization; Type: ACL; Schema: public; Owner: dkg 
    615 -- 
    616  
    617 REVOKE ALL ON TABLE organization FROM PUBLIC; 
    618 REVOKE ALL ON TABLE organization FROM dkg; 
    619 GRANT ALL ON TABLE organization TO dkg; 
    620 GRANT INSERT,SELECT,UPDATE ON TABLE organization TO "www-data"; 
     630GRANT INSERT,UPDATE ON TABLE mail_log_id_seq TO "www-data"; 
    621631 
    622632 
  • trunk/jpdd/web/jpdd.css

    r142 r144  
    8989} 
    9090 
     91 
     92.overviewnav {  
     93 margin: 0.5em; 
     94} 
     95.overviewnav a {  
     96 padding: 0.5em; 
     97} 
     98.overviewnav a:hover {  
     99 background: #77f; 
     100 outline: 1px solid blue; 
     101 color: white; 
     102} 
     103.overviewnav a.current {  
     104 background: #003; 
     105 color: white; 
     106} 
     107 
     108 
    91109a.outlink:hover {  
    92110 background: #77f; 
     
    163181} 
    164182 
     183 
    165184@media print {  
    166185 
Note: See TracChangeset for help on using the changeset viewer.