Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Memoirs of a Newbie Scoop Hacker New Code
By basshombre , Section Project []
Posted on Sat Jul 26, 2003 at 12:00:00 PM PST
First of all, I should introduce myself since it's my first time posting here. My name is Wes Morgan, and I am the webmaster of Libretech.org, a scoop-based site. Once I got scoop set up on my site, there were things I noticed right away that I would like to alter/improve about it. So, I got on the #scoop IRC channel and began discussing these things with some of the developers there. The following is a brief summary of my work and our discussions so far, and I believe it will give us a good idea of where scoop development needs to go from here.

When I first started talking to the developers in #scoop, I asked them about the usual stuff that the scoop developers are tired of being asked about (i18n, CSS over table-based layout, etc.). Janra informed me that before any work on those projects could begin, the HTML and displayed text needed to be moved out of the Perl code and into the database (so that it can be associated with a theme and a locale). So, being fairly proficient in Perl, I fired up vim, checked out the latest CVS of scoop, and dove in. My strategy was this (again, as per discussions w/ the developers): I would remove the HTML in the code and replace it with references to vars and blocks. I got every last bit of HTML and displayed text out of Scoop.pm (top level module), which went pretty smoothly. I hadn't created that many new blocks, and Scoop.pm was now fully agnostic of its theme and locale (I created a default-css theme that got rid of the <font> tags and used CSS instead just to test it out, it worked beautifully).

I then turned to the Admin subdirectory of the scoop source and started to do the same work in Ads.pm (the module that controls the Ad Admin page). I was making new blocks left and right with ridiculously long names (not to mention the fact that they contained little blurbs of text that no one would probably ever want to change except for l10n purposes). Then I got to an error message that informed the user that the admin type they requested did not exist. Like all error messages should, it contained logic to inform the user what admin type had been requested to generate the error. This could not be converted to a block because it was dynamic, it needed that Perl code to be able to grab the requested admin type for the error message. I realized that between this problem and the explosion of vars and blocks I was creating, we needed to rethink this strategy.

I went back to #scoop to discuss the situation. Hillct suggested that we create a status/error object that we always passed around (accessible through $S I imagine) that would consolidate status/error message handling and make it more consistent. Modules could then pass error/status states from call to call. This would also eliminate a subset of the text fragments I was running into (and making an obscene number of blocks to handle).

However, this still left us with the remaining text fragments and the dynamic messages that didn't fall under the categories of status or error. I suggested that we create subcategories to handle all these vars and blocks, putting the less significant ones into lower categories. Hillct suggested that we also needed to recode many of the modules so that they used a primary template block which referenced the appropriate vars/blocks inside it (instead of haphazardly constructing the "block" in the Perl source). He gave Admin/EditBoxes.pm as an example of this. This module computes a hash of the values for the special vars in the template block and then runs that block (admin_boxes_form) through the interpolate function at the end. In looking over this file I noticed that it still contained a decent amount of HTML and/or displayed text (mostly where it was setting the values of the special vars/blocks). However, this was not a design flaw, it needed to have these things in the code because they are dynamic. It wouldn't do to put their value into a static var or block (static in the sense that it can only change if a user or admin changes it, scoop itself can only read the value).

So, even with subcategories and cleaned-up modules, we still had the problem of dynamic content. Then I realized, handling dynamic content is what boxes are for. So then I thought about what a box actually is. It's really just code that happens to be in the database. That's when I had an epiphany that I was going about this backwards. I didn't need to pull the HTML and the text out of the code (well, in some places it really should have been moved to a var/block), instead I should be putting the code, HTML, and displayed text all into the DB. When I suggested this to hillct, he said it had been discussed before. The idea was to turn scoop into a box-running framework. The problem with doing it right now is that it would make updates a nightmare. However, if we had an XML-RPC based Box Exchange system up and running, we could check MD5 checksums of boxes in the DB against the version in the exchange, and if they match, we could auto-upgrade the box. If not, we inform the site admin that there is a new version of the box available and let her/him merge it with her/his changes. Hillct said that was something he'd like to do with scoop 2.0, which is a little ways off yet. I went back to thinking about simpler mechanisms that could be used with 1.0-era scoop. I suggested that we keep filesystem information in the DB, so when we needed to update, we simply export all the code into its filesystem hierarchy (this would also be handy for hacking on it), update it w/ CVS (so we get all the nice merge-handling), then re-import it into the DB.

To summarize, for scoop to gain features such as CSS-based layout or i18n, it needs to have every bit of HTML and displayed text moved into the database. However, there are many text fragments throughout the code that would create a var/block explosion if they were all moved out as individual pieces. Var/block subcategories could ease this confusion somewhat as most admins would only need to deal with the upper-most categories (leaving theme/l10n developers to mess with the rest), but it would need to be combined with module code reorganization similar to what hillct did with Admin/EditBoxes.pm to keep it somewhat sane. It was also suggested that perhaps we get a little more strict about the naming conventions for vars and blocks (w/ various ideas suggested about how we effectively do that). But, like in EditBoxes.pm, we still have lots of dynamic content that needs to be handled by some Perl before we know what its value should be. Creating a common status/error object would help here, but there is still dynamic content that would fall outside that component's task. So, the ultimate solution is to move as much of the code into the DB as possible thereby allowing it to be themed and localized. However, the one big gotcha with that plan is how to handle updates. My suggestion of filesystem export seems as though it could work as an interim solution until the Scoop Box Exchange is ready for prime time (it's still in "That's a Neat Idea" phase), but I could be missing something important that would make it more trouble than it's worth.

So now it's time for comments. What approach should we take here? And if we come up with one, can we decide on a roadmap and version targets? There are many layers to this problem no matter how we choose to tackle it, and each one is not very glamourous to work on. We really need to implement each of these ideas to varying degrees because they each have a hand in keeping things sane. The state of the scoop development community right now would be hard pressed, I think, to accomplish all these tasks in an orderly fashion (w/ that caveat that I'm new here, so what do I know?). However, if we get an overall goal in mind and then divide that into the mundane tasks that need to be done in order to accomplish it and put that all into a roadmap w/ assigned teams (some/many of which may consist of only one person at first, but we need a mechanism for not letting things get left undone because the person they were assigned lost interest/time/whatever), we can get scoop development moving again, and moving in the right direction.

< Scoop Install on OpenBSD 3.3 Problem: DBD::mSQL | WiseNomad.com Launched - Site for backpackers & world travelers >

Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Login
Make a new account
Username:
Password:

Related Links
· Scoop
· Libretech. org
· More on New Code
· Also by basshombre

Story Views
  61 Scoop users have viewed this story.

Display: Sort:
Memoirs of a Newbie Scoop Hacker | 11 comments (11 topical, 0 hidden)
Theming boxes as well as blocks (none / 0) (#1)
by hillct on Sat Jul 26, 2003 at 08:33:41 PM PST

After reading this over, it occurs to me that as far as I know, boxes are not currently themable, so exporting perl code to boxes in order to have multiple versions to reflext multiple languages, wouldn't help. That said, making boxes themable is certainly within the realm of possibility. This is more a question for janra though as I havn't really done much with themes.

From what I have done with themes, it is somewhat difficult to manage in that blocks are assigned to themes within variables. If the block-theme assignments were moved to a table, then making box-theme associations could be easily done as well.

Shortly I'll post a more detailed proposal for the error/status object which panner and I discussed and designed rather thuroughly last year.

--CTH


--
ScoopHost.com - Premier Scoop Hosting and custom development from the lead developers.


Don't use vars or blocks (5.00 / 2) (#3)
by hurstdog on Thu Jul 31, 2003 at 10:14:45 PM PST

Create a new type, call it 'texts' or something. In there make categories ('errors', 'warnings', 'questions', 'informational', etc) and have it be similar to vars and blocks. Add them with |text:text_str_name| into the vars and blocks. It would require just a small change to the lookup, and it would keep them out of the logically different vars and blocks. Essentially, it would be just like vars but for text strings only. -andrew

-hurstdog


academized legit (none / 0) (#6)
by KayleeScarberry on Tue Feb 12, 2019 at 12:37:09 PM PST

It is a process of learning while you are doing it so that academized legit can earn from it. I know a lot of people who are making ends meet through this great service for students.



Thank you (none / 0) (#7)
by scdobre on Tue Jul 16, 2019 at 06:17:19 AM PST

Thank you so much for sharing the nice article, I hope to hear more updates from you gmail email login



www.upsers.com (none / 0) (#8)
by willams78w on Tue Nov 19, 2019 at 08:50:59 AM PST

The valves are the structures that we have mentioned, located at the entrance and exit of the cavities. They allow blood to flow in only one direction. upsers | www.upsers.com | upserscom



mykfcexperience survey (none / 0) (#9)
by rammipaulz on Wed Dec 04, 2019 at 01:58:29 AM PST

mykfcexperience survey takes only a few minutes to complete. Your opinions matter to the KFC management team, and they want to know if their customers are happy with them or not.



share (none / 0) (#10)
by scoby on Fri Apr 17, 2020 at 06:51:31 AM PST

wow, that was a long share. trading forex is easy as well but it's vital to find a good broker. check out forex rating



great (none / 0) (#11)
by heenacruzl on Sat Jul 11, 2020 at 03:33:13 AM PST

Great, you have given interesting information and experiences, I really like it. return man 3



Memoirs of a Newbie Scoop Hacker | 11 comments (11 topical, 0 hidden)
Display: Sort:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search