Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 01:39:05 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155504 Posts in 21710 Topics by 7736 Members
Latest Member: deenangle
* Home Help Search Login Register
Pages: [1] 2   Go Down
Print
Author Topic: Code_2 Module  (Read 4494 times)
erpe

Offline Offline

Posts: 2077


WWW
« on: June 18, 2009, 09:27:09 AM »

Hi@all

Aldus improved Chio's Code_2 Module and made it extensible.

New release can be downloaded at AMASP

rgds

erpe
Logged

dbs
WebsiteBaker Org e.V.

Offline Offline

Posts: 3714


WWW
« Reply #1 on: June 18, 2009, 11:23:04 AM »

very very nice modification!!!
good job, aldus!  smiley

gruß dbs
Logged

kirk
WebsiteBaker Org e.V.

Offline Offline

Posts: 204



WWW
« Reply #2 on: June 18, 2009, 12:58:05 PM »

Thank you for this nice extension.

where i can change the default setting full to smart?

i wanted the smart modus generelly.

Kirk
Logged
aldus

Offline Offline

Posts: 1238


« Reply #3 on: June 18, 2009, 02:46:34 PM »

Inside "modify.php" line 37 - change "1" to "2" will do the trick:
Code:
<?php // as often - please ignore this line. 
$mode = ($whatis >= 10) ? (int)($whatis 10) : 2;

Regards
Aldus
Logged
roedental

Offline Offline

Posts: 80



WWW
« Reply #4 on: June 18, 2009, 02:50:13 PM »

Hey, nice work!

I changed some comments to admin comment, how can I change it back?

Sven
Logged
aldus

Offline Offline

Posts: 1238


« Reply #5 on: June 18, 2009, 03:02:38 PM »

Hm ... as far as i understand the moduldescription
Quote
"Admin Comment" can be edited only by admins (group 0), others see a yellow area in the backend.

you must be loged in as an admin ... otherwise you can't change it.

Regards
Aldus
Logged
kirk
WebsiteBaker Org e.V.

Offline Offline

Posts: 204



WWW
« Reply #6 on: June 18, 2009, 03:45:00 PM »

aldus: thanks this mess up my backend

great

kirk
Logged
roedental

Offline Offline

Posts: 80



WWW
« Reply #7 on: June 18, 2009, 04:12:29 PM »

Quote
Hm ... as far as i understand the moduldescription
Quote
"Admin Comment" can be edited only by admins (group 0), others see a yellow area in the backend.

you must be loged in as an admin ... otherwise you can't change it.

I´m loged in with rights of an admin, but not as admin! I was able to change the comments to admin comments, but now I`m not able to change it back!
Logged
aldus

Offline Offline

Posts: 1238


« Reply #8 on: June 18, 2009, 04:27:54 PM »

I haven't change the way the modul handles this situation ...
so far i can see it, you will make changes in the db via PhpMyAdmin in the
modul-table "mod_code2" and set the values of the "whatis" field to "0" (null) ...

Or use a codepage/dorplet to submit a query that will do the job.
Code:
<?php
$q 
"update ".TABLE_PREFIX."mod_code2 set whatis=0 where whatis=4";
$r $database->query$q );
if (
$database->is_error()) echo "Error: ".$database->get_error();
else echo 
"ok";
?>


Lefthanded untested!
Regards
Aldus
Logged
aldus

Offline Offline

Posts: 1238


« Reply #9 on: June 18, 2009, 04:57:44 PM »

Chio has found a bug inside the upgrade.php and a nice suggestion for the view.php also,

Version 1.2.3 is at AMASP avaible:

http://www.websitebakers.com/pages/admin/core-replacements/code-2.php

Regards
Aldus
Logged
roedental

Offline Offline

Posts: 80



WWW
« Reply #10 on: June 19, 2009, 08:51:54 AM »

Quote
I haven't change the way the modul handles this situation ...
so far i can see it, you will make changes in the db via PhpMyAdmin in the
modul-table "mod_code2" and set the values of the "whatis" field to "0" (null) ...

That is OK, so I will change it in the db, but maybe it is possible to change the code of the module so, that every user, who has the admin rights, can change the comments back.

I have another wish, when  I use the admincomment, every other user sees only the comment, it would be nice, if the comment is a little bit more highlighted, so that erveryone recognize it.
Thanks for your work

Sven
Logged
aldus

Offline Offline

Posts: 1238


« Reply #11 on: June 19, 2009, 09:13:56 AM »

Hm ... as far as i can read
Code:
<?php
if ($whatis == AND $admin->get_group_id() <> 1) {
    
$content $content['content'];
    echo 
'<div class="code2_admin">'.$content.'</div>';
} else {
?>


You must belong to the group(_id) 1 (Admins) ... then it works ...

Hm ... another one is the language-support - still in englisch hardcoded,
so were is no dutch, german, france version avaible.

As for the colours - you can modify the backend.css as you like it ...

Still something to do on this little modul ...  smiley

Regards
Aldus
Logged
aldus

Offline Offline

Posts: 1238


« Reply #12 on: June 19, 2009, 10:48:11 AM »

Version 1.2.4 is uploaded to AMASP
http://www.websitebakers.com/pages/admin/core-replacements/code-2.php

Add languagesupport for EN and DE ... could be nice to have also an NL/FR version in future.
There are additional language-strings inside the "backend.js" to modify for new languages,
but mostly is inside the language files. Also some minor cosmetic changes to get rid of the
//dancing// mode-select if the type is changing ...

Regards
Aldus
Logged
roedental

Offline Offline

Posts: 80



WWW
« Reply #13 on: June 19, 2009, 11:07:00 AM »

Hey,

I changed the code like this:

Quote
$admin = $_SESSION['GROUPS_ID'];

if ($whatis == 4 AND $admin != 1) {
    $content = $content['content'];
    echo '<div class="code2_admin">'.$content.'</div>';
} else {
    $content = (htmlspecialchars($content['content']));
// none admin
if  ($admin != 1) {
        $whatisarray = array('PHP', 'HTML', 'Javascript', 'Internal Comment');
                 }
// admin
if ($admin == 1) {
    $whatisarray = array('PHP', 'HTML', 'Javascript', 'Internal Comment', 'Admin Comment');
                  }
   

Now it works for me. I use the groups_id, not the group_id, because all users with admin rights are in the same groups_id. And only for users with admin right is it possible to use the the admincomment,other users have only the choice between PHP, HTML, JAVASCRIPT and INTERNAL COMMENT!

See you
Sven
Logged
thorn

Offline Offline

Posts: 980


WWW
« Reply #14 on: June 19, 2009, 11:47:25 AM »

Hello,

Quote
$admin = $_SESSION['GROUPS_ID'];
($admin is reserved for use with wb classes, as $wb, too. Do not use $admin for other purposes!)
afaik, groups_id is an array EDIT: a comma separated string (to hold more than one group a user may belongs to).

So something like
Code:
$groups = $_SESSION['GROUPS_ID'];
$groups = explode(',', $groups);
...
if ($whatis == 4 AND in_array(1, $groups)) {
is needed.

Or better
Code:
$groups = $admin->get_groups_id();
...
if ($whatis == 4 AND in_array(1, $groups)) {

thorn.
« Last Edit: June 19, 2009, 12:00:31 PM by thorn » Logged

roedental

Offline Offline

Posts: 80



WWW
« Reply #15 on: June 19, 2009, 12:05:55 PM »

Thanks, I will do it better next time! rolleyes
Logged
roedental

Offline Offline

Posts: 80



WWW
« Reply #16 on: July 13, 2009, 10:11:14 AM »

Hey Aldus,

I like the Admin comment to give other users some hints, but I have some users, who have no rights for the modules, they only can write and edit news. But such users don`t see my hints, because they have no rights for modules. Is it possible, that every user can see the admin comments?

Thanks for your work!

Sven
Logged
aldus

Offline Offline

Posts: 1238


« Reply #17 on: July 13, 2009, 10:47:09 AM »

Hm ... maybe i missunderstood, but you can set the rights
to see/edit modules in the advanced-settings of "groups" -> "modul permissions" ...
Maybe this is what you want ...

Regards
Aldus
Logged
roedental

Offline Offline

Posts: 80



WWW
« Reply #18 on: July 13, 2009, 01:47:16 PM »

Yes, I know this, but then the Users can see and edit  all Code2 sections. I want, that this users can see only the admin comments and not the other code2 sections. They should not work with the Code2 module, they should only see the admin comments.

Sven
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #19 on: July 22, 2009, 06:11:16 PM »

Hi,

I get a ERROR while installing the latest Version (fresh from Amasp)


Notice: Undefined variable: js_back in /www/htdocs/w0098-0815/mydemo/modules/code2/install.php on line 77

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'0\',`page_id` INT NOT NULL DEFAULT \'0\',`whatis` INT NOT NULL DEFAULT \'0\',`' at line 1


Running on a subdomain by all-inkl.com

Any suggestions?

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
aldus

Offline Offline

Posts: 1238


« Reply #20 on: July 22, 2009, 06:37:31 PM »

Hi,

I get a ERROR while installing the latest Version (fresh from Amasp)


Notice: Undefined variable: js_back in /www/htdocs/w0098-0815/mydemo/modules/code2/install.php on line 77

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'0\',`page_id` INT NOT NULL DEFAULT \'0\',`whatis` INT NOT NULL DEFAULT \'0\',`' at line 1


Running on a subdomain by all-inkl.com

Any suggestions?

Regards,
Stefek


Hello Stefek

Could be the mySql version - could be the php version - could be ...

however ... i've attache a 'hotfix' (2.0.1.1) and want to know if it works ...

Regards
Aldus

Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #21 on: July 22, 2009, 07:59:27 PM »

Hi Aldus,

Installation was good now, but after generating a new section code2
I get this message:


Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/htdocs/w0815/mydemo/modules/code2/classes/c_js_loader.php on line 7
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
aldus

Offline Offline

Posts: 1238


« Reply #22 on: July 22, 2009, 08:12:20 PM »

Do you run under PHP4 or PHP5 ... if so ... try the php5-httacccess hack ... as the class for the quick hack was for ... ups
PHP5!
Maybe i got an php4 - version this evening ... but better wait for tomorrow ..

Regards
Aldus
... immer grüsst das murmeltier ... ausgerechnet vor meiner Tür ... wink

Edit
Die php4 version als 2.0.1.2 als Attachment ... sollte so eigentlich funktionieren

WB rocks  cool
« Last Edit: July 22, 2009, 08:22:41 PM by aldus » Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #23 on: July 22, 2009, 08:53:44 PM »

Thanks Aldus.

Works great now on PHP 4.4.9


Regards,
Stefek

Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
instantflorian
Betatester
*
Offline Offline

Posts: 804



WWW
« Reply #24 on: September 25, 2009, 09:00:50 AM »

Hi,

is it possible to use EditArea for this module? Syntax highlighting in the backende of a code2 section would be quite useful...

Regards

-instantflorian.
Logged
Pages: [1] 2   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!