Historic:CssWork: Difference between revisions

From SoylentNews
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:


* [[SlashChart]] Png chart of slashcode organization
* [[SlashChart]] Png chart of slashcode organization
* [[FileLocations]] Locations of important files on disk
* [[FileLocations]] Locations of important files on disk. Has apache, Libraries called by all routines
* [[FileLocations2]] Locations of files on disk continued. This is the stuff in local.
* [[HowSlashThemesWork]] Overview
* [[HowSlashThemesWork]] Overview
* [[AvailableThemes]] and how they are organized
* [[AvailableThemes]] and how they are organized

Revision as of 21:19, 19 February 2014

Related pages

http://www.mediawiki.org/wiki/Help:Images

Order css files are loaded when simple switch on user prefs page is selected viewing main page main page

  • base.css?T_2_5_0_272
  • slashcode.css?T_2_5__0_272
  • slashcode_lite.css?T_2_5__0_272
  • slashcode_lite.css?T_2_5__0_272 (appears to be loading this twice,why?)
  • print.cssT_2_5__0_272

Follow a page link from the main page to an individual article page

article.pl

The stuff of interest to us


use Slash;  -------- located in /local/lib64/perl5/slash.pm
use Slash::Display;     
use Slash::Utility;

sub main {
        my $slashdb   = getCurrentDB();
        my $constants = getCurrentStatic();
        my $user      = getCurrentUser();
        my $form      = getCurrentForm();
        my $gSkin     = getCurrentSkin();
         
        my $story;
        my $reader = getObject('Slash::DB', { db_type => 'reader' });

                # Make sure the reader is viewing this story in the
                # proper skin.
                my $cur_skid = determineCurrentSkin();
                if ($story->{primaryskid} != $cur_skid) {
                        my $cur_skin = $reader->getSkin($cur_skid);
                        my $story_skin = $reader->getSkin($story->{primaryskid});
                        if ($story_skin && $story_skin->{rootdir}
                                && $story_skin->{rootdir} ne $cur_skin->{rootdir})$
                                redirect("$story_skin->{rootdir}$ENV{REQUEST_URI}"$
                                return;

               # XXXSECTIONTOPICS this needs to be updated
                my $SECT = $reader->getSection($story->{section});
                # This should be a getData call for title
                my $title = "$constants->{sitename} | $story->{title}";
                if ($gSkin->{name} && $gSkin->{name} eq "idle") {
                        $title = "$gSkin->{hostname} | $story->{title}";
                
if (my $pollbooth_db = getObject('Slash::PollBooth')) {


slashDisplay('display', {
                        poll                    => $pollbooth,
                        section                 => $SECT,
                        section_block           => $reader->getBlock($SECT->{secti$
                        show_poll               => $pollbooth ? 1 : 0,
                        story                   => $story,
                        stories                 => \%stories,
                });


               my $called_pc = 0;
                if ($story->{discussion}) {
                        # Still not happy with this logic -Brian
                        my $discussion = $reader->getDiscussion($story->{discussio$

                        }
                        # If no comments ever have existed and commentstatus is di$
                        # just skip the display of the comment header bar -Brian

                               &&  $discussion->{commentstatus} eq 'disabled'
                        )) {
                                printComments($discussion);
                                $called_pc = 1;
                        }
                 if (!$called_pc && $form->{ssi} && $form->{ssi} eq 'yes' && $form-$
                        # This is a real hack, we're kind of skipping down
                        # two levels of code.  But the cchp printing is an
                        # important optimization;  we avoid having to do
                        # multiple expensive comment selects.  One problem
                        # is that if there's no discussion with a story,
                        # printComments() doesn't get called, which means
                        # selectComments() doesn't get called, which means
                        # the cchp file won't be written.  If article.pl
                       # is being called by slashd, and we need to write
                        # that file, then here's where we print an empty
                        # file that will satisfy slashd. - Jamie

                        Slash::Utility::Comments::_print_cchp({ stoid => "dummy" }$
                }
        } else {
                header('Error', $form->{section}) or return;
       
       my $plugins = $slashdb->getDescriptions('plugins');
        if (!$user->{is_anon} && $plugins->{Tags} && $story) {
                my $tagsdb = getObject('Slash::Tags');
                $tagsdb->markViewed($user->{uid},
                        $reader->getGlobjidCreate('stories', $story->{stoid}));
        }
                        
        footer();
        if ($story) {
                writeLog($story->{sid} || $sid);
        } else { 
                writeLog($sid);

               
createEnvironment();
main();  
1; 

(EOF)


Slash.pm

in /usr/local/lib64/perl5/

in root@mike2 perl5 # grep '^sub' Slash.pm 
sub dispStory {
sub displayStory {
sub displayRelatedStories {
sub getOlderStories {
sub getOlderDays {
sub getOlderDaysFromDay {
sub getData {
sub _dataCacheRefresh {

display.pm

In local/lib64/slash/display.pm

root@mike2 Slash # grep '^sub' Display.pm 
sub slashDisplay {
sub slashDisplayName {
sub get_template {
sub _ref { ref $_[0] }
sub tempWarn {

Slash/DB/MySQL/MySQL.pm


479 sub getCSS {
480         my($self, $layout) = @_;
481         my $user = getCurrentUser();
482         my $page = $user->{currentPage};
483         my $skin = getCurrentSkin('name');
484         my $admin = $user->{is_admin};
485         my $theme = ($user->{simpledesign} || $user->{pda}) ? "light" : $user->{css_theme};
486         my $secure = apacheConnectionSSL();
487         $layout ||= '';
488         my $constants = getCurrentStatic();
489
490         my $expire_time = $constants->{css_expire} || 3600;
491         $expire_time += int(rand(60)) if $expire_time;
492         _genericCacheRefresh($self, 'css', $expire_time);
493         _genericCacheRefresh($self, 'css_pages', $expire_time);
494         _genericCacheRefresh($self, 'css_skins', $expire_time);
495         _genericCacheRefresh($self, 'css_themes', $expire_time);
496
497         my $css_ref             = $self->{_css_cache} ||= {};
498         my $css_pages_ref       = $self->{_css_pages_cache};
499         my $css_skins_ref       = $self->{_css_skins_cache};
500         my $css_themes_ref      = $self->{_css_themes_cache};
501         my $css_layouts_ref     = $self->{_css_layouts_cache};
502
503         $css_pages_ref = $self->getCSSValuesHashForCol('page') if !$css_pages_ref;
504         $css_skins_ref = $self->getCSSValuesHashForCol('skin') if !$css_skins_ref;
505         $css_themes_ref = $self->getCSSValuesHashForCol('theme') if !$css_themes_ref;
506         $css_layouts_ref = $self->getCSSValuesHashForCol('layout') if !$css_layouts_ref;
507
508         my $lowbandwidth = ($user->{lowbandwidth} || $user->{pda}) ? "yes" : "no";
509
510         $page   = '' if !$css_pages_ref->{$page};
511         $skin   = '' if !$css_skins_ref->{$skin};
512         $theme  = '' if !$css_themes_ref->{$theme};
513         $layout = '' if !$css_layouts_ref->{$layout};
514
515         return $css_ref->{$skin}{$page}{$admin}{$theme}{$lowbandwidth}{$layout}{$secure}
516                 if exists $css_ref->{$skin}{$page}{$admin}{$theme}{$lowbandwidth}{$layout}{$secure};
517
518         my @clauses;
519
520         my $page_q = $self->sqlQuote($page);
521         my $page_in = $page ? "(page = '' or page = $page_q)" : "page = ''";
522         push @clauses, $page_in;
523
524         my $skin_in = $skin ? "(skin = '' or skin = '$skin')" : "skin = ''";
525         push @clauses, $skin_in;
526
527         push @clauses, "admin='no'" if !$admin;
528
529         my $theme_q  = $self->sqlQuote($theme);
530         my $theme_in = $theme ? "(theme='' or theme=$theme_q)" : "theme=''";
531         push @clauses, $theme_in;
532
533         push @clauses, "lowbandwidth='$lowbandwidth'" if $lowbandwidth eq "no";
534
535         my $layout_q = $self->sqlQuote($layout);
536         push @clauses, "layout=$layout_q";
537
538         my $where = "css.ctid=css_type.ctid AND ";
539         $where .= join ' AND ', @clauses;
540
541         my $css = $self->sqlSelectAllHashrefArray("rel,type,media,file,title,ie_cond,skin",
542                 "css, css_type", $where, "ORDER BY css_type.ordernum, css.ordernum");
543         if ($secure) {
544                 for my $hr (@$css) { $hr->{file} =~ s/\.css/.ssl.css/ }
545         }
546         
547         $css_ref->{$skin}{$page}{$admin}{$theme}{$lowbandwidth}{$layout}{$secure} = $css;
548         return $css;
549 }
550 


more stuff in local/lib64/slash

Apache.pm:sub SlashVirtualUser ($$$) {
Apache.pm:sub SlashSetVar ($$$$) {
Apache.pm:sub SlashSetForm ($$$$) {
Apache.pm:sub SlashCompileTemplates ($$$) {
Apache.pm:sub ProxyRemoteAddr ($) {
Apache.pm:sub ConnectionIsSSL {
Apache.pm:sub ConnectionIsSecure {
Apache.pm:sub IndexHandler {
Apache.pm:sub DESTROY { }
Client.pm:sub new {
Client.pm:sub soap {
Client.pm:sub find_cookie_file {
Client.pm:sub bakeUserCookie {
Client.pm:sub literal {
Client.pm:sub fixparam {
Constants.pm:sub constants {
DB.pm:sub new {
DB.pm:sub isInstalled {
DB.pm:sub init {
DB.pm:sub DESTROY {
Display.pm:sub slashDisplay {
Display.pm:sub slashDisplayName {
Display.pm:sub get_template {
Display.pm:sub _ref { ref $_[0] }
Display.pm:sub tempWarn {
Hook.pm:sub slashHook {
Install.pm:sub new {
Install.pm:sub create {
Install.pm:sub delete {
Install.pm:sub deleteByID  {
Install.pm:sub get {
Install.pm:sub exists {
Install.pm:sub getValue {
Install.pm:sub getByID {
Install.pm:sub readTemplateFile {
Install.pm:sub writeTemplateFile {
Install.pm:sub installTheme {
Install.pm:sub installThemes {
Install.pm:sub installPlugin {
Install.pm:sub installPlugins {
Install.pm:sub installTagbox {
Install.pm:sub installTagboxes {
Install.pm:sub _munge_line {
Install.pm:sub _process_fh_into_sql {
Install.pm:sub _install {
Install.pm:sub getPluginList {
Install.pm:sub getThemeList {
Install.pm:sub getTagboxList {
Install.pm:sub getSiteTemplates {
Install.pm:sub _parseFilesForTemplates {
Install.pm:sub _getList {
Install.pm:sub setListOrder {
Install.pm:sub setListInstallOrder {
Install.pm:sub reloadArmors {
Plugin.pm:sub isInstalled {
Slashboxes.pm:sub getUserSlashboxes {
Slashboxes.pm:sub displaySlashboxes {
Test.pm:sub import {
Test.pm:sub slashTest {
Test.pm:sub Display {
Test.pm:sub Test {
Test.pm:sub _getTemplate {
Tools.pm:sub import {
Tools.pm:sub syntax_check {
Tools.pm:sub basefile {
Tools.pm:sub srcfile {
Tools.pm:sub installfile {
Tools.pm:sub counterpart {
Tools.pm:sub _getpackage {
Tools.pm:sub pathpm {
Tools.pm:sub pmpathsrc {
Tools.pm:sub pmpath {
Tools.pm:sub myprint {
Tools.pm:sub myexit {
Tools.pm:sub myask {
Tools.pm:sub mysystem {
Tools.pm:sub new {
Tools.pm:sub front {
Tools.pm:sub frontpath {
Tools.pm:sub output {
Tools.pm:sub file {
Tools.pm:sub do_prep {
Tools.pm:sub do {
Tools.pm:sub gitdiff {
Tools.pm:sub diff {
Tools.pm:sub new {
Tools.pm:sub set_type {
XML.pm:sub xmlDisplay {
XML.pm:sub date2iso8601 {
XML.pm:sub encode {



Slash/Apache/User/User.pm


548 {
549 my %ops_my = (
550         inbox           => { args => 'op=list', uri => 'messages.pl' },
551         # XXX change messages to be same as /inbox, move this to /my/preferences/messages
552         messages        => { args => 'op=display_prefs', uri => 'messages.pl' },
553         comments        => { args => 'op=editcomm' },
554         homepage        => { args => 'op=edithome' },
555         password        => { args => 'op=changeprefs', uri => 'login.pl' },
556         logout          => { args => 'op=userclose', uri => 'login.pl' },
557         misc            => { args => 'op=editmiscopts' },
558         amigos          => { args => 'op=friendview', uri => 'journal.pl' },
559         bookmarks       => { args => 'op=showbookmarks' },
560         firehose        => { args => 'op=userfirehose' },
561         preferences     => { args => 'op=displayprefs', uri => 'preferences.pl' },
562         tags            => { args => 'op=showtags' },
563         journal         => { args => 'op=list', uri => 'journal.pl' },
564
565         friends         => { args => 'op=friends', uri  => 'zoo.pl' },
566         fans            => { args => 'op=fans', uri  => 'zoo.pl' },
567         freaks          => { args => 'op=freaks', uri  => 'zoo.pl' },
568         foes            => { args => 'op=foes', uri  => 'zoo.pl' },
569         zoo             => { args => 'op=all', uri  => 'zoo.pl' },
570
571         default         => { args => 'op=edituser' }
572 );

sql/mysql/defaults.sql

 134 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','base.css','','','','no','',1,0, "","no");
135 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','comments','no','',2,0, "","no");
136 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','article','no','',2,0, "","no");
137 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','print','print.css','','','','no','',5,0, "","no");
138 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','admin.css','','','','yes','',1,0, "","no");
139 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','pollBooth','no','',2,0, "","no");
140 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','slashcode_lite.css','','','','no','light',4,0, "","no");
141 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','journal','no','',2,0, "","no");
142 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','slashcode_lite.css','','','','no','light',4,0, "","no");
143 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','journal','no','',2,0, "","no");
144 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','slashcode.css','','','','no','',3,0, "","no");
145 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','metamod','no','',2,0, "","no");
146 INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond, lowbandwidth) VALUES ('stylesheet','text/css','screen, projection','slashcode_low_bw.css','','','','no','',4,99, "","yes");
147
148 #
149 # Dumping data for table 'css_type'
150 #
151 INSERT INTO css_type (ctid, name, ordernum) VALUES (1,'base',1);
152 INSERT INTO css_type (ctid, name, ordernum) VALUES (2,'page',2);
153 INSERT INTO css_type (ctid, name, ordernum) VALUES (3,'theme',3);
154 INSERT INTO css_type (ctid, name, ordernum) VALUES (4,'user_theme',5);
155 INSERT INTO css_type (ctid, name, ordernum) VALUES (5,'print',6);
156 INSERT INTO css_type (ctid, name, ordernum) VALUES (6,'skin',4);
157 INSERT INTO css_type (ctid, name, ordernum) VALUES (7,'handheld',7);
158 


plugins/FireHose/mysql_dump.sql

    INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','firehose.css','','','firehose','no','',2,0, '');
==> INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','firehose.css','','','users','no','',2,0, '');
    INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','calendar.css','','','firehose','no','',2,0, '');
==> INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','firehose.css','','','users','no','',2,0, '');
    INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','firehose','no','',2,0, '');
    INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','firehose.css','','','index2','no','',2,0, ''); 

I believe that we are not using FireHose but it was needed to make the site work. As can be seen in the db dump above, it adds the firehose.css file to any of the user pages. Need to verify and then see if we can get the db purged of these values.

Good work. The question in my mind is why the heck css for one module has any effect *at all* on any other module. Talk about lack of localization...-AG

I think there was some firehose slashboxes that showed up in the users pages. They needed to be wider than the default, so they patched those pages with the firehose.css. Next step is to get a current dump of the two css tables. The important part is I know what files are for what parts of the code. Slashcode.css is the theme css file slashcode-lite.css is the style file that is called by a user pref. This means I need to fix comments.css to remove the theme elements I inserted and put them in the theme file. I still need to make sure that the changes that benefited the Simplified theme stay intact. -EP