We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2734
    • 165 Posts
    Quote from: dflock at Feb 16, 2008, 06:32 AM

    EasyPoll seems to be coming along nicely - congrats Banal!

    I’ve attached a slightly modified version of the English lang file, with some small corrections and (what I consider to be) some improved wording - feel free to use this if you like.
    Thanks a lot dflock, much appreciated.
    I’m glad somebody had a look at the English language file.
    It will be included in the next release.
    I guess the next step would be to post this in the MODx repositories. To be done soon smiley
      • 2734
      • 165 Posts
      I just seem to keep myself from writing a documentation by adding more and more features to the EasyPoll Snippet grin
      Now you can add custom handler functions instead of templates into a chunk. This is especially useful for those of you who want absolute control over the snippets appearance. It adds some nice possibilities too, like the output you can see in the following screenshot:


      The color of the result-bar is determined by the percentage (from 0% = red to 100% = green). The percentage label is placed inside the bar, when percentage >= 50% and outside the bar when the percentage is smaller than 50%.

      New Release, Documentation and example code will follow soon (promise).
      Cheers -- banal

        • 7253
        • 97 Posts
        Has anyone tried backing up and restoring a MODx database with EasyPoll installed? I did this the other day and I got a load of errors doing the restore.

        This is what I got restoring the backup (.sql file created from MODx managers Tools/Backup) into an empty MySQL Database:
        [tt]
        Script line: 115 Can’t create table ’.\test\beta_ep_choice.frm’ (errno: 150)
        Script line: 130 Table ’test.beta_ep_choice’ doesn’t exist
        Script line: 131 Table ’test.beta_ep_choice’ doesn’t exist
        Script line: 132 Table ’test.beta_ep_choice’ doesn’t exist
        Script line: 133 Table ’test.beta_ep_choice’ doesn’t exist
        Script line: 185 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 ’USING BTREE,
        KEY `transLangFK` (`idLang`),
        KEY `transPollFK` (`idPoll`),
        ’ at line 6
        Script line: 201 Table ’test.beta_ep_translation’ doesn’t exist
        Script line: 202 Table ’test.beta_ep_translation’ doesn’t exist
        Script line: 203 Table ’test.beta_ep_translation’ doesn’t exist
        Script line: 204 Table ’test.beta_ep_translation’ doesn’t exist
        Script line: 205 Table ’test.beta_ep_translation’ doesn’t exist
        Script line: 4262 The target table beta_poll_results of the INSERT is not insertable-into
        Script line: 4263 The target table beta_poll_results of the INSERT is not insertable-into
        Script line: 4264 The target table beta_poll_results of the INSERT is not insertable-into
        Script line: 4265 The target table beta_poll_results of the INSERT is not insertable-into
        [/tt]

        This is the first bit of the .sql backup file, with the EasyPoll tables in:

        #
        # BETA Database Dump
        # MODx 0.9.6.1 (rev 3118)
        # 
        # Host: localhost
        # Generation Time: Feb 14, 2008 pm29 16:41
        # Server version: 5.1.22-rc-community
        # PHP Version: 5.2.1
        # Database : `modx_beta`
        #
        
        # snipped some modx tables out of here...
        
        #
        # Table structure for table `beta_ep_choice`
        #
        
        DROP TABLE IF EXISTS `beta_ep_choice`;
        CREATE TABLE `beta_ep_choice` (
          `idChoice` int(10) unsigned NOT NULL AUTO_INCREMENT,
          `idPoll` int(10) unsigned NOT NULL,
          `Title` varchar(128) NOT NULL,
          `Sorting` tinyint(3) unsigned NOT NULL,
          `Votes` int(11) NOT NULL,
          PRIMARY KEY (`idChoice`),
          KEY `pollFK` (`idPoll`),
          CONSTRAINT `pollFK` FOREIGN KEY (`idPoll`) REFERENCES `beta_ep_poll` (`idPoll`) ON DELETE CASCADE
        ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
        
        #
        # Dumping data for table `beta_ep_choice`
        #
        
        INSERT INTO `beta_ep_choice` VALUES ('1','1','Blue','1','0');
        INSERT INTO `beta_ep_choice` VALUES ('2','1','Red','2','2');
        INSERT INTO `beta_ep_choice` VALUES ('3','1','Green','3','6');
        INSERT INTO `beta_ep_choice` VALUES ('4','1','Turquoise','4','0');
        
        # --------------------------------------------------------
        
        #
        # Table structure for table `beta_ep_language`
        #
        
        DROP TABLE IF EXISTS `beta_ep_language`;
        CREATE TABLE `beta_ep_language` (
          `idLang` int(10) unsigned NOT NULL AUTO_INCREMENT,
          `LangShort` char(3) NOT NULL,
          `LangName` varchar(256) NOT NULL,
          PRIMARY KEY (`idLang`),
          UNIQUE KEY `uniqLang` (`LangShort`)
        ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
        
        #
        # Dumping data for table `beta_ep_language`
        #
        
        INSERT INTO `beta_ep_language` VALUES ('1','en','English');
        
        # --------------------------------------------------------
        
        #
        # Table structure for table `beta_ep_poll`
        #
        
        DROP TABLE IF EXISTS `beta_ep_poll`;
        CREATE TABLE `beta_ep_poll` (
          `idPoll` int(10) unsigned NOT NULL AUTO_INCREMENT,
          `Title` varchar(128) NOT NULL,
          `isActive` tinyint(1) unsigned NOT NULL DEFAULT '0',
          `StartDate` datetime DEFAULT NULL,
          `EndDate` datetime DEFAULT NULL,
          PRIMARY KEY (`idPoll`)
        ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
        
        #
        # Dumping data for table `beta_ep_poll`
        #
        
        INSERT INTO `beta_ep_poll` VALUES ('1','What\'s your favourite colour?','1','2008-01-01 05:04:59','2008-02-29 05:05:05');
        
        # --------------------------------------------------------
        
        #
        # Table structure for table `beta_ep_translation`
        #
        
        DROP TABLE IF EXISTS `beta_ep_translation`;
        CREATE TABLE `beta_ep_translation` (
          `idPoll` int(10) unsigned NOT NULL,
          `idChoice` int(10) unsigned NOT NULL DEFAULT '0',
          `idLang` int(10) unsigned NOT NULL,
          `TextValue` varchar(2048) NOT NULL,
          PRIMARY KEY (`idChoice`,`idLang`,`idPoll`) USING BTREE,
          KEY `transLangFK` (`idLang`),
          KEY `transPollFK` (`idPoll`),
          CONSTRAINT `transLangFK` FOREIGN KEY (`idLang`) REFERENCES `beta_ep_language` (`idLang`) ON DELETE CASCADE,
          CONSTRAINT `transPollFK` FOREIGN KEY (`idPoll`) REFERENCES `beta_ep_poll` (`idPoll`) ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
        
        #
        # Dumping data for table `beta_ep_translation`
        #
        
        INSERT INTO `beta_ep_translation` VALUES ('1','0','1','What\'s your favourite colour?');
        INSERT INTO `beta_ep_translation` VALUES ('1','1','1','Blue');
        INSERT INTO `beta_ep_translation` VALUES ('1','2','1','Red');
        INSERT INTO `beta_ep_translation` VALUES ('1','3','1','Green');
        INSERT INTO `beta_ep_translation` VALUES ('1','4','1','Turquoise');
        
        # --------------------------------------------------------
        
        #
        # Table structure for table `beta_ep_userip`
        #
        
        DROP TABLE IF EXISTS `beta_ep_userip`;
        CREATE TABLE `beta_ep_userip` (
          `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
          `idPoll` int(10) unsigned NOT NULL,
          `ipAddress` varchar(128) NOT NULL,
          PRIMARY KEY (`id`),
          KEY `ipPollFK` (`idPoll`),
          CONSTRAINT `ipPollFK` FOREIGN KEY (`idPoll`) REFERENCES `beta_ep_poll` (`idPoll`) ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
        
        #
        # Dumping data for table `beta_ep_userip`
        #
        
        
        # --------------------------------------------------------
        


        Not sure what’s going on here - is this me doing something wrong? I can supply the full .sql file if required.

        Any ideas?

        Dunc
          • 2734
          • 165 Posts
          Ouch. That’s happening because i used foreign key constraints in my Database Tables. When backing up and restoring Tables with constraints, it is mandatory to do this in the right order.
          As you can see in your SQL, the first table to be created is "beta_ep_choice" which references "beta_ep_poll"... however "beta_ep_poll" won’t exist the moment this command is issued.
          The creation order must be:

          • ep_poll
          • ep_choice
          • ep_language
          • ep_translation
          • ep_userip

          You should be able to fix this, by re-ordering your sql statements manually. I’m really sorry for the inconvenience. If this is a major issue, i’ll remove the foreign keys in a later release...

          Or you could use the phpMyAdmin tool to dump your DB, which will prevent this from happening AFAIK.
          Hope that helps
            • 7253
            • 97 Posts
            Yeah, I thought this was probably the case. This means the you can’t use the Backup thing in the MODx manager to backup MODx installs that have EasyPoll installed - I’m all for proper database integrity and whatnot - but I don’t think that’s going to fly.
              • 2734
              • 165 Posts
              EasyPoll 0.3 was released.

              @dflock:
              i removed the foreign key constraints in version 0.3. Please update to the newer version, to be found at:
              http://modxcms.com/EasyPoll-1873.html

              In the documentation you’ll find a section how to migrate from 0.2.x to 0.3

              Please post further feedback/suggestion in the designated forum thread: http://modxcms.com/forums/index.php/topic,22981.0.html
                • 23506
                • 156 Posts
                My data
                Create a new choice
                Qestion 1
                Вопрос 1

                then error
                « MODx Parse Error »MODx encountered the following error while attempting to parse the requested resource:
                « Execution of a query to the database failed - You can't specify target table 'modx_ep_choice' for update in FROM clause »
                      SQL: INSERT INTO modx_ep_choice (idPoll, Title, Sorting) VALUES (1, 'Qestion 1', (SELECT COUNT(tmp.idPoll)+1 FROM modx_ep_choice tmp WHERE tmp.idPoll=1)) 
                      [Copy SQL to ClipBoard]
                 
                Parser timing
                  MySQL: 	0.0427 s	(5 Requests)
                  PHP: 	1203432877.7747 s	 
                  Total: 	1203432877.8175 s

                  • 2734
                  • 165 Posts
                  Quote from: pixelranger at Feb 19, 2008, 08:56 AM

                  My data
                  Create a new choice
                  Qestion 1
                  Вопрос 1
                  Hi pixelranger

                  That error looks like it’s coming from an older version of the EasyPoll Manager. Please update to Version 0.3 (by replacing all Files, module and snippet code with the new ones) and read the Documentation how to upgrade the Database.
                    • 16434
                    • 3 Posts
                    Hello,

                    this looks good. But I have question about possibilities of this module..
                    I need multiple poll module - i think, more than one question in one set and log votes from webusers.
                    Is it possible with this module? Or is it in plan to the future???
                    (I have not found an other module)

                    Thank you...
                      Just have a little faith...
                      • 2734
                      • 165 Posts
                      Quote from: kujdik at Mar 28, 2008, 11:14 AM

                      Hello,

                      this looks good. But I have question about possibilities of this module..
                      I need multiple poll module - i think, more than one question in one set and log votes from webusers.
                      Is it possible with this module? Or is it in plan to the future???
                      (I have not found an other module)

                      Thank you...
                      Hi kujdik

                      I’m not sure if i really understand what you’re trying to achieve.
                      With EasyPoll you can:

                      • Create multiple polls...
                      • ... and add multiple choices/answers to these polls
                      • Translate your polls into multiple languages

                      What do you mean by "log votes from webusers"?
                      Currently you can log the Users IP and/or store a cookie on his computer to prevent him from voting multiple times. However: You cannot track which user voted for which option. To do this, you’ll have to extend the software in a way, that it’s more of a quiz/test instead of a poll. Currently i have no plans to do so, but it’s certainly doable. The hardest part would probably be to actually create groups of questions and then create a summary of people who: successfully passed the test, failed the test and people who didn’t complete the test (maybe even separated into "started" and "not started").

                      If you plan to extend the software in such a way, i’d be interested in what you came up with.